diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 54ceca9603..fc0290fc44 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -31,6 +31,7 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { } def doRedHatBuild = false +def doFlexranCtrlTest = false pipeline { agent { @@ -40,7 +41,7 @@ pipeline { disableConcurrentBuilds() timestamps() gitLabConnection('OAI GitLab') - gitlabBuilds(builds: ["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-FDD-Band7", "Test-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40"]) + gitlabBuilds(builds: ["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-FDD-Band7", "Test-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40"]) ansiColor('xterm') } @@ -69,6 +70,12 @@ pipeline { } else { doRedHatBuild = false } + if (params.FlexRanRtcGitLabRepository_Credentials != null) { + doFlexranCtrlTest = true + } + if (fileExists("flexran")) { + sh "rm -Rf flexran > /dev/null 2>&1" + } } } } @@ -103,6 +110,18 @@ pipeline { // For the moment, there is no fail criteria. Just a notification of number of files that do not follow sh "./ci-scripts/checkCodingFormattingRules.sh" } + if (doFlexranCtrlTest) { + sh "mkdir flexran" + dir ('flexran') { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.FlexRanRtcGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_password'] + ]) { + sh "git clone https://${git_username}:${git_password}@gitlab.eurecom.fr/flexran/flexran-rtc.git . > ../git_clone.log 2>&1" + } + sh "sed -i -e 's#add-apt-repository.*cleishm.*neo4j#add-apt-repository ppa:cleishm/neo4j -y#' -e 's#libneo4j-client-dev#libneo4j-client-dev -y#' tools/install_dependencies" + sh "zip -r -qq flexran.zip ." + } + } } } post { @@ -115,10 +134,10 @@ pipeline { } } - stage ("Start VM -- cppcheck") { + stage ("Start VM -- basic-sim") { steps { timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } } } @@ -126,23 +145,7 @@ pipeline { stage ("Start VM -- enb-usrp") { steps { timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } - } - - stage ("Start VM -- basic-sim") { - steps { - timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } - } - - stage ("Start VM -- phy-sim") { - steps { - timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } } } @@ -150,7 +153,7 @@ pipeline { stage ("Start VM -- enb-ethernet") { steps { timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } } } @@ -158,7 +161,31 @@ pipeline { stage ("Start VM -- ue-ethernet") { steps { timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" + } + } + } + + stage ("Start VM -- L2-Sim") { + steps { + timeout (time: 5, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" + } + } + } + + stage ("Start VM -- phy-sim") { + steps { + timeout (time: 5, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" + } + } + } + + stage ("Start VM -- cppcheck") { + steps { + timeout (time: 5, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" } } } @@ -169,7 +196,7 @@ pipeline { steps { gitlabCommitStatus(name: "Analysis with cppcheck") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -178,7 +205,7 @@ pipeline { steps { gitlabCommitStatus(name: "Build eNb-USRP") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -187,16 +214,7 @@ pipeline { steps { gitlabCommitStatus(name: "Build basic-sim") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } - } - } - } - stage ("Build physical simulators") { - steps { - gitlabCommitStatus(name: "Build phy-sim") { - timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } @@ -205,7 +223,7 @@ pipeline { steps { gitlabCommitStatus(name: "Build eNb-ethernet") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -214,7 +232,25 @@ pipeline { steps { gitlabCommitStatus(name: "Build UE-ethernet") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + } + } + stage ("Build L2-Simulator-eNB") { + steps { + //gitlabCommitStatus(name: "Build UE-ethernet") { + timeout (time: 20, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + //} + } + } + stage ("Build physical simulators") { + steps { + gitlabCommitStatus(name: "Build phy-sim") { + timeout (time: 20, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } @@ -252,7 +288,7 @@ pipeline { archiveArtifacts artifacts: 'archives/vm_build_logs.zip' } if ("MERGE".equals(env.gitlabActionType)) { - sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" sh "./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}" def res=readFile('./oai_warning_files.txt').trim(); if ("0".equals(res)) { @@ -263,7 +299,7 @@ pipeline { addGitLabMRComment comment: message } } else { - sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}" + sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}" } if(fileExists('build_results.html')) { sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' build_results.html" @@ -280,7 +316,7 @@ pipeline { steps { gitlabCommitStatus(name: "Test phy-sim") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -288,206 +324,205 @@ pipeline { stage ("Test basic simulator") { steps { gitlabCommitStatus(name: "Test basic-sim") { - timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + timeout (time: 30, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } } - stage ("Test on CI bench #1") { - stages { - stage ("Test FDD - Band 7 - B210") { - steps { - script { - try { - if ("MERGE".equals(env.gitlabActionType)) { - gitlabCommitStatus(name: "Test-FDD-Band7") { - build job: 'eNB-CI-FDD-Band7-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), - string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), - booleanParam(name: 'eNB_mergeRequest', value: true) - ] - } - } else { - gitlabCommitStatus(name: "Test-FDD-Band7") { - build job: 'eNB-CI-FDD-Band7-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), - booleanParam(name: 'eNB_mergeRequest', value: false) - ] - } - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } + stage ("Test L2 simulator") { + steps { + gitlabCommitStatus(name: "Test L2-sim") { + timeout (time: 30, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + } + } + stage ("Build Flexran Controller") { + when { + expression {doFlexranCtrlTest} + } + steps { + timeout (time: 20, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant flexran-rtc --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } + stage ("Test FDD - Band 7 - B210") { + steps { + script { + if ("MERGE".equals(env.gitlabActionType)) { + gitlabCommitStatus(name: "Test-FDD-Band7") { + build job: 'eNB-CI-FDD-Band7-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: true) + ] + } + } else { + gitlabCommitStatus(name: "Test-FDD-Band7") { + build job: 'eNB-CI-FDD-Band7-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), + booleanParam(name: 'eNB_mergeRequest', value: false) + ] } } - post { - // In case of any non-success, we are retrieving the HTML report of the last completed - // slave job. - // The only drop-back is that we may retrieve the HTML report of a previous build - always { - script { - if (!fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) { - copyArtifacts(projectName: 'eNB-CI-FDD-Band7-B210', - filter: 'test_results*.html', - selector: lastCompleted()) - if (fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) { - sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-FDD-Band7-B210.html" - archiveArtifacts artifacts: 'test_results-eNB-CI-FDD-Band7-B210.html' - } - } + } + } + post { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. + // The only drop-back is that we may retrieve the HTML report of a previous build + always { + script { + if (!fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) { + copyArtifacts(projectName: 'eNB-CI-FDD-Band7-B210', + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-FDD-Band7-B210.html" + archiveArtifacts artifacts: 'test_results-eNB-CI-FDD-Band7-B210.html' } } } } - stage ("Test TDD - Band 40 - B210") { - steps { - script { - try { - if ("MERGE".equals(env.gitlabActionType)) { - gitlabCommitStatus(name: "Test-TDD-Band40") { - build job: 'eNB-CI-TDD-Band40-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), - string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), - booleanParam(name: 'eNB_mergeRequest', value: true) - ] - } - } else { - gitlabCommitStatus(name: "Test-TDD-Band40") { - build job: 'eNB-CI-TDD-Band40-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), - booleanParam(name: 'eNB_mergeRequest', value: false) - ] - } - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } + } + } + stage ("Test TDD - Band 40 - B210") { + steps { + script { + if ("MERGE".equals(env.gitlabActionType)) { + gitlabCommitStatus(name: "Test-TDD-Band40") { + build job: 'eNB-CI-TDD-Band40-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: true) + ] + } + } else { + gitlabCommitStatus(name: "Test-TDD-Band40") { + build job: 'eNB-CI-TDD-Band40-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), + booleanParam(name: 'eNB_mergeRequest', value: false) + ] } } - post { - // In case of any non-success, we are retrieving the HTML report of the last completed - // slave job. - // The only drop-back is that we may retrieve the HTML report of a previous build - always { - script { - if (!fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) { - copyArtifacts(projectName: 'eNB-CI-TDD-Band40-B210', - filter: 'test_results*.html', - selector: lastCompleted()) - if (fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) { - sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-TDD-Band40-B210.html" - archiveArtifacts artifacts: 'test_results-eNB-CI-TDD-Band40-B210.html' - } - } + } + } + post { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. + // The only drop-back is that we may retrieve the HTML report of a previous build + always { + script { + if (!fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) { + copyArtifacts(projectName: 'eNB-CI-TDD-Band40-B210', + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-TDD-Band40-B210.html" + archiveArtifacts artifacts: 'test_results-eNB-CI-TDD-Band40-B210.html' } } } } - stage ("Test IF4p5 - FDD - Band 7 - B210") { - steps { - script { - try { - if ("MERGE".equals(env.gitlabActionType)) { - gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") { - build job: 'eNB-CI-IF4p5-FDD-Band7-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), - string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), - booleanParam(name: 'eNB_mergeRequest', value: true) - ] - } - } else { - gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") { - build job: 'eNB-CI-IF4p5-FDD-Band7-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), - booleanParam(name: 'eNB_mergeRequest', value: false) - ] - } - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } + } + } + stage ("Test IF4p5 - FDD - Band 7 - B210") { + steps { + script { + if ("MERGE".equals(env.gitlabActionType)) { + gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") { + build job: 'eNB-CI-IF4p5-FDD-Band7-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: true) + ] + } + } else { + gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") { + build job: 'eNB-CI-IF4p5-FDD-Band7-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), + booleanParam(name: 'eNB_mergeRequest', value: false) + ] } } - post { - // In case of any non-success, we are retrieving the HTML report of the last completed - // slave job. - // The only drop-back is that we may retrieve the HTML report of a previous build - always { - script { - if (!fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) { - copyArtifacts(projectName: 'eNB-CI-IF4p5-FDD-Band7-B210', - filter: 'test_results*.html', - selector: lastCompleted()) - if (fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) { - sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-FDD-Band7-B210.html" - archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-FDD-Band7-B210.html' - } - } + } + } + post { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. + // The only drop-back is that we may retrieve the HTML report of a previous build + always { + script { + if (!fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) { + copyArtifacts(projectName: 'eNB-CI-IF4p5-FDD-Band7-B210', + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-FDD-Band7-B210.html" + archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-FDD-Band7-B210.html' } } } } - stage ("Test IF4p5 - TDD - Band 40 - B210") { - steps { - script { - try { - if ("MERGE".equals(env.gitlabActionType)) { - gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") { - build job: 'eNB-CI-IF4p5-TDD-Band40-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), - string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), - booleanParam(name: 'eNB_mergeRequest', value: true) - ] - } - } else { - gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") { - build job: 'eNB-CI-IF4p5-TDD-Band40-B210', - parameters: [ - string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), - string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), - string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), - booleanParam(name: 'eNB_mergeRequest', value: false) - ] - } - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } + } + } + stage ("Test IF4p5 - TDD - Band 40 - B210") { + steps { + script { + if ("MERGE".equals(env.gitlabActionType)) { + gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") { + build job: 'eNB-CI-IF4p5-TDD-Band40-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)), + string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)), + booleanParam(name: 'eNB_mergeRequest', value: true) + ] + } + } else { + gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") { + build job: 'eNB-CI-IF4p5-TDD-Band40-B210', + parameters: [ + string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)), + string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)), + string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)), + booleanParam(name: 'eNB_mergeRequest', value: false) + ] } } - post { - // In case of any non-success, we are retrieving the HTML report of the last completed - // slave job. - // The only drop-back is that we may retrieve the HTML report of a previous build - always { - script { - if (!fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) { - copyArtifacts(projectName: 'eNB-CI-IF4p5-TDD-Band40-B210', - filter: 'test_results*.html', - selector: lastCompleted()) - if (fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) { - sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-TDD-Band40-B210.html" - archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-TDD-Band40-B210.html' - } - } + } + } + post { + // In case of any non-success, we are retrieving the HTML report of the last completed + // slave job. + // The only drop-back is that we may retrieve the HTML report of a previous build + always { + script { + if (!fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) { + copyArtifacts(projectName: 'eNB-CI-IF4p5-TDD-Band40-B210', + filter: 'test_results*.html', + selector: lastCompleted()) + if (fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) { + sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-TDD-Band40-B210.html" + archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-TDD-Band40-B210.html' } } } @@ -499,14 +534,14 @@ pipeline { always { script { dir ('archives') { - sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" } if(fileExists('archives/vm_tests_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' if ("MERGE".equals(env.gitlabActionType)) { - sh "./ci-scripts/reportTestLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" + sh "./ci-scripts/oai-ci-vm-tool report-test --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" } else { - sh "./ci-scripts/reportTestLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}" + sh "./ci-scripts/oai-ci-vm-tool report-test --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}" } if(fileExists('test_simulator_results.html')) { sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_simulator_results.html" @@ -519,7 +554,7 @@ pipeline { } stage ("Destroy all Virtual Machines") { steps { - sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -527,7 +562,7 @@ pipeline { always { script { // Stage destroy may not be run if error in previous stage - sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}" emailext attachmentsPattern: '*results*.html', body: '''Hi, Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS! diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 5fd2a09598..39347b3558 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -27,6 +27,8 @@ def pythonExecutor = params.pythonExecutor // 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 @@ -53,6 +55,7 @@ def eNB_Repository def eNB_Branch def eNB_CommitID def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch pipeline { agent { @@ -61,6 +64,7 @@ pipeline { options { disableConcurrentBuilds() ansiColor('xterm') + lock (ciSmartPhoneResource) } // the following parameter options are commented out so it shows the ones // that you SHALL have to run the job. @@ -106,8 +110,14 @@ pipeline { if (params.pythonTestXmlFile == null) { // picking default testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " } else { - echo "Test XML file : ${testXMLFile}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } } // If not present picking a default Stage Name if (params.pipelineTestStageName == null) { @@ -149,6 +159,14 @@ pipeline { echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } } if (params.EPC_IPAddress == null) { @@ -184,20 +202,24 @@ pipeline { steps { script { dir ('ci-scripts') { - lock (ciSmartPhoneResource) { - try { - echo "\u2705 \u001B[32m${testStageName}\u001B[0m" - withCredentials([ - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] - ]) { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${testXMLFile}" + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + try { + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } } - } catch (Exception e) { - currentBuild.result = 'FAILURE' + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" } - } } } } @@ -328,7 +350,7 @@ pipeline { } if(fileExists("ci-scripts/test_results.html")) { sh "mv ci-scripts/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}#' 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}#' test_results-${JOB_NAME}.html" archiveArtifacts "test_results-${JOB_NAME}.html" } } diff --git a/ci-scripts/active_net_interfaces.awk b/ci-scripts/active_net_interfaces.awk new file mode 100644 index 0000000000..6d1174c1cc --- /dev/null +++ b/ci-scripts/active_net_interfaces.awk @@ -0,0 +1,21 @@ +#/* +# * 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 +# */ +/inet.*brd/{print "interfaceToUse="$NF"done"} diff --git a/ci-scripts/buildOnRH.sh b/ci-scripts/buildOnRH.sh index ce5b24dc49..bb57cde165 100755 --- a/ci-scripts/buildOnRH.sh +++ b/ci-scripts/buildOnRH.sh @@ -198,12 +198,18 @@ do fi done -if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi +if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ] +then + echo "Expecting $NB_PATTERN_FILES log files and found $NB_FOUND_FILES" + STATUS=-1 +fi if [ $STATUS -eq 0 ] then + echo "BUILD_OK" > $ARCHIVES_LOC/build_final_status.log echo "STATUS seems OK" else + echo "BUILD_KO" > $ARCHIVES_LOC/build_final_status.log echo "STATUS failed?" fi exit $STATUS diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index 2a358c9bac..f9fb3b776f 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -20,8 +20,8 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI VM Build Check script" +function build_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" echo " Requirements:" echo " -- uvtool uvtool-libvirt apt-cacher" @@ -31,9 +31,9 @@ function usage { echo "" echo "Usage:" echo "------" - echo " buildOnVM.sh [OPTIONS]" + echo " oai-ci-vm-tool build [OPTIONS]" echo "" - echo "Options:" + echo "Mandatory Options:" echo "--------" echo " --job-name #### OR -jn ####" echo " Specify the name of the Jenkins job." @@ -44,356 +44,168 @@ function usage { echo " --workspace #### OR -ws ####" echo " Specify the workspace." echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" + echo "Options:" + echo "--------" + variant_usage echo " Specify the variant to build." echo "" echo " --keep-vm-alive OR -k" echo " Keep the VM alive after the build." echo "" + echo " --daemon OR -D" + echo " Run as daemon" + echo "" echo " --help OR -h" echo " Print this help message." echo "" } -function variant_usage { - echo "OAI VM Build Check script" - echo " Original Author: Raphael Defosseux" - echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" - echo "" -} - -if [ $# -lt 1 ] || [ $# -gt 9 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi - -VM_TEMPLATE=ci- -JOB_NAME=XX -BUILD_ID=XX -VM_NAME=ci-enb-usrp -VM_MEMORY=2048 -VM_CPU=4 -ARCHIVES_LOC=enb_usrp -LOG_PATTERN=.Rel14.txt -NB_PATTERN_FILES=4 -BUILD_OPTIONS="--eNB -w USRP" -KEEP_VM_ALIVE=0 - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - -ws|--workspace) - JENKINS_WKSP="$2" - shift - shift - ;; - -k|--keep-vm-alive) - KEEP_VM_ALIVE=1 - shift - ;; - -v1) - VM_NAME=ci-enb-usrp - ARCHIVES_LOC=enb_usrp - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=4 - BUILD_OPTIONS="--eNB -w USRP --mu" - shift - ;; - -v2) - VM_NAME=ci-basic-sim - ARCHIVES_LOC=basic_sim - LOG_PATTERN=basic_simulator - NB_PATTERN_FILES=2 - BUILD_OPTIONS="--basic-simulator" - VM_MEMORY=8192 - VM_CPU=4 - shift - ;; - -v3) - VM_NAME=ci-phy-sim - ARCHIVES_LOC=phy_sim - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=3 - BUILD_OPTIONS="--phy_simulators" - shift - ;; - -v4) - VM_NAME=ci-cppcheck - VM_MEMORY=4096 - ARCHIVES_LOC=cppcheck - LOG_PATTERN=cppcheck.xml - NB_PATTERN_FILES=1 - BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" - shift - ;; - -v7) - VM_NAME=ci-enb-ethernet - ARCHIVES_LOC=enb_eth - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=6 - BUILD_OPTIONS="--eNB -t ETHERNET --noS1" - shift - ;; - -v8) - VM_NAME=ci-ue-ethernet - ARCHIVES_LOC=ue_eth - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=6 - BUILD_OPTIONS="--UE -t ETHERNET --noS1" - shift - ;; - --variant) - variant="$2" - case $variant in - enb-usrp) - VM_NAME=ci-enb-usrp - ARCHIVES_LOC=enb_usrp - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=4 - BUILD_OPTIONS="--eNB -w USRP --mu" - ;; - basic-sim) - VM_NAME=ci-basic-sim - ARCHIVES_LOC=basic_sim - LOG_PATTERN=basic_simulator - NB_PATTERN_FILES=2 - BUILD_OPTIONS="--basic-simulator" - VM_MEMORY=8192 - VM_CPU=4 - ;; - phy-sim) - VM_NAME=ci-phy-sim - ARCHIVES_LOC=phy_sim - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=3 - BUILD_OPTIONS="--phy_simulators" - ;; - cppcheck) - VM_NAME=ci-cppcheck - VM_MEMORY=4096 - ARCHIVES_LOC=cppcheck - LOG_PATTERN=cppcheck.xml - NB_PATTERN_FILES=1 - BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" - ;; - enb-ethernet) - VM_NAME=ci-enb-ethernet - ARCHIVES_LOC=enb_eth - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=6 - BUILD_OPTIONS="--eNB -t ETHERNET --noS1" - ;; - ue-ethernet) - VM_NAME=ci-ue-ethernet - ARCHIVES_LOC=ue_eth - LOG_PATTERN=.Rel14.txt - NB_PATTERN_FILES=6 - BUILD_OPTIONS="--UE -t ETHERNET --noS1" - ;; - *) - echo "" - echo "Syntax Error: Invalid Variant option -> $variant" - echo "" - variant_usage - exit 1 - esac - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ ! -f $JENKINS_WKSP/localZip.zip ] -then - echo "Missing localZip.zip file!" - exit 1 -fi -if [ ! -f /etc/apt/apt.conf.d/01proxy ] -then - echo "Missing /etc/apt/apt.conf.d/01proxy file!" - echo "Is apt-cacher installed and configured?" - exit 1 -fi - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] -then - VM_TEMPLATE=ci- -else - VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- -fi - -VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` -VM_CMDS=${VM_NAME}_cmds.txt -ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} - -echo "VM_NAME = $VM_NAME" -echo "VM_CMD_FILE = $VM_CMDS" -echo "JENKINS_WKSP = $JENKINS_WKSP" -echo "ARCHIVES_LOC = $ARCHIVES_LOC" -echo "BUILD_OPTIONS = $BUILD_OPTIONS" - -IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME` - -if [ $IS_VM_ALIVE -eq 0 ] -then - echo "############################################################" - echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" - echo "############################################################" - uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml -fi - -echo "Waiting for VM to be started" -uvt-kvm wait $VM_NAME --insecure - -VM_IP_ADDR=`uvt-kvm ip $VM_NAME` -echo "$VM_NAME has for IP addr = $VM_IP_ADDR" - -echo "############################################################" -echo "Copying GIT repo into VM ($VM_NAME)" -echo "############################################################" -scp -o StrictHostKeyChecking=no localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu -scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu - -echo "############################################################" -echo "Running install and build script on VM ($VM_NAME)" -echo "############################################################" -echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS -echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS -if [[ "$VM_NAME" == *"-cppcheck"* ]] -then - echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS - echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS - echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS -else - echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS - echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS - echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS -fi -echo "mkdir tmp" >> $VM_CMDS -echo "cd tmp" >> $VM_CMDS -echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS -echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS -if [[ "$VM_NAME" == *"-cppcheck"* ]] -then - echo "mkdir cmake_targets/log" >> $VM_CMDS - echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS - echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $VM_CMDS - echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS -else - echo "echo \"source oaienv\"" >> $VM_CMDS - echo "source oaienv" >> $VM_CMDS - echo "cd cmake_targets/" >> $VM_CMDS - echo "mkdir log" >> $VM_CMDS - echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS - echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS - echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS -fi -ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS - -echo "############################################################" -echo "Creating a tmp folder to store results and artifacts" -echo "############################################################" -if [ ! -d $JENKINS_WKSP/archives ] -then - mkdir $JENKINS_WKSP/archives -fi - -if [ ! -d $ARCHIVES_LOC ] -then - mkdir $ARCHIVES_LOC -fi - -scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC -if [[ "$VM_NAME" == *"-cppcheck"* ]] -then - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC -fi - -if [ $KEEP_VM_ALIVE -eq 0 ] -then - echo "############################################################" - echo "Destroying VM" - echo "############################################################" - uvt-kvm destroy $VM_NAME - ssh-keygen -R $VM_IP_ADDR -fi -rm -f $VM_CMDS - -echo "############################################################" -echo "Checking build status" -echo "############################################################" - -LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml` -STATUS=0 -NB_FOUND_FILES=0 - -for FULLFILE in $LOG_FILES -do - if [[ $FULLFILE == *"$LOG_PATTERN"* ]] +function build_on_vm { + if [ ! -f $JENKINS_WKSP/localZip.zip ] then - filename=$(basename -- "$FULLFILE") - if [ "$LOG_PATTERN" == ".Rel14.txt" ] - then - PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"` - fi - if [ "$LOG_PATTERN" == "basic_simulator" ] - then - PASS_PATTERN="lte-" - fi - if [ "$LOG_PATTERN" == "cppcheck.xml" ] - then - PASS_PATTERN="results version" - LOCAL_STAT=`egrep -c "$PASS_PATTERN" $FULLFILE` - else - LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE` - fi - if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi - NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) + echo "Missing localZip.zip file!" + STATUS=1 + return + fi + if [ ! -f /etc/apt/apt.conf.d/01proxy ] + then + echo "Missing /etc/apt/apt.conf.d/01proxy file!" + echo "Is apt-cacher installed and configured?" + STATUS=1 + return fi -done -if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" -if [ $STATUS -eq 0 ] -then - echo "STATUS seems OK" -else - echo "STATUS failed?" -fi -exit $STATUS + echo "VM_NAME = $VM_NAME" + echo "VM_CMD_FILE = $VM_CMDS" + echo "JENKINS_WKSP = $JENKINS_WKSP" + echo "ARCHIVES_LOC = $ARCHIVES_LOC" + echo "BUILD_OPTIONS = $BUILD_OPTIONS" + + IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME` + + if [ $IS_VM_ALIVE -eq 0 ] + then + echo "VM_MEMORY = $VM_MEMORY MBytes" + echo "VM_CPU = $VM_CPU" + echo "############################################################" + echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" + echo "############################################################" + uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml + fi + + echo "Waiting for VM to be started" + uvt-kvm wait $VM_NAME --insecure + + VM_IP_ADDR=`uvt-kvm ip $VM_NAME` + echo "$VM_NAME has for IP addr = $VM_IP_ADDR" + + echo "############################################################" + echo "Copying GIT repo into VM ($VM_NAME)" + echo "############################################################" + if [[ "$VM_NAME" == *"-flexran-rtc"* ]] + then + scp -o StrictHostKeyChecking=no $JENKINS_WKSP/flexran/flexran.zip ubuntu@$VM_IP_ADDR:/home/ubuntu/localZip.zip + else + scp -o StrictHostKeyChecking=no $JENKINS_WKSP/localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu + fi + scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu + + echo "############################################################" + echo "Running install and build script on VM ($VM_NAME)" + echo "############################################################" + echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS + echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS + if [[ "$VM_NAME" == *"-cppcheck"* ]] + then + if [ $DAEMON -eq 0 ] + then + echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS + else + echo "echo \"sudo apt-get --yes --quiet install zip daemon cppcheck \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip daemon cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS + fi + fi + if [[ "$VM_NAME" == *"-flexran-rtc"* ]] + then + if [ $DAEMON -eq 0 ] + then + echo "echo \"sudo apt-get --yes --quiet install zip curl jq \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip curl jq >> zip-install.txt 2>&1" >> $VM_CMDS + else + echo "echo \"sudo apt-get --yes --quiet install zip daemon curl jq \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip daemon curl jq >> zip-install.txt 2>&1" >> $VM_CMDS + fi + fi + if [[ "$VM_NAME" != *"-cppcheck"* ]] && [[ "$VM_NAME" != *"-flexran-rtc"* ]] + then + if [ $DAEMON -eq 0 ] + then + echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS + else + echo "echo \"sudo apt-get --yes --quiet install zip daemon subversion libboost-dev \"" >> $VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install zip daemon subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS + fi + fi + echo "mkdir tmp" >> $VM_CMDS + echo "cd tmp" >> $VM_CMDS + echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS + echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS + if [[ "$VM_NAME" == *"-cppcheck"* ]] + then + echo "mkdir cmake_targets/log" >> $VM_CMDS + echo "chmod 777 cmake_targets/log" >> $VM_CMDS + echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS + echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $VM_CMDS + if [ $DAEMON -eq 0 ] + then + echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS + else + echo "echo \"cppcheck $BUILD_OPTIONS .\" > ./my-vm-build.sh" >> $VM_CMDS + echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS + echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp -O /home/ubuntu/tmp/cmake_targets/log/cppcheck_build.txt -E /home/ubuntu/tmp/cmake_targets/log/cppcheck.xml ./my-vm-build.sh" >> $VM_CMDS + fi + fi + if [[ "$VM_NAME" == *"-flexran-rtc"* ]] + then + echo "mkdir -p cmake_targets/log" >> $VM_CMDS + echo "chmod 777 cmake_targets/log" >> $VM_CMDS + echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS + echo "echo \"./tools/install_dependencies \"" >> $VM_CMDS + echo "./tools/install_dependencies > cmake_targets/log/install-build.txt 2>&1" >> $VM_CMDS + echo "echo \"$BUILD_OPTIONS \"" >> $VM_CMDS + echo "$BUILD_OPTIONS > cmake_targets/log/rt_controller.Rel14.txt 2>&1" >> $VM_CMDS + fi + if [[ "$VM_NAME" != *"-cppcheck"* ]] && [[ "$VM_NAME" != *"-flexran-rtc"* ]] + then + echo "echo \"source oaienv\"" >> $VM_CMDS + echo "source oaienv" >> $VM_CMDS + echo "cd cmake_targets/" >> $VM_CMDS + echo "mkdir log" >> $VM_CMDS + echo "chmod 777 log" >> $VM_CMDS + echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS + if [ $DAEMON -eq 0 ] + then + echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS + echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS + else + echo "echo \"./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS + echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS + echo "echo \"sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh\"" >> $VM_CMDS + echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh" >> $VM_CMDS + fi + fi + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + rm -f $VM_CMDS +} diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf index ec968e8cef..b6028a8152 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -134,7 +134,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -144,13 +144,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf index c2f69cb1b9..10cbd04e9a 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -134,7 +134,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -144,13 +144,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf index 6bdbd4e39b..c79dbf1ac0 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -134,7 +134,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -144,13 +144,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf index 1a566e9579..2c2ca635a6 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf @@ -171,7 +171,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -181,12 +181,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -198,8 +197,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -228,7 +227,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf index fd49fe9d83..4dd8c1ee22 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf @@ -171,7 +171,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -181,12 +181,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -198,8 +197,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -219,7 +218,7 @@ RUs = ( att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 115; + max_rxgain = 125; eNB_instances = [0]; } @@ -228,7 +227,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 1613dd4c32..cae47b152c 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -171,7 +171,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -181,12 +181,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -198,8 +197,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -219,7 +218,7 @@ RUs = ( att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 115; + max_rxgain = 120; eNB_instances = [0]; } @@ -228,7 +227,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf new file mode 100644 index 0000000000..4e5510b0d4 --- /dev/null +++ b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf @@ -0,0 +1,265 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 2; + nb_antennas_tx = 2; + nb_antennas_rx = 2; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -25; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* + srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =; + */ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 2; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* + rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 200; + puCch10xSnr = 200; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 115; + eNB_instances = [0]; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + +log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/lte-fdd-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-basic-sim.conf index 0211e126a1..594e3299db 100644 --- a/ci-scripts/conf_files/lte-fdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-basic-sim.conf @@ -186,7 +186,6 @@ eNBs = ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; @@ -238,8 +237,8 @@ THREAD_STRUCT = ( NETWORK_CONTROLLER : { FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_INTERFACE_NAME = "ens3"; + FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; FLEXRAN_PORT = 2210; FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; diff --git a/ci-scripts/conf_files/lte-tdd-basic-sim.conf b/ci-scripts/conf_files/lte-tdd-basic-sim.conf index a7bc31eed8..da330d2379 100644 --- a/ci-scripts/conf_files/lte-tdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-tdd-basic-sim.conf @@ -145,11 +145,9 @@ eNBs = { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; @@ -219,8 +217,8 @@ THREAD_STRUCT = ( NETWORK_CONTROLLER : { FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_INTERFACE_NAME = "ens3"; + FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; FLEXRAN_PORT = 2210; FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf index 217991f69f..285b7eaf9f 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -137,7 +137,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -147,13 +147,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf index 21f4f34ba9..62e7fb48a4 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -137,7 +137,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -147,13 +147,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf index 2fdfa3c4e7..f99b701b8e 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -137,7 +137,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.0.2"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -147,13 +147,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24"; - + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf index 28ffc43b23..6c80a4f7cf 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf @@ -174,7 +174,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -184,12 +184,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -201,8 +200,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -235,7 +234,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf index 4d064ecc0e..f4be50810c 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf @@ -174,7 +174,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -184,12 +184,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -201,8 +200,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -235,7 +234,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf index efb1e823ad..48c8370b4b 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf @@ -174,7 +174,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -184,12 +184,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } @@ -201,8 +200,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; phy_test_mode = 0; - puSch10xSnr = 200; - puCch10xSnr = 200; + puSch10xSnr = 160; + puCch10xSnr = 160; } ); @@ -235,7 +234,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf new file mode 100644 index 0000000000..c2a86f079e --- /dev/null +++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf @@ -0,0 +1,236 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "ens3"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_INTERFACE_NAME_FOR_S1U = "ens3"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; + local_s_address = "127.0.0.2"; + local_s_portc = 50001; + remote_s_portc = 50000; + local_s_portd = 50011; + remote_s_portd = 50010; + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +log_config = + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/ci-scripts/conf_files/rru.fdd.band7.conf b/ci-scripts/conf_files/rru.fdd.band7.conf index ff5e13908e..dab69e1f1e 100644 --- a/ci-scripts/conf_files/rru.fdd.band7.conf +++ b/ci-scripts/conf_files/rru.fdd.band7.conf @@ -20,7 +20,7 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf new file mode 100644 index 0000000000..ea0236cab4 --- /dev/null +++ b/ci-scripts/conf_files/ue.nfapi.conf @@ -0,0 +1,44 @@ +log_config = { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="medium"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="full"; +}; + + +L1s = ( + { + num_cc = 1; + tr_n_preference = "nfapi"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.2"; + local_n_address = "127.0.0.1"; + local_n_portc = 50000; + remote_n_portc = 50001; + local_n_portd = 50010; + remote_n_portd = 50011; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 90 + att_rx = 0; + bands = [7,38,42,43]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + } +); diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh index f972a921ac..192008d867 100755 --- a/ci-scripts/createVM.sh +++ b/ci-scripts/createVM.sh @@ -20,8 +20,8 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI VM Creation script" +function create_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" echo " Requirements:" echo " -- uvtool uvtool-libvirt apt-cacher" @@ -31,9 +31,9 @@ function usage { echo "" echo "Usage:" echo "------" - echo " createVM.sh [OPTIONS]" + echo " oai-ci-vm-tool create [OPTIONS]" echo "" - echo "Options:" + echo "Mandatory Options:" echo "--------" echo " --job-name #### OR -jn ####" echo " Specify the name of the Jenkins job." @@ -41,12 +41,7 @@ function usage { echo " --build-id #### OR -id ####" echo " Specify the build ID of the Jenkins job." echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" + variant_usage echo " Specify the variant to build." echo "" echo " --help OR -h" @@ -54,144 +49,21 @@ function usage { echo "" } -function variant_usage { - echo "OAI VM Build Check script" - echo " Original Author: Raphael Defosseux" - echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" - echo "" +function create_vm { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" + echo "VM_NAME = $VM_NAME" + echo "VM_MEMORY = $VM_MEMORY MBytes" + echo "VM_CPU = $VM_CPU" + + echo "############################################################" + echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" + echo "############################################################" + uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml + echo "Waiting for VM to be started" + uvt-kvm wait $VM_NAME --insecure + + VM_IP_ADDR=`uvt-kvm ip $VM_NAME` + echo "$VM_NAME has for IP addr = $VM_IP_ADDR" } - -if [ $# -lt 1 ] || [ $# -gt 6 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi - -VM_TEMPLATE=ci- -JOB_NAME=XX -BUILD_ID=XX -VM_NAME=ci-enb-usrp -VM_MEMORY=2048 -VM_CPU=4 - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - -v1) - VM_NAME=ci-enb-usrp - shift - ;; - -v2) - VM_NAME=ci-basic-sim - VM_MEMORY=8192 - shift - ;; - -v3) - VM_NAME=ci-phy-sim - shift - ;; - -v4) - VM_NAME=ci-cppcheck - VM_MEMORY=4096 - VM_CPU=4 - shift - ;; - -v7) - VM_NAME=ci-enb-ethernet - shift - ;; - -v8) - VM_NAME=ci-ue-ethernet - shift - ;; - --variant) - variant="$2" - case $variant in - enb-usrp) - VM_NAME=ci-enb-usrp - ;; - basic-sim) - VM_NAME=ci-basic-sim - VM_MEMORY=8192 - ;; - phy-sim) - VM_NAME=ci-phy-sim - ;; - cppcheck) - VM_NAME=ci-cppcheck - VM_MEMORY=4096 - VM_CPU=4 - ;; - enb-ethernet) - VM_NAME=ci-enb-ethernet - ;; - ue-ethernet) - VM_NAME=ci-ue-ethernet - ;; - *) - echo "" - echo "Syntax Error: Invalid Variant option -> $variant" - echo "" - variant_usage - exit 1 - esac - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] -then - VM_TEMPLATE=ci- -else - VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- -fi - -VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` -VM_CMDS=${VM_NAME}_cmds.txt - -echo "VM_NAME = $VM_NAME" -echo "VM_MEMORY = $VM_MEMORY MBytes" -echo "VM_CPU = $VM_CPU" - -echo "############################################################" -echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" -echo "############################################################" -uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml -echo "Waiting for VM to be started" -uvt-kvm wait $VM_NAME --insecure - -VM_IP_ADDR=`uvt-kvm ip $VM_NAME` -echo "$VM_NAME has for IP addr = $VM_IP_ADDR" -exit 0 diff --git a/ci-scripts/destroyAllRunningVM.sh b/ci-scripts/destroyAllRunningVM.sh index 5e152bc590..76a7fd0b50 100755 --- a/ci-scripts/destroyAllRunningVM.sh +++ b/ci-scripts/destroyAllRunningVM.sh @@ -20,15 +20,17 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI VM Destroy script" +function destroy_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" echo "" echo "Usage:" echo "------" - echo " destroyAllRunningVM.sh [OPTIONS]" + echo " oai-ci-vm-tool destroy [OPTIONS]" echo "" - echo "Options:" + echo "Mandatory Options:" echo "--------" echo " --job-name #### OR -jn ####" echo " Specify the name of the Jenkins job." @@ -36,66 +38,26 @@ function usage { echo " --build-id #### OR -id ####" echo " Specify the build ID of the Jenkins job." echo "" + echo "Options:" + echo "--------" echo " --help OR -h" echo " Print this help message." echo "" } -if [ $# -gt 4 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi +function destroy_vm { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" + echo "VM_TEMPLATE = $VM_TEMPLATE" -VM_TEMPLATE=ci- -JOB_NAME=XX -BUILD_ID=XX - -while [[ $# -gt 0 ]] -do -key="$1" -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] -then - VM_TEMPLATE=ci- -else - VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- -fi - -LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE` - -for CI_VM in $LIST_CI_VM -do - VM_IP_ADDR=`uvt-kvm ip $CI_VM` - echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR" - uvt-kvm destroy $CI_VM - ssh-keygen -R $VM_IP_ADDR -done - -exit 0 + LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE` + for CI_VM in $LIST_CI_VM + do + VM_IP_ADDR=`uvt-kvm ip $CI_VM` + echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR" + uvt-kvm destroy $CI_VM + ssh-keygen -R $VM_IP_ADDR + done +} diff --git a/ci-scripts/doGitLabMerge.sh b/ci-scripts/doGitLabMerge.sh index dfe2f02b55..852b6407ea 100755 --- a/ci-scripts/doGitLabMerge.sh +++ b/ci-scripts/doGitLabMerge.sh @@ -1,4 +1,24 @@ #!/bin/bash +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ function usage { echo "OAI GitLab merge request applying script" diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 52c742fbcb..62add8429b 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -42,6 +42,7 @@ ENB_PROCESS_OK = +1 ENB_PROCESS_SEG_FAULT = -11 ENB_PROCESS_ASSERTION = -12 ENB_PROCESS_REALTIME_ISSUE = -13 +ENB_PROCESS_NOLOGFILE_TO_ANALYZE = -14 HSS_PROCESS_FAILED = -2 HSS_PROCESS_OK = +2 MME_PROCESS_FAILED = -3 @@ -78,6 +79,7 @@ class SSHConnection(): self.eNBBranch = '' self.eNB_AllowMerge = False self.eNBCommitID = '' + self.eNBTargetBranch = '' self.eNBUserName = '' self.eNBPassword = '' self.eNBSourceCodePath = '' @@ -90,7 +92,8 @@ class SSHConnection(): self.ADBUserName = '' self.ADBPassword = '' self.testCase_id = '' - self.testXMLfile = '' + self.testXMLfiles = [] + self.nbTestXMLfiles = 0 self.desc = '' self.Build_eNB_args = '' self.Initialize_eNB_args = '' @@ -101,13 +104,27 @@ class SSHConnection(): self.iperf_args = '' self.iperf_packetloss_threshold = '' self.iperf_profile = '' + self.nbMaxUEtoAttach = -1 self.UEDevices = [] + self.CatMDevices = [] self.UEIPAddresses = [] self.htmlFile = '' self.htmlHeaderCreated = False self.htmlFooterCreated = False - self.htmlUEConnected = 0 + self.htmlUEConnected = -1 self.htmleNBFailureMsg = '' + self.picocom_closure = False + self.idle_sleep_time = 0 + self.htmlTabRefs = [] + self.htmlTabNames = [] + self.htmlTabIcons = [] + self.finalStatus = False + self.eNBOsVersion = '' + self.eNBKernelVersion = '' + self.eNBUhdVersion = '' + self.eNBCpuNb = '' + self.eNBCpuModel = '' + self.eNBCpuMHz = '' def open(self, ipaddress, username, password): count = 0 @@ -169,8 +186,9 @@ class SSHConnection(): elif self.sshresponse == 2: logging.debug('\u001B[1;37;41m Unexpected TIMEOUT \u001B[0m') logging.debug('Expected Line : ' + expectedline) - result = re.search('ping |iperf ', str(commandline)) + result = re.search('ping |iperf |picocom', str(commandline)) if result is None: + logging.debug(str(self.ssh.before)) sys.exit(self.sshresponse) else: return -1 @@ -186,64 +204,87 @@ class SSHConnection(): if self.sshresponse == 0: pass elif self.sshresponse == 1: - logging.debug('\u001B[1;37;41m Unexpected TIMEOUT \u001B[0m') + if not self.picocom_closure: + logging.debug('\u001B[1;37;41m Unexpected TIMEOUT during closing\u001B[0m') else: - logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m') + logging.debug('\u001B[1;37;41m Unexpected Others during closing\u001B[0m') def copyin(self, ipaddress, username, password, source, destination): + count = 0 + copy_status = False logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination) - scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5) - scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0: - scp_spawn.sendline('yes') - scp_spawn.expect('password:') - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + while count < 10: + scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 100) + scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) if scp_response == 0: - pass + scp_spawn.sendline('yes') + scp_spawn.expect('password:') + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + count = 10 + copy_status = True + else: + logging.debug('1 - scp_response = ' + str(scp_response)) + elif scp_response == 1: + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0 or scp_response == 3: + count = 10 + copy_status = True + else: + logging.debug('2 - scp_response = ' + str(scp_response)) + elif scp_response == 2: + count = 10 + copy_status = True else: - logging.debug('1 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 1: - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0 or scp_response == 3: - pass - else: - logging.debug('2 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 2: - pass + logging.debug('3 - scp_response = ' + str(scp_response)) + # adding a tempo when failure + if not copy_status: + time.sleep(1) + count += 1 + if copy_status: + return 0 else: - logging.debug('3 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') + return -1 def copyout(self, ipaddress, username, password, source, destination): + count = 0 + copy_status = False logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination) - scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 5) - scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0: - scp_spawn.sendline('yes') - scp_spawn.expect('password:') - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + while count < 4: + scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 100) + scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) if scp_response == 0: - pass + scp_spawn.sendline('yes') + scp_spawn.expect('password:') + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0: + count = 10 + copy_status = True + else: + logging.debug('1 - scp_response = ' + str(scp_response)) + elif scp_response == 1: + scp_spawn.sendline(password) + scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) + if scp_response == 0 or scp_response == 3: + count = 10 + copy_status = True + else: + logging.debug('2 - scp_response = ' + str(scp_response)) + elif scp_response == 2: + count = 10 + copy_status = True else: - logging.debug('1 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 1: - scp_spawn.sendline(password) - scp_response = scp_spawn.expect(['\$', 'Permission denied', 'password:', pexpect.EOF, pexpect.TIMEOUT]) - if scp_response == 0 or scp_response == 3: - pass - else: - logging.debug('2 - scp_response = ' + str(scp_response)) - sys.exit('SCP failed') - elif scp_response == 2: + logging.debug('3 - scp_response = ' + str(scp_response)) + # adding a tempo when failure + if not copy_status: + time.sleep(1) + count += 1 + if copy_status: pass else: - logging.debug('3 - scp_response = ' + str(scp_response)) sys.exit('SCP failed') def BuildeNB(self): @@ -264,16 +305,23 @@ class SSHConnection(): # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier if (self.eNB_AllowMerge): - if (self.eNBBranch != 'develop') and (self.eNBBranch != 'origin/develop'): - self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + if self.eNBTargetBranch == '': + if (self.eNBBranch != 'develop') and (self.eNBBranch != 'origin/develop'): + self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.eNBTargetBranch) + self.command('git merge --ff origin/' + self.eNBTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) - self.command('mkdir -p log', '\$', 5) + self.command('mkdir -p log', '\$', 5) + self.command('chmod 777 log', '\$', 5) # no need to remove in log (git clean did the trick) - self.command('echo ' + self.eNBPassword + ' | sudo -S stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_enb.log', 'Bypassing the Tests', 600) - self.command('mkdir -p build_log_' + SSH.testCase_id, '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S mv log/* ' + 'build_log_' + SSH.testCase_id, '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S mv compile_oai_enb.log ' + 'build_log_' + SSH.testCase_id, '\$', 5) + self.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_enb.log', 'Bypassing the Tests', 600) + self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) + self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) + self.command('mv compile_oai_enb.log ' + 'build_log_' + self.testCase_id, '\$', 5) + # Workaround to run with develop-nr + self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30) self.close() self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK) @@ -287,7 +335,7 @@ class SSHConnection(): 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_' + SSH.testCase_id + '.log &', 'Core state: 2 -> 3', 35) + 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: 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) @@ -313,7 +361,7 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m Hostname Not Found! \u001B[0m') 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_' + SSH.testCase_id + '.log &', 'MME app initialization complete', 100) + 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: self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_mme', '\$', 5) @@ -329,7 +377,7 @@ class SSHConnection(): 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_' + SSH.testCase_id + '.log &', 'Initializing SPGW-APP task interface: DONE', 30) + 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: self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_xGw', '\$', 5) @@ -344,8 +392,20 @@ class SSHConnection(): pStatus = self.CheckProcessExist(initialize_eNB_flag) if (pStatus < 0): self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus) - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) + # If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) + result = re.search('interfaceToUse=(?P[a-zA-Z0-9\-\_]+)done', str(self.ssh.before)) + if result is not None: + eth_interface = result.group('eth_interface') + logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m') + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + self.testCase_id + '_s1log.pcap', '\$', 5) + self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + self.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5) + self.close() self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.command('cd ' + self.eNBSourceCodePath, '\$', 5) # Initialize_eNB_args usually start with -O and followed by the location in repository @@ -353,6 +413,14 @@ class SSHConnection(): extIdx = full_config_file.find('.conf') if (extIdx > 0): extra_options = full_config_file[extIdx + 5:] + # if tracer options is on, compiling and running T Tracer + result = re.search('T_stdout', str(extra_options)) + if result is not None: + logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') + self.command('cd common/utils/T/tracer', '\$', 5) + self.command('make', '\$', 10) + self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5) + self.command('cd ' + self.eNBSourceCodePath, '\$', 5) full_config_file = full_config_file[:extIdx + 5] config_path, config_file = os.path.split(full_config_file) else: @@ -364,33 +432,47 @@ class SSHConnection(): rruCheck = True # Make a copy and adapt to EPC / eNB IP addresses self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) - self.command('sed -i -e \'s/mme_ip_address.*$/mme_ip_address = ( { ipv4 = "' + self.EPCIPAddress + '";/\' ' + ci_full_config_file, '\$', 2); - self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_S1_MME.*$/ENB_IPV4_ADDRESS_FOR_S1_MME = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2); - self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_S1U.*$/ENB_IPV4_ADDRESS_FOR_S1U = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2); - self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_X2C.*$/ENB_IPV4_ADDRESS_FOR_X2C = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2); + self.command('sed -i -e \'s/CI_MME_IP_ADDR/' + self.EPCIPAddress + '/\' ' + ci_full_config_file, '\$', 2); + self.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2); # Launch eNB with the modified config file self.command('source oaienv', '\$', 5) self.command('cd cmake_targets', '\$', 5) - self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh ', '\$', 5) - self.command('chmod 775 ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh ', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + SSH.testCase_id + '.log', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(SSH.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '.log ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh', '\$', 5) + self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) + self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) if not rruCheck: - self.eNBLogFile = 'enb_' + SSH.testCase_id + '.log' + self.eNBLogFile = 'enb_' + self.testCase_id + '.log' time.sleep(6) doLoop = True loopCounter = 10 while (doLoop): loopCounter = loopCounter - 1 if (loopCounter == 0): + # In case of T tracer recording, we may need to kill it + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.command('killall --signal SIGKILL record', '\$', 5) + self.close() doLoop = False logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m') self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK) - self.CreateHtmlFooter(False) - self.close() + self.CreateHtmlTabFooter(False) + # In case of T tracer recording, we need to kill tshark on EPC side + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + logging.debug('\u001B[1m Stopping tshark \u001B[0m') + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + self.close() + time.sleep(1) + pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap' + copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') + if (copyin_res == 0): + self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.') sys.exit(1) else: - self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --color=never -i "wait|sync"', '\$', 4) + self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4) if rruCheck: result = re.search('wait RUs', str(self.ssh.before)) else: @@ -426,7 +508,7 @@ class SSHConnection(): sys.exit('Insufficient Parameter') multi_jobs = [] for device_id in self.UEDevices: - p = Process(target = SSH.InitializeUE_common, args = (device_id,)) + p = Process(target = self.InitializeUE_common, args = (device_id,)) p.daemon = True p.start() multi_jobs.append(p) @@ -434,6 +516,109 @@ class SSHConnection(): job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + def checkDevTTYisUnlocked(self): + self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) + count = 0 + while count < 5: + self.command('echo ' + self.ADBPassword + ' | sudo -S lsof | grep ttyUSB0', '\$', 10) + result = re.search('picocom', str(self.ssh.before)) + if result is None: + count = 10 + else: + time.sleep(5) + count = count + 1 + self.close() + + def InitializeCatM(self): + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + self.picocom_closure = True + self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) + # dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S` + self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10) + self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10) + time.sleep(1) + # Calling twice AT to clear all buffers + self.command('AT', 'OK|ERROR', 5) + self.command('AT', 'OK', 5) + # Disabling the Radio + self.command('AT+CFUN=0', 'OK', 5) + logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m') + # Checking if auto-attach is enabled + self.command('AT^AUTOATT?', 'OK', 5) + result = re.search('AUTOATT: (?P[0-9\-]+)', str(self.ssh.before)) + if result is not None: + if result.group('state') is not None: + autoAttachState = int(result.group('state')) + if autoAttachState is not None: + if autoAttachState == 0: + self.command('AT^AUTOATT=1', 'OK', 5) + logging.debug('\u001B[1m Auto-Attach enabled\u001B[0m') + else: + logging.debug('\u001B[1;37;41m Could not check Auto-Attach! \u001B[0m') + # Force closure of picocom but device might still be locked + self.close() + self.picocom_closure = False + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.checkDevTTYisUnlocked() + + def TerminateCatM(self): + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + self.picocom_closure = True + self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) + # dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S` + self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10) + self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10) + time.sleep(1) + # Calling twice AT to clear all buffers + self.command('AT', 'OK|ERROR', 5) + self.command('AT', 'OK', 5) + # Disabling the Radio + self.command('AT+CFUN=0', 'OK', 5) + logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m') + self.close() + self.picocom_closure = False + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.checkDevTTYisUnlocked() + + def AttachCatM(self): + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + self.picocom_closure = True + self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) + # dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S` + self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10) + self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10) + time.sleep(1) + # Calling twice AT to clear all buffers + self.command('AT', 'OK|ERROR', 5) + self.command('AT', 'OK', 5) + # Enabling the Radio + self.command('AT+CFUN=1', 'SIMSTORE,READY', 5) + logging.debug('\u001B[1m Cellular Functionality enabled\u001B[0m') + time.sleep(4) + # We should check if we register + count = 0 + while count < 3: + self.command('AT+CEREG?', 'OK', 5) + result = re.search('CEREG: 2,(?P[0-9\-]+)', str(self.ssh.before)) + if result is not None: + mDataConnectionState = int(result.group('state')) + if mDataConnectionState is not None: + logging.debug('+CEREG: 2,' + str(mDataConnectionState)) + else: + logging.debug(str(self.ssh.before)) + count = count + 1 + time.sleep(1) + self.close() + self.picocom_closure = False + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.checkDevTTYisUnlocked() + def AttachUE_common(self, device_id, statusQueue, lock): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) @@ -490,22 +675,25 @@ class SSHConnection(): if (pStatus < 0): self.CreateHtmlTestRow('N/A', 'KO', pStatus) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) multi_jobs = [] status_queue = SimpleQueue() lock = Lock() + nb_ue_to_connect = 0 for device_id in self.UEDevices: - p = Process(target = SSH.AttachUE_common, args = (device_id, status_queue, lock,)) - p.daemon = True - p.start() - multi_jobs.append(p) + if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach): + p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,)) + p.daemon = True + p.start() + multi_jobs.append(p) + nb_ue_to_connect = nb_ue_to_connect + 1 for job in multi_jobs: job.join() if (status_queue.empty()): self.CreateHtmlTestRow('N/A', 'KO', ALL_PROCESSES_OK) - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) self.AutoTerminateUEandeNB() sys.exit(1) else: @@ -518,16 +706,20 @@ class SSHConnection(): device_id = status_queue.get() message = status_queue.get() if (count < 0): - html_cell = "
UE (" + device_id + ")\n" + message + "
" + html_cell = '
UE (' + device_id + ')\n' + message + '
' else: - html_cell = "
UE (" + device_id + ")\n" + message + ' in ' + str(count + 2) + ' seconds
' + html_cell = '
UE (' + device_id + ')\n' + message + ' in ' + str(count + 2) + ' seconds
' html_queue.put(html_cell) if (attach_status): self.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue) + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + logging.debug('Waiting 5 seconds to fill up record file') + time.sleep(5) else: self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) def DetachUE_common(self, device_id): @@ -548,17 +740,21 @@ class SSHConnection(): if (pStatus < 0): self.CreateHtmlTestRow('N/A', 'KO', pStatus) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) multi_jobs = [] for device_id in self.UEDevices: - p = Process(target = SSH.DetachUE_common, args = (device_id,)) + p = Process(target = self.DetachUE_common, args = (device_id,)) p.daemon = True p.start() multi_jobs.append(p) for job in multi_jobs: job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + result = re.search('T_stdout', str(self.Initialize_eNB_args)) + if result is not None: + logging.debug('Waiting 5 seconds to fill up record file') + time.sleep(5) def RebootUE_common(self, device_id): try: @@ -607,11 +803,11 @@ class SSHConnection(): pStatus = self.CheckProcessExist(initialize_eNB_flag) if (pStatus < 0): self.CreateHtmlTestRow('N/A', 'KO', pStatus) - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) multi_jobs = [] for device_id in self.UEDevices: - p = Process(target = SSH.RebootUE_common, args = (device_id,)) + p = Process(target = self.RebootUE_common, args = (device_id,)) p.daemon = True p.start() multi_jobs.append(p) @@ -632,6 +828,19 @@ class SSHConnection(): sys.exit(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 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 GetAllUEIPAddresses(self): if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': Usage() @@ -678,7 +887,7 @@ class SSHConnection(): self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('cd scripts', '\$', 5) ping_time = re.findall("-c (\d+)",str(self.ping_args)) - ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5) + ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5) # TIMEOUT CASE if ping_status < 0: message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!' @@ -746,12 +955,12 @@ class SSHConnection(): pStatus = self.CheckProcessExist(initialize_eNB_flag) if (pStatus < 0): self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) ueIpStatus = self.GetAllUEIPAddresses() if (ueIpStatus < 0): self.CreateHtmlTestRow(self.ping_args, 'KO', UE_IP_ADDRESS_ISSUE) - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) multi_jobs = [] i = 0 @@ -759,7 +968,7 @@ class SSHConnection(): status_queue = SimpleQueue() for UE_IPAddress in self.UEIPAddresses: device_id = self.UEDevices[i] - p = Process(target = SSH.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,)) + p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,)) p.daemon = True p.start() multi_jobs.append(p) @@ -770,7 +979,7 @@ class SSHConnection(): if (status_queue.empty()): self.CreateHtmlTestRow(self.ping_args, 'KO', ALL_PROCESSES_OK) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) else: ping_status = True @@ -782,14 +991,14 @@ class SSHConnection(): device_id = status_queue.get() ip_addr = status_queue.get() message = status_queue.get() - html_cell = "
UE (" + device_id + ")\nIP Address  : " + ip_addr + "\n" + message + "
" + html_cell = '
UE (' + device_id + ')\nIP Address  : ' + ip_addr + '\n' + message + '
' html_queue.put(html_cell) if (ping_status): self.CreateHtmlTestRowQueue(self.ping_args, 'OK', len(self.UEDevices), html_queue) else: self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) def Iperf_ComputeTime(self): @@ -805,11 +1014,11 @@ class SSHConnection(): logging.debug('\u001B[1;37;41m Iperf bandwidth Not Found! \u001B[0m') sys.exit(1) iperf_bandwidth = result.group('iperf_bandwidth') - if SSH.iperf_profile == 'balanced': + if self.iperf_profile == 'balanced': iperf_bandwidth_new = float(iperf_bandwidth)/ue_num - if SSH.iperf_profile == 'single-ue': + if self.iperf_profile == 'single-ue': iperf_bandwidth_new = float(iperf_bandwidth) - if SSH.iperf_profile == 'unbalanced': + if self.iperf_profile == 'unbalanced': # residual is 2% of max bw residualBW = float(iperf_bandwidth) / 50 if idx == 0: @@ -825,7 +1034,7 @@ class SSHConnection(): return result def Iperf_analyzeV2TCPOutput(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): - self.command('awk -f /tmp/tcp_iperf_stats.awk /tmp/CI-eNB/scripts/iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) + self.command('awk -f /tmp/tcp_iperf_stats.awk /tmp/CI-eNB/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) result = re.search('Avg Bitrate : (?P[0-9\.]+ Mbits\/sec) Max Bitrate : (?P[0-9\.]+ Mbits\/sec) Min Bitrate : (?P[0-9\.]+ Mbits\/sec)', str(self.ssh.before)) if result is not None: avgbitrate = result.group('average') @@ -931,7 +1140,7 @@ class SSHConnection(): return 0 def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): - if (not os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): + if (not os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log') return # Computing the requested bandwidth in float @@ -956,7 +1165,7 @@ class SSHConnection(): req_bandwidth = '%.1f Gbits/sec' % req_bw req_bw = req_bw * 1000000000 - server_file = open('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', 'r') + server_file = open('iperf_server_' + self.testCase_id + '_' + device_id + '.log', 'r') br_sum = 0.0 ji_sum = 0.0 pl_sum = 0 @@ -1081,12 +1290,12 @@ class SSHConnection(): # 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_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) + self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) port = 5001 + idx if udpIperf: - self.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + SSH.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + 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_' + SSH.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + self.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) time.sleep(0.5) self.close() @@ -1103,8 +1312,8 @@ class SSHConnection(): modified_options = modified_options.replace('-R','') time.sleep(0.5) - self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) - iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) # TIMEOUT Case if iperf_status < 0: self.close() @@ -1122,15 +1331,15 @@ class SSHConnection(): # in case of failure, retrieve server log if (clientStatus == -1): time.sleep(1) - if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): - os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log') - self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.') + 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) def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue): try: # Single-UE profile -- iperf only on one UE - if SSH.iperf_profile == 'single-ue' and idx != 0: + if self.iperf_profile == 'single-ue' and idx != 0: return useIperf3 = False udpIperf = True @@ -1161,13 +1370,13 @@ class SSHConnection(): if (useIperf3): self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5) else: - self.command('rm -f iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) + 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_' + SSH.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) + 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_' + SSH.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) + 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) time.sleep(0.5) self.close() @@ -1182,14 +1391,14 @@ class SSHConnection(): modified_options = str(self.iperf_args) time.sleep(0.5) - self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5) + self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) if (useIperf3): - self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a 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 -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) if iperf_status < 0: self.close() message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !' @@ -1208,9 +1417,9 @@ class SSHConnection(): self.close() if (clientStatus == -1): time.sleep(1) - if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): - os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log') - self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.') + 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.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) except: os.kill(os.getppid(),signal.SIGUSR1) @@ -1224,13 +1433,13 @@ class SSHConnection(): if (pStatus < 0): self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) ueIpStatus = self.GetAllUEIPAddresses() if (ueIpStatus < 0): self.CreateHtmlTestRow(self.iperf_args, 'KO', UE_IP_ADDRESS_ISSUE) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) multi_jobs = [] i = 0 @@ -1250,7 +1459,7 @@ class SSHConnection(): if (status_queue.empty()): self.CreateHtmlTestRow(self.iperf_args, 'KO', ALL_PROCESSES_OK) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) else: iperf_status = True @@ -1265,7 +1474,7 @@ class SSHConnection(): device_id = status_queue.get() ip_addr = status_queue.get() message = status_queue.get() - html_cell = "
UE (" + device_id + ")\nIP Address  : " + ip_addr + "\n" + message + "
" + html_cell = '
UE (' + device_id + ')\nIP Address  : ' + ip_addr + '\n' + message + '
' html_queue.put(html_cell) if (iperf_noperf and iperf_status): self.CreateHtmlTestRowQueue(self.iperf_args, 'PERF NOT MET', len(self.UEDevices), html_queue) @@ -1274,7 +1483,7 @@ class SSHConnection(): else: self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) self.AutoTerminateUEandeNB() - self.CreateHtmlFooter(False) + self.CreateHtmlTabFooter(False) sys.exit(1) def CheckProcessExist(self, initialize_eNB_flag): @@ -1312,7 +1521,7 @@ class SSHConnection(): fileCheck = re.search('enb_', str(self.eNBLogFile)) if fileCheck is not None: self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.') - logStatus = self.AnalyzeLogFile_eNB() + logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile) if logStatus < 0: result = logStatus return result @@ -1383,10 +1592,10 @@ class SSHConnection(): except: os.kill(os.getppid(),signal.SIGUSR1) - def AnalyzeLogFile_eNB(self): - if (not os.path.isfile('./' + SSH.eNBLogFile)): + def AnalyzeLogFile_eNB(self, eNBlogFile): + if (not os.path.isfile('./' + eNBlogFile)): return -1 - enb_log_file = open('./' + SSH.eNBLogFile, 'r') + enb_log_file = open('./' + eNBlogFile, 'r') foundAssertion = False msgAssertion = '' msgLine = 0 @@ -1400,6 +1609,8 @@ class SSHConnection(): rrcReestablishRequest = 0 rrcReestablishComplete = 0 rrcReestablishReject = 0 + rlcDiscardBuffer = 0 + rachCanceledProcedure = 0 uciStatMsgCount = 0 pdcpFailure = 0 ulschFailure = 0 @@ -1419,28 +1630,28 @@ class SSHConnection(): if foundAssertion and (msgLine < 3): msgLine += 1 msgAssertion += str(line) - result = re.search('Generating RRCConnectionSetup', str(line)) + result = re.search('Generating LTE_RRCConnectionSetup', str(line)) if result is not None: rrcSetupRequest += 1 - result = re.search('RRCConnectionSetupComplete from UE', str(line)) + result = re.search('LTE_RRCConnectionSetupComplete from UE', str(line)) if result is not None: rrcSetupComplete += 1 - result = re.search('Generate RRCConnectionRelease', str(line)) + result = re.search('Generate LTE_RRCConnectionRelease', str(line)) if result is not None: rrcReleaseRequest += 1 - result = re.search('Generate RRCConnectionReconfiguration', str(line)) + result = re.search('Generate LTE_RRCConnectionReconfiguration', str(line)) if result is not None: rrcReconfigRequest += 1 - result = re.search('RRCConnectionReconfigurationComplete from UE rnti', str(line)) + result = re.search('LTE_RRCConnectionReconfigurationComplete from UE rnti', str(line)) if result is not None: rrcReconfigComplete += 1 - result = re.search('RRCConnectionReestablishmentRequest', str(line)) + result = re.search('LTE_RRCConnectionReestablishmentRequest', str(line)) if result is not None: rrcReestablishRequest += 1 - result = re.search('RRCConnectionReestablishmentComplete', str(line)) + result = re.search('LTE_RRCConnectionReestablishmentComplete', str(line)) if result is not None: rrcReestablishComplete += 1 - result = re.search('RRCConnectionReestablishmentReject', str(line)) + result = re.search('LTE_RRCConnectionReestablishmentReject', str(line)) if result is not None: rrcReestablishReject += 1 result = re.search('uci->stat', str(line)) @@ -1452,6 +1663,12 @@ class SSHConnection(): result = re.search('ULSCH in error in round', str(line)) if result is not None: ulschFailure += 1 + result = re.search('BAD all_segments_received', str(line)) + if result is not None: + rlcDiscardBuffer += 1 + result = re.search('Canceled RA procedure for UE rnti', str(line)) + if result is not None: + rachCanceledProcedure += 1 enb_log_file.close() self.htmleNBFailureMsg = '' if uciStatMsgCount > 0: @@ -1494,6 +1711,10 @@ class SSHConnection(): rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected' logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m') self.htmleNBFailureMsg += rrcMsg + '\n' + if rachCanceledProcedure > 0: + rachMsg = 'eNB cancelled ' + str(rachCanceledProcedure) + ' RA procedure(s)' + logging.debug('\u001B[1;30;43m ' + rachMsg + ' \u001B[0m') + self.htmleNBFailureMsg += rachMsg + '\n' if foundSegFault: logging.debug('\u001B[1;37;41m eNB ended with a Segmentation Fault! \u001B[0m') return ENB_PROCESS_SEG_FAULT @@ -1503,34 +1724,77 @@ class SSHConnection(): return ENB_PROCESS_ASSERTION if foundRealTimeIssue: logging.debug('\u001B[1;37;41m eNB faced real time issues! \u001B[0m') + self.htmleNBFailureMsg += 'eNB faced real time issues!\n' + #return ENB_PROCESS_REALTIME_ISSUE + if rlcDiscardBuffer > 0: + rlcMsg = 'eNB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)' + logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') + self.htmleNBFailureMsg += rlcMsg + '\n' return ENB_PROCESS_REALTIME_ISSUE return 0 def TerminateeNB(self): self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(SSH.eNB_instance) + '_daemon --stop', '\$', 5) - self.command('rm -f my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5) + self.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGINT lte-softmodem || true', '\$', 5) time.sleep(5) self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-softmodem', '\$', 5) result = re.search('lte-softmodem', str(self.ssh.before)) if result is not None: self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGKILL lte-softmodem || true', '\$', 5) + time.sleep(5) self.close() - result = re.search('enb_', str(self.eNBLogFile)) + # If tracer options is on, stopping tshark on EPC side + result = re.search('T_stdout', str(self.Initialize_eNB_args)) if result is not None: - self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.') - logStatus = self.AnalyzeLogFile_eNB() - if (logStatus < 0): - self.CreateHtmlTestRow('N/A', 'KO', logStatus) - self.CreateHtmlFooter(False) - sys.exit(1) - else: - self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + logging.debug('\u001B[1m Stopping tshark \u001B[0m') + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) + time.sleep(1) + pcap_log_file = self.eNBLogFile.replace('.log', '_s1log.pcap') + self.command('echo ' + self.EPCPassword + ' | sudo -S chmod 666 /tmp/' + pcap_log_file, '\$', 5) + self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.') + self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.') + self.close() + logging.debug('\u001B[1m Replaying RAW record file\u001B[0m') + self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) + self.command('cd ' + self.eNBSourceCodePath + '/common/utils/T/tracer/', '\$', 5) + raw_record_file = self.eNBLogFile.replace('.log', '_record.raw') + replay_log_file = self.eNBLogFile.replace('.log', '_replay.log') + extracted_txt_file = self.eNBLogFile.replace('.log', '_extracted_messages.txt') + extracted_log_file = self.eNBLogFile.replace('.log', '_extracted_messages.log') + self.command('./extract_config -i ' + self.eNBSourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_txt_file, '\$', 5) + self.command('echo $USER; nohup ./replay -i ' + self.eNBSourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.eNBSourceCodePath + '/cmake_targets/' + replay_log_file + ' 2>&1 &', self.eNBUserName, 5) + self.command('./textlog -d ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_txt_file + ' -no-gui -ON -full > ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_log_file, '\$', 5) + self.close() + self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + extracted_log_file, '.') + logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m') + logStatus = self.AnalyzeLogFile_eNB(extracted_log_file) + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) self.eNBLogFile = '' else: - self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + result = re.search('enb_', str(self.eNBLogFile)) + if result is not None: + copyin_res = self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.') + if (copyin_res == -1): + logging.debug('\u001B[1;37;41m Could not copy eNB logfile to analyze it! \u001B[0m') + self.htmleNBFailureMsg = 'Could not copy eNB logfile to analyze it!' + self.CreateHtmlTestRow('N/A', 'KO', ENB_PROCESS_NOLOGFILE_TO_ANALYZE) + self.eNBLogFile = '' + return + logging.debug('\u001B[1m Analyzing eNB logfile \u001B[0m') + logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile) + if (logStatus < 0): + self.CreateHtmlTestRow('N/A', 'KO', logStatus) + self.CreateHtmlTabFooter(False) + sys.exit(1) + else: + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) + self.eNBLogFile = '' + else: + self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) def TerminateHSS(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) @@ -1546,11 +1810,8 @@ class SSHConnection(): self.command('cd scripts', '\$', 5) self.command('rm -f ./kill_hss.sh', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S daemon --name=simulated_hss --stop', '\$', 5) - time.sleep(2) - self.command('ps -aux | egrep --color=never "hss_sim|simulated_hss" | grep -v grep | awk \'BEGIN{n=0}{pidId[n]=$2;n=n+1}END{print "kill -9 " pidId[0] " " pidId[1]}\' > ./kill_hss.sh', '\$', 5) - self.command('chmod 755 ./kill_hss.sh', '\$', 5) - self.command('echo ' + self.EPCPassword + ' | sudo -S ./kill_hss.sh', '\$', 5) - self.command('rm ./kill_hss.sh', '\$', 5) + time.sleep(1) + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5) self.close() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) @@ -1601,7 +1862,7 @@ class SSHConnection(): def TerminateUE(self): terminate_ue_flag = True - SSH.GetAllUEDevices(terminate_ue_flag) + self.GetAllUEDevices(terminate_ue_flag) multi_jobs = [] for device_id in self.UEDevices: p = Process(target= SSH.TerminateUE_common, args = (device_id,)) @@ -1623,6 +1884,10 @@ class SSHConnection(): self.eNB_instance = '0' self.TerminateeNB() + def IdleSleep(self): + time.sleep(self.idle_sleep_time) + self.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', ALL_PROCESSES_OK) + def LogCollectBuild(self): self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.command('cd ' + self.eNBSourceCodePath, '\$', 5) @@ -1637,8 +1902,8 @@ class SSHConnection(): self.command('cd ' + self.eNBSourceCodePath, '\$', 5) self.command('cd cmake_targets', '\$', 5) self.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5) - self.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core*', '\$', 60) - self.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core*', '\$', 5) + self.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 60) + self.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5) self.close() def LogCollectPing(self): @@ -1697,6 +1962,37 @@ class SSHConnection(): self.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5) self.command('zip spgw.log.zip xGwLog.0', '\$', 60) self.close() + def RetrieveSystemVersion(self): + if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) + self.command('lsb_release -a', '\$', 5) + result = re.search('Description:\\\\t(?P[a-zA-Z0-9\-\_\.\ ]+)', str(self.ssh.before)) + if result is not None: + self.eNBOsVersion = result.group('os_type') + logging.debug('OS is: ' + self.eNBOsVersion) + self.command('uname -r', '\$', 5) + result = re.search('uname -r\\\\r\\\\n(?P[a-zA-Z0-9\-\_\.]+)', str(self.ssh.before)) + if result is not None: + self.eNBKernelVersion = result.group('kernel_version') + logging.debug('Kernel Version is: ' + self.eNBKernelVersion) + self.command('dpkg --list | egrep --color=never libuhd003', '\$', 5) + result = re.search('libuhd003:amd64 *(?P[0-9\.]+)', str(self.ssh.before)) + if result is not None: + self.eNBUhdVersion = result.group('uhd_version') + logging.debug('UHD Version is: ' + self.eNBUhdVersion) + self.command('lscpu', '\$', 5) + result = re.search('CPU\(s\): *(?P[0-9]+).*Model name: *(?P[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P[0-9\.]+)', str(self.ssh.before)) + if result is not None: + self.eNBCpuNb = result.group('nb_cpus') + logging.debug('nb_cpus: ' + self.eNBCpuNb) + self.eNBCpuModel = result.group('model') + logging.debug('model: ' + self.eNBCpuModel) + self.eNBCpuMHz = result.group('cpu_mhz') + ' MHz' + logging.debug('cpu_mhz: ' + self.eNBCpuMHz) + self.close() + #----------------------------------------------------------- # HTML Reporting.... #----------------------------------------------------------- @@ -1706,9 +2002,14 @@ 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') self.htmlFile.write(' Test Results for TEMPLATE_JOB_NAME job build #TEMPLATE_BUILD_ID\n') self.htmlFile.write('\n') - self.htmlFile.write('\n') + self.htmlFile.write('
\n') + self.htmlFile.write('
\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write('
\n') @@ -1723,60 +2024,103 @@ class SSHConnection(): self.htmlFile.write('
\n') self.htmlFile.write('
\n') + self.htmlFile.write('
TEMPLATE_STAGE_NAME
\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - self.htmlFile.write(' \n') - if (SSH.eNB_AllowMerge): + self.htmlFile.write(' \n') + if (self.eNB_AllowMerge): self.htmlFile.write(' \n') else: self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - if (SSH.eNB_AllowMerge): - self.htmlFile.write(' \n') + if (self.eNB_AllowMerge): + self.htmlFile.write(' \n') else: - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - if (SSH.eNB_AllowMerge): - self.htmlFile.write(' \n') + if (self.eNB_AllowMerge): + self.htmlFile.write(' \n') else: - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') - if (SSH.eNB_AllowMerge): + if (self.eNB_AllowMerge): self.htmlFile.write(' \n') - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + if (self.eNBTargetBranch == ''): + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write('
Build Start Time (UTC) Build Start Time (UTC) TEMPLATE_BUILD_TIME
GIT Repository' + SSH.eNBRepository + ' GIT Repository ' + self.eNBRepository + '
Job Trigger Job Trigger Merge-RequestPush to Branch
Source Branch Source Branch Branch' + SSH.eNBBranch + ' Branch' + self.eNBBranch + '
Source Commit ID Source Commit ID Commit ID' + SSH.eNBCommitID + ' Commit ID ' + self.eNBCommitID + '
Target Branchdevelop Target Branch develop' + self.eNBTargetBranch + '
\n') terminate_ue_flag = True - SSH.GetAllUEDevices(terminate_ue_flag) + if (self.ADBIPAddress != 'none'): + self.GetAllUEDevices(terminate_ue_flag) + self.GetAllCatMDevices(terminate_ue_flag) + else: + self.UEDevices.append('doughq9rehg') + self.UEDevices.append('dnsgiuahgia') + self.UEDevices.append('uehgieng9') self.htmlUEConnected = len(self.UEDevices) - self.htmlFile.write('

Jump to Final Status

\n') + self.htmlFile.write('

' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server

\n') + self.htmlFile.write('

' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server

\n') self.htmlFile.write('
\n') + self.htmlFile.write(' \n') + self.htmlFile.write('
\n') + self.htmlFile.close() - self.htmlFile.write('

' + str(self.htmlUEConnected) + ' UE(s) is(are) connected to ADB bench server

\n') - self.htmlFile.write('
\n') - - self.htmlFile.write('

Test Summary for ' + SSH.testXMLfile + '

\n') - self.htmlFile.write(' \n') + def CreateHtmlTabHeader(self): + if (not self.htmlHeaderCreated): + if (not os.path.isfile('test_results.html')): + self.CreateHtmlHeader() + self.htmlFile = open('test_results.html', 'a') + if (self.nbTestXMLfiles == 1): + self.htmlFile.write('
\n') + self.htmlFile.write('

Test Summary for ' + self.testXMLfiles[0] + '

\n') + else: + 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') + if (self.htmlUEConnected == -1): + terminate_ue_flag = True + if (self.ADBIPAddress != 'none'): + self.GetAllUEDevices(terminate_ue_flag) + self.GetAllCatMDevices(terminate_ue_flag) + else: + self.UEDevices.append('doughq9rehg') + self.UEDevices.append('dnsgiuahgia') + self.UEDevices.append('uehgieng9') + self.htmlUEConnected = len(self.UEDevices) + i = 0 while (i < self.htmlUEConnected): self.htmlFile.write(' \n') @@ -1784,26 +2128,64 @@ class SSHConnection(): self.htmlFile.write(' \n') self.htmlHeaderCreated = True - def CreateHtmlFooter(self, passStatus): + def CreateHtmlTabFooter(self, passStatus): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): - self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') if passStatus: - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') else: - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write('
Test IdTest DescTest OptionsTest StatusUE' + str(i) + ' Status
Final Status
Final Tab StatusPASSPASS FAILFAIL
\n') - self.htmlFile.write('\n') + self.htmlFile.write('
\n') + self.htmlFooterCreated = False + + def CreateHtmlFooter(self, passStatus): + if (os.path.isfile('test_results.html')): + self.RetrieveSystemVersion() + self.htmlFile = open('test_results.html', 'a') + 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') + 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') + 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') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + if passStatus: + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write('
eNB Server Characteristics
OS Version' + self.eNBOsVersion + 'Kernel Version' + self.eNBKernelVersion + 'UHD Version' + self.eNBUhdVersion + '
Nb CPUs' + self.eNBCpuNb + 'CPU Model Name' + self.eNBCpuModel + 'CPU Frequency' + self.eNBCpuMHz + '
Final StatusPASS FAIL
\n') + self.htmlFile.write('

\n') + self.htmlFile.write('
End of Test Report -- Copyright 2018 OpenAirInterface. All Rights Reserved.
\n') + self.htmlFile.write('\n') self.htmlFile.write('\n') self.htmlFile.close() - self.htmlFooterCreated = False def CreateHtmlTestRow(self, options, status, processesStatus): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): self.htmlFile.write(' \n') - self.htmlFile.write(' ' + SSH.testCase_id + '\n') - self.htmlFile.write(' ' + SSH.desc + '\n') + self.htmlFile.write(' ' + self.testCase_id + '\n') + self.htmlFile.write(' ' + self.desc + '\n') self.htmlFile.write(' ' + str(options) + '\n') if (str(status) == 'OK'): self.htmlFile.write(' ' + str(status) + '\n') @@ -1817,7 +2199,9 @@ class SSHConnection(): elif (processesStatus == ENB_PROCESS_ASSERTION): self.htmlFile.write(' KO - eNB process ended in Assertion\n') elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE): - self.htmlFile.write(' KO - eNB process faced Real Time issue(s)/td>\n') + self.htmlFile.write(' KO - eNB process faced Real Time issue(s)\n') + elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE): + self.htmlFile.write(' OK\n') elif (processesStatus == HSS_PROCESS_FAILED): self.htmlFile.write(' KO - HSS process not found\n') elif (processesStatus == MME_PROCESS_FAILED): @@ -1836,10 +2220,11 @@ class SSHConnection(): if result is not None: cellBgColor = 'red' else: - result = re.search('showed|Reestablishment', self.htmleNBFailureMsg) + result = re.search('showed|Reestablishment|Could not copy eNB logfile', self.htmleNBFailureMsg) if result is not None: cellBgColor = 'orange' - self.htmlFile.write('
' + self.htmleNBFailureMsg + '
\n') + self.htmlFile.write('
' + self.htmleNBFailureMsg + '
\n') self.htmleNBFailureMsg = '' else: i = 0 @@ -1852,8 +2237,8 @@ class SSHConnection(): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): addOrangeBK = False self.htmlFile.write(' \n') - self.htmlFile.write(' ' + SSH.testCase_id + '\n') - self.htmlFile.write(' ' + SSH.desc + '\n') + self.htmlFile.write(' ' + self.testCase_id + '\n') + self.htmlFile.write(' ' + self.desc + '\n') self.htmlFile.write(' ' + str(options) + '\n') if (str(status) == 'OK'): self.htmlFile.write(' ' + str(status) + '\n') @@ -1867,7 +2252,7 @@ class SSHConnection(): if (i < ue_status): if (not ue_queue.empty()): if (addOrangeBK): - self.htmlFile.write(' ' + str(ue_queue.get()) + '\n') + self.htmlFile.write(' ' + str(ue_queue.get()).replace('white', 'orange') + '\n') else: self.htmlFile.write(' ' + str(ue_queue.get()) + '\n') else: @@ -1897,12 +2282,15 @@ def Usage(): print(' --help Show this help.') print(' --mode=[Mode]') print(' TesteNB') + print(' InitiateHtml, FinalizeHtml') print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW') print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf') print(' --eNBIPAddress=[eNB\'s IP Address]') print(' --eNBRepository=[eNB\'s Repository URL]') print(' --eNBBranch=[eNB\'s Branch Name]') print(' --eNBCommitID=[eNB\'s Commit Number]') + print(' --eNB_AllowMerge=[eNB\'s Allow Merge Request (with target branch)]') + print(' --eNBTargetBranch=[eNB\'s Target Branch in case of a Merge Request]') print(' --eNBUserName=[eNB\'s Login User Name]') print(' --eNBPassword=[eNB\'s Login Password]') print(' --eNBSourceCodePath=[eNB\'s Source Code Path]') @@ -1918,7 +2306,7 @@ def Usage(): print('------------------------------------------------------------') def CheckClassValidity(action,id): - if action != 'Build_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 != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW': + if action != 'Build_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 != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' 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 != 'IdleSleep': logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action) return False return True @@ -1938,6 +2326,13 @@ def GetParametersFromXML(action): if (SSH.eNB_instance is None): SSH.eNB_instance = '0' + if action == 'Attach_UE': + nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach') + if (nbMaxUEtoAttach is None): + SSH.nbMaxUEtoAttach = -1 + else: + SSH.nbMaxUEtoAttach = int(nbMaxUEtoAttach) + if action == 'Ping': SSH.ping_args = test.findtext('ping_args') SSH.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold') @@ -1953,6 +2348,13 @@ def GetParametersFromXML(action): logging.debug('ERROR: test-case has wrong profile ' + SSH.iperf_profile) SSH.iperf_profile = 'balanced' + if action == 'IdleSleep': + string_field = test.findtext('idle_sleep_time_in_sec') + if (string_field is None): + SSH.idle_sleep_time = 5 + else: + SSH.idle_sleep_time = int(string_field) + #check if given test is in list #it is in list if one of the strings in 'list' is at the beginning of 'test' def test_in_list(test, list): @@ -1999,6 +2401,9 @@ while len(argvs) > 1: elif re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) SSH.eNBCommitID = matchReg.group(1) + elif re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) + SSH.eNBTargetBranch = matchReg.group(1) elif re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE) SSH.eNBUserName = matchReg.group(1) @@ -2040,7 +2445,13 @@ while len(argvs) > 1: SSH.ADBPassword = matchReg.group(1) elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE) - SSH.testXMLfile = matchReg.group(1) + SSH.testXMLfiles.append(matchReg.group(1)) + SSH.nbTestXMLfiles += 1 + elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE) + finalStatus = matchReg.group(1) + if ((finalStatus == 'true') or (finalStatus == 'True')): + SSH.finalStatus = True else: Usage() sys.exit('Invalid Parameter: ' + myArgv) @@ -2106,26 +2517,44 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE): Usage() sys.exit('Insufficient Parameter') SSH.LogCollectIperf() +elif re.match('^InitiateHtml$', mode, re.IGNORECASE): + if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': + Usage() + sys.exit('Insufficient Parameter') + count = 0 + while (count < SSH.nbTestXMLfiles): + xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[count] + xmlTree = ET.parse(xml_test_file) + xmlRoot = xmlTree.getroot() + SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count))) + SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count))) + SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign')) + count += 1 + SSH.CreateHtmlHeader() +elif re.match('^FinalizeHtml$', mode, re.IGNORECASE): + SSH.CreateHtmlFooter(SSH.finalStatus) elif re.match('^TesteNB$', mode, re.IGNORECASE): if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '': Usage() sys.exit('Insufficient Parameter') - SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") - SSH.CreateHtmlHeader() - + if (SSH.EPCIPAddress != 'none'): + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") + SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") #read test_case_list.xml file # if no parameters for XML file, use default value - if SSH.testXMLfile == '': + if (SSH.nbTestXMLfiles != 1): xml_test_file = sys.path[0] + "/test_case_list.xml" else: - xml_test_file = sys.path[0] + "/" + SSH.testXMLfile + xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0] xmlTree = ET.parse(xml_test_file) xmlRoot = xmlTree.getroot() exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='') requested_tests=xmlRoot.findtext('TestCaseRequestedList',default='') + if (SSH.nbTestXMLfiles == 1): + SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-0')) all_tests=xmlRoot.findall('testCase') exclusion_tests=exclusion_tests.split() @@ -2163,6 +2592,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): signal.signal(signal.SIGUSR1, receive_signal) + SSH.CreateHtmlTabHeader() + for test_case_id in todo_tests: for test in all_tests: id = test.get('id') @@ -2192,6 +2623,14 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): SSH.AttachUE() elif action == 'Detach_UE': SSH.DetachUE() + elif action == 'Initialize_CatM_module': + SSH.InitializeCatM() + elif action == 'Terminate_CatM_module': + SSH.TerminateCatM() + elif action == 'Attach_CatM_module': + SSH.AttachCatM() + elif action == 'Detach_CatM_module': + SSH.TerminateCatM() elif action == 'Ping': SSH.Ping() elif action == 'Iperf': @@ -2210,10 +2649,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): SSH.InitializeSPGW() elif action == 'Terminate_SPGW': SSH.TerminateSPGW() + elif action == 'IdleSleep': + SSH.IdleSleep() else: sys.exit('Invalid action') - SSH.CreateHtmlFooter(True) + SSH.CreateHtmlTabFooter(True) else: Usage() sys.exit('Invalid mode') diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool new file mode 100755 index 0000000000..6e0a83e07d --- /dev/null +++ b/ci-scripts/oai-ci-vm-tool @@ -0,0 +1,579 @@ +#!/bin/bash +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ + +function top_usage { + echo "OAI CI VM script" + echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" + echo " -- xenial image already synced" + echo "" + echo "Usage:" + echo "------" + echo " oai-ci-vm-tool (-h|--help) {create,destroy,build,wait,test,report-build,report-test} ..." + echo "" +} + +function variant_usage { + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" + echo " --variant l2-sim OR -v9" + echo " --variant flexran-rtc OR -v10" +} + +MY_DIR=$(dirname $(readlink -f $0)) +. $MY_DIR/createVM.sh +. $MY_DIR/buildOnVM.sh +. $MY_DIR/waitBuildOnVM.sh +. $MY_DIR/destroyAllRunningVM.sh +. $MY_DIR/runTestOnVM.sh +. $MY_DIR/reportBuildLocally.sh +. $MY_DIR/reportTestLocally.sh + +if [ $# -lt 1 ] +then + echo "Syntax Error: too few arguments" + echo "" + top_usage + exit 1 +fi + +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX +VM_NAME=ci-enb-usrp +VM_MEMORY=2048 +VM_CPU=4 +ARCHIVES_LOC=enb_usrp +LOG_PATTERN=.Rel14.txt +NB_PATTERN_FILES=4 +BUILD_OPTIONS="--eNB -w USRP" +KEEP_VM_ALIVE=0 +RUN_OPTIONS="none" +DAEMON=0 +MR_TRIG=0 +PU_TRIG=0 + +HELP_CMD=0 +CREATE_CMD=0 +BUILD_CMD=0 +WAIT_CMD=0 +DESTROY_CMD=0 +TEST_CMD=0 +REPORT_BUILD_CMD=0 +REPORT_TEST_CMD=0 +NBARGS=0 + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + HELP_CMD=1 + shift + ;; + create) + CREATE_CMD=1 + # It is implied to keep the VM when creating it + KEEP_VM_ALIVE=1 + shift + ;; + build) + BUILD_CMD=1 + shift + ;; + wait) + WAIT_CMD=1 + shift + ;; + test) + TEST_CMD=1 + shift + ;; + destroy) + DESTROY_CMD=1 + shift + ;; + report-build) + REPORT_BUILD_CMD=1 + shift + ;; + report-test) + REPORT_TEST_CMD=1 + shift + ;; + -jn|--job-name) + JOB_NAME="$2" + NBARGS=$[$NBARGS+1] + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + NBARGS=$[$NBARGS+2] + shift + shift + ;; + -ws|--workspace) + JENKINS_WKSP="$2" + NBARGS=$[$NBARGS+4] + shift + shift + ;; + -k|--keep-vm-alive) + KEEP_VM_ALIVE=1 + NBARGS=$[$NBARGS+8] + shift + ;; + -D|--daemon) + DAEMON=1 + NBARGS=$[$NBARGS+16] + shift + ;; + -gu|--git-url) + GIT_URL="$2" + NBARGS=$[$NBARGS+32] + shift + shift + ;; + --trigger) + TRIG="$2" + case $TRIG in + merge-request) + MR_TRIG=1 + ;; + push) + PU_TRIG=1 + ;; + *) + echo "" + echo "Syntax Error: Invalid Trigger option -> $TRIG" + echo "" + trigger_usage + exit + ;; + esac + NBARGS=$[$NBARGS+64] + shift + shift + ;; + -mr) + MR_TRIG=1 + NBARGS=$[$NBARGS+64] + shift + ;; + -pu) + PU_TRIG=1 + NBARGS=$[$NBARGS+64] + shift + ;; + -sb|--src-branch) + SOURCE_BRANCH="$2" + NBARGS=$[$NBARGS+1024] + shift + shift + ;; + -sc|--src-commit) + SOURCE_COMMIT_ID="$2" + NBARGS=$[$NBARGS+2048] + shift + shift + ;; + -tb|--target-branch) + TARGET_BRANCH="$2" + NBARGS=$[$NBARGS+4096] + shift + shift + ;; + -tc|--target-commit) + TARGET_COMMIT_ID="$2" + NBARGS=$[$NBARGS+8192] + shift + shift + ;; + -br|--branch) + SOURCE_BRANCH="$2" + NBARGS=$[$NBARGS+16384] + shift + shift + ;; + -co|--commit) + SOURCE_COMMIT_ID="$2" + NBARGS=$[$NBARGS+32768] + shift + shift + ;; + -v1) + VM_NAME=ci-enb-usrp + ARCHIVES_LOC=enb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -w USRP --mu" + NBARGS=$[$NBARGS+256] + shift + ;; + -v2) + VM_NAME=ci-basic-sim + ARCHIVES_LOC=basic_sim + LOG_PATTERN=basic_simulator + NB_PATTERN_FILES=2 + BUILD_OPTIONS="--basic-simulator" + VM_MEMORY=8192 + VM_CPU=4 + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + shift + ;; + -v3) + VM_NAME=ci-phy-sim + ARCHIVES_LOC=phy_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=3 + BUILD_OPTIONS="--phy_simulators" + RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" + NBARGS=$[$NBARGS+256] + shift + ;; + -v4) + VM_NAME=ci-cppcheck + VM_MEMORY=4096 + ARCHIVES_LOC=cppcheck + LOG_PATTERN=cppcheck.xml + NB_PATTERN_FILES=1 + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" + NBARGS=$[$NBARGS+256] + shift + ;; + -v7) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + NBARGS=$[$NBARGS+256] + shift + ;; + -v8) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + NBARGS=$[$NBARGS+256] + shift + ;; + -v9) + VM_NAME=ci-l2-sim + VM_MEMORY=8192 + VM_CPU=8 + ARCHIVES_LOC=l2_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -t ETHERNET" + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + shift + ;; + -v10) + VM_NAME=ci-flexran-rtc + ARCHIVES_LOC=flexran + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=1 + BUILD_OPTIONS="cmake . && make -j2" + NBARGS=$[$NBARGS+256] + shift + ;; + --variant) + variant="$2" + case $variant in + enb-usrp) + VM_NAME=ci-enb-usrp + ARCHIVES_LOC=enb_usrp + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -w USRP --mu" + NBARGS=$[$NBARGS+256] + ;; + basic-sim) + VM_NAME=ci-basic-sim + ARCHIVES_LOC=basic_sim + LOG_PATTERN=basic_simulator + NB_PATTERN_FILES=2 + BUILD_OPTIONS="--basic-simulator" + VM_MEMORY=8192 + VM_CPU=4 + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + ;; + phy-sim) + VM_NAME=ci-phy-sim + ARCHIVES_LOC=phy_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=3 + BUILD_OPTIONS="--phy_simulators" + RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" + NBARGS=$[$NBARGS+256] + ;; + cppcheck) + VM_NAME=ci-cppcheck + VM_MEMORY=8192 + ARCHIVES_LOC=cppcheck + LOG_PATTERN=cppcheck.xml + NB_PATTERN_FILES=1 + BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" + NBARGS=$[$NBARGS+256] + ;; + enb-ethernet) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + NBARGS=$[$NBARGS+256] + ;; + ue-ethernet) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + NBARGS=$[$NBARGS+256] + ;; + l2-sim) + VM_NAME=ci-l2-sim + VM_MEMORY=8192 + VM_CPU=8 + ARCHIVES_LOC=l2_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -t ETHERNET" + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + ;; + flexran-rtc) + VM_NAME=ci-flexran-rtc + ARCHIVES_LOC=flexran + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=1 + BUILD_OPTIONS="cmake . && make -j2" + NBARGS=$[$NBARGS+256] + ;; + *) + echo "" + echo "Syntax Error: Invalid Variant option -> $variant" + echo "" + variant_usage + exit 1 + esac + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + top_usage + exit 1 +esac +done + +MANY_CMDS=$[$CREATE_CMD+$BUILD_CMD+$WAIT_CMD+$DESTROY_CMD+$TEST_CMD+$REPORT_BUILD_CMD+$REPORT_TEST_CMD] +if [ $MANY_CMDS -gt 1 ] +then + echo "Syntax Error: too many commands" + top_usage + exit 1 +fi + +if [ $HELP_CMD -eq 1 ] +then + if [ $MANY_CMDS -eq 0 ] + then + top_usage + exit 0 + fi + if [ $CREATE_CMD -eq 1 ] + then + create_usage + exit 0 + fi + if [ $BUILD_CMD -eq 1 ] + then + build_usage + exit 0 + fi + if [ $WAIT_CMD -eq 1 ] + then + wait_usage + exit 0 + fi + if [ $TEST_CMD -eq 1 ] + then + run_test_usage + exit 0 + fi + if [ $DESTROY_CMD -eq 1 ] + then + destroy_usage + exit 0 + fi + if [ $REPORT_BUILD_CMD -eq 1 ] + then + report_build_usage + exit 0 + fi + if [ $REPORT_TEST_CMD -eq 1 ] + then + report_test_usage + exit 0 + fi +else + if [ $MANY_CMDS -eq 0 ] + then + echo "Syntax Error: no command" + top_usage + exit 1 + fi + # For create, mandatory options: jn, id. Optional: variant + if [ $CREATE_CMD -eq 1 ] && [ $NBARGS -ne 3 ] && [ $NBARGS -ne 259 ] + then + echo "Syntax Error: unsupported option(s) for create command" + create_usage + exit 1 + fi + # For build, mandatory options: jn, id, ws. Optional: variant, k, D + if [ $BUILD_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ] && [ $NBARGS -ne 23 ] && [ $NBARGS -ne 279 ] && [ $NBARGS -ne 31 ] && [ $NBARGS -ne 287 ] + then + echo "Syntax Error: unsupported option(s) for build command" + build_usage + exit 1 + fi + # For wait, mandatory options: jn, id, ws. Optional: variant, k + if [ $WAIT_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ] + then + echo "Syntax Error: unsupported option(s) for wait command" + wait_usage + exit 1 + fi + # For test, mandatory options: jn, id, ws. Optional: variant, k + if [ $TEST_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ] + then + echo "Syntax Error: unsupported option(s) for test command" + run_test_usage + exit 1 + fi + # For destroy, mandatory options: jn, id. + if [ $DESTROY_CMD -eq 1 ] && [ $NBARGS -ne 3 ] + then + echo "Syntax Error: unsupported option(s) for destroy command" + destroy_usage + exit 1 + fi + # For report-build, mandatory options: jn, id, ws, gu, pu, br,co. + # or: jn, id, ws, gu, mr, sb, sc, tb, tc. + if [ $REPORT_BUILD_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ] + then + echo "Syntax Error: unsupported option(s) for report-build command" + report_build_usage + exit 1 + fi + # For report-test, mandatory options: jn, id, ws, gu, pu, br,co. + # or: jn, id, ws, gu, mr, sb, sc, tb, tc. + if [ $REPORT_TEST_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ] + then + echo "Syntax Error: unsupported option(s) for report-test command" + report_test_usage + exit 1 + fi +fi + +# Checking uvt-kvm is installed +UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm` +if [ $UVT_KVM_PATH -eq 0 ] +then + echo "Error: uvt-kvm is not installed" + top_usage + exit 1 +fi + +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` +VM_CMDS=${VM_NAME}_cmds.txt +ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} + +STATUS=0 +if [ $CREATE_CMD -eq 1 ] +then + create_vm +fi +if [ $BUILD_CMD -eq 1 ] +then + build_on_vm + if [ $DAEMON -eq 0 ] && [ $STATUS -eq 0 ] + then + check_on_vm_build + fi +fi +if [ $WAIT_CMD -eq 1 ] +then + wait_on_vm_build + if [ $STATUS -eq 0 ] + then + check_on_vm_build + fi +fi +if [ $TEST_CMD -eq 1 ] +then + ARCHIVES_LOC=${ARCHIVES_LOC}/test + run_test_on_vm +fi +if [ $DESTROY_CMD -eq 1 ] +then + destroy_vm +fi +if [ $REPORT_BUILD_CMD -eq 1 ] +then + report_build +fi +if [ $REPORT_TEST_CMD -eq 1 ] +then + report_test +fi + +# Did command pass or fail? +if [ $STATUS -eq 0 ] +then + echo "STATUS seems OK" +else + echo "STATUS failed?" +fi +exit $STATUS diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index a499fa3b66..bfce7acd8f 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -20,14 +20,13 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI Local Build Report script" +function report_build_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" echo "" echo "Usage:" echo "------" - echo "" - echo " reportBuildLocally.sh [OPTIONS]" + echo " oai-ci-vm-tool report-build [OPTIONS]" echo "" echo "Options:" echo "--------" @@ -47,6 +46,9 @@ function usage { echo " --build-id #### OR -id ####" echo " Specify the build ID of the Jenkins job." echo "" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace." + echo "" echo " --trigger merge-request OR -mr" echo " --trigger push OR -pu" echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event." @@ -79,7 +81,7 @@ function usage { } function trigger_usage { - echo "OAI Local Build Report script" + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" echo "" echo " --trigger merge-request OR -mr" @@ -103,7 +105,7 @@ function details_table { COMPLETE_MESSAGE="start" for MESSAGE in $LIST_MESSAGES do - if [[ $MESSAGE == *"/home/ubuntu/tmp"* ]] + if [[ $MESSAGE == *"/home/ubuntu/tmp"* ]] || [[ $MESSAGE == *"/tmp/CI-eNB"* ]] then FILENAME=`echo $MESSAGE | sed -e "s#^/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" | awk -F ":" '{print $1}'` LINENB=`echo $MESSAGE | awk -F ":" '{print $2}'` @@ -139,6 +141,23 @@ function details_table { function summary_table_header { echo "

$1

" >> ./build_results.html + if [ -f $2/build_final_status.log ] + then + if [ `grep -c BUILD_OK $2/build_final_status.log` -eq 1 ] + then + echo "
" >> ./build_results.html + echo " BUILD was SUCCESSFUL " >> ./build_results.html + echo "
" >> ./build_results.html + else + echo "
" >> ./build_results.html + echo " BUILD was a FAILURE! " >> ./build_results.html + echo "
" >> ./build_results.html + fi + else + echo "
" >> ./build_results.html + echo " COULD NOT DETERMINE BUILD FINAL STATUS! " >> ./build_results.html + echo "
" >> ./build_results.html + fi echo " " >> ./build_results.html echo " " >> ./build_results.html echo " " >> ./build_results.html @@ -153,8 +172,8 @@ function summary_table_row { echo " " >> ./build_results.html; fi - if [ $MR_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi - echo " " >> ./build_results.html + if [ -f ./oai_rules_result.txt ] + then + echo "

OAI Coding / Formatting Guidelines Check

" >> ./build_results.html + NB_FILES=`cat ./oai_rules_result.txt` + if [ $NB_FILES = "0" ] + then + echo "
" >> ./build_results.html + if [ $PU_TRIG -eq 1 ]; then echo " All files in repository follow OAI rules. " >> ./build_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " All modified files in Merge-Request follow OAI rules. " >> ./build_results.html; fi + echo "
" >> ./build_results.html + else + echo "
" >> ./build_results.html + if [ $PU_TRIG -eq 1 ]; then echo " $NB_FILES files in repository DO NOT follow OAI rules. " >> ./build_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " $NB_FILES modified files in Merge-Request DO NOT follow OAI rules. " >> ./build_results.html; fi + echo "
" >> ./build_results.html + fi if [ -f ./oai_rules_result_list.txt ] then - awk '{print " "}' ./oai_rules_result_list.txt >> ./build_results.html + echo " " >> ./build_results.html + echo "
" >> ./build_results.html + echo "

Please apply the following command to this(ese) file(s):

" >> ./build_results.html + echo "

astyle --options=ci-scripts/astyle-options.txt filename(s)

" >> ./build_results.html + echo "
Element$1" >> ./build_results.html if [ -f $2 ] then - STATUS=`egrep -c "$3" $2` - if [ $STATUS -eq 1 ] + BUILD_STATUS=`egrep -c "$3" $2` + if [ $BUILD_STATUS -eq 1 ] then echo " OK" >> ./build_results.html else @@ -196,7 +215,28 @@ function summary_table_footer { } function sca_summary_table_header { - echo "

$1

" >> ./build_results.html + echo "

$2

" >> ./build_results.html + NB_ERRORS=`egrep -c "severity=\"error\"" $1` + NB_WARNINGS=`egrep -c "severity=\"warning\"" $1` + if [ $NB_ERRORS -eq 0 ] && [ $NB_WARNINGS -eq 0 ] + then + echo "
" >> ./build_results.html + echo " CPPCHECK found NO error and NO warning " >> ./build_results.html + echo "
" >> ./build_results.html + else + if [ $NB_ERRORS -eq 0 ] + then + echo "
" >> ./build_results.html + echo " CPPCHECK found NO error and $NB_WARNINGS warnings " >> ./build_results.html + echo "
" >> ./build_results.html + else + echo "
" >> ./build_results.html + echo " CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings " >> ./build_results.html + echo "
" >> ./build_results.html + fi + fi + echo " " >> ./build_results.html + echo "
" >> ./build_results.html echo " " >> ./build_results.html echo " " >> ./build_results.html echo " " >> ./build_results.html @@ -261,344 +301,252 @@ function sca_summary_table_footer { echo "
Error / Warning Type
" >> ./build_results.html echo "

Full details in zipped artifact (cppcheck/cppcheck.xml)

" >> ./build_results.html echo "

Graphical Interface tool : cppcheck-gui -l cppcheck/cppcheck.xml

" >> ./build_results.html + echo "
" >> ./build_results.html } -jb_checker=0 -mr_checker=0 -pu_checker=0 -MR_TRIG=0 -PU_TRIG=0 -while [[ $# -gt 0 ]] -do -key="$1" +function report_build { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -gu|--git-url) - GIT_URL="$2" - let "jb_checker|=0x1" - shift - shift - ;; - -jn|--job-name) - JOB_NAME="$2" - let "jb_checker|=0x2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - let "jb_checker|=0x4" - shift - shift - ;; - --trigger) - TRIG="$2" - case $TRIG in - merge-request) - MR_TRIG=1 - ;; - push) - PU_TRIG=1 - ;; - *) - echo "" - echo "Syntax Error: Invalid Trigger option -> $TRIG" - echo "" - trigger_usage - exit - ;; - esac - let "jb_checker|=0x8" - shift - shift - ;; - -mr) - MR_TRIG=1 - let "jb_checker|=0x8" - shift - ;; - -pu) - PU_TRIG=1 - let "jb_checker|=0x8" - shift - ;; - -sb|--src-branch) - SOURCE_BRANCH="$2" - let "mr_checker|=0x1" - shift - shift - ;; - -sc|--src-commit) - SOURCE_COMMIT_ID="$2" - let "mr_checker|=0x2" - shift - shift - ;; - -tb|--target-branch) - TARGET_BRANCH="$2" - let "mr_checker|=0x4" - shift - shift - ;; - -tc|--target-commit) - TARGET_COMMIT_ID="$2" - let "mr_checker|=0x8" - shift - shift - ;; - -br|--branch) - SOURCE_BRANCH="$2" - let "pu_checker|=0x1" - shift - shift - ;; - -co|--commit) - SOURCE_COMMIT_ID="$2" - let "pu_checker|=0x2" - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 - ;; -esac + echo "JENKINS_WKSP = $JENKINS_WKSP" + echo "GIT_URL = $GIT_URL" -done - -if [ $jb_checker -ne 15 ] -then - echo "" - echo "Syntax Error: missing job information." - # TODO : list missing info - echo "" - exit 1 -fi - -if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ] -then - echo "" - echo "Syntax Error: trigger action incoherent." - echo "" - trigger_usage - exit 1 -fi - -if [ $PU_TRIG -eq 1 ] -then - if [ $pu_checker -ne 3 ] + cd ${JENKINS_WKSP} + echo "" > ./build_results.html + echo "" >> ./build_results.html + echo "" >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " Build Results for $JOB_NAME job build #$BUILD_ID" >> ./build_results.html + echo " " >> ./build_results.html + echo "" >> ./build_results.html + echo "
" >> ./build_results.html + echo "
" >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo "
" >> ./build_results.html + echo " " >> ./build_results.html + echo " \"\"" >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID" >> ./build_results.html + echo "
" >> ./build_results.html + echo "
" >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + if [ $PU_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi + echo " " >> ./build_results.html + if [ $PU_TRIG -eq 1 ] then - echo "" - echo "Syntax Error: missing push information." - # TODO : list missing info - echo "" - exit 1 + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html fi -fi - -if [ $MR_TRIG -eq 1 ] -then - if [ $mr_checker -ne 15 ] + if [ $MR_TRIG -eq 1 ] then - echo "" - echo "Syntax Error: missing merge-request information." - # TODO : list missing info - echo "" - exit 1 + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html fi -fi + echo "
Build Start Time (UTC)TEMPLATE_BUILD_TIME
GIT Repository$GIT_URL
Job TriggerPush EventMerge-Request
Branch$SOURCE_BRANCH
Commit ID$SOURCE_COMMIT_ID
Source Branch$SOURCE_BRANCH
Source Commit ID$SOURCE_COMMIT_ID
Target Branch$TARGET_BRANCH
Target Commit ID$TARGET_COMMIT_ID
" >> ./build_results.html + echo "

Build Summary

" >> ./build_results.html -echo "" > ./build_results.html -echo "" >> ./build_results.html -echo "" >> ./build_results.html -echo " Build Results for $JOB_NAME job build #$BUILD_ID" >> ./build_results.html -echo " " >> ./build_results.html -echo "" >> ./build_results.html -echo "" >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo "
" >> ./build_results.html -echo " " >> ./build_results.html -echo " \"\"" >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID" >> ./build_results.html -echo "
" >> ./build_results.html -echo "
" >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -echo " " >> ./build_results.html -if [ $PU_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi -if [ $MR_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi -echo " " >> ./build_results.html -if [ $PU_TRIG -eq 1 ] -then - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html -fi -if [ $MR_TRIG -eq 1 ] -then - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html -fi -echo "
Build Start Time (UTC)TEMPLATE_BUILD_TIME
GIT Repository$GIT_URL
Job TriggerPush EventMerge-Request
Branch$SOURCE_BRANCH
Commit ID$SOURCE_COMMIT_ID
Source Branch$SOURCE_BRANCH
Source Commit ID$SOURCE_COMMIT_ID
Target Branch$TARGET_BRANCH
Target Commit ID$TARGET_COMMIT_ID
" >> ./build_results.html -echo "

Build Summary

" >> ./build_results.html - -if [ -f ./oai_rules_result.txt ] -then - echo "

OAI Coding / Formatting Guidelines Check

" >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - echo " " >> ./build_results.html - NB_FILES=`cat ./oai_rules_result.txt` - if [ $NB_FILES = "0" ] - then - if [ $PU_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi - if [ $MR_TRIG -eq 1 ]; then echo " " >> ./build_results.html; fi - echo " " >> ./build_results.html - echo "
Result:All files in repository follow OAI rules. All modified files in Merge-Request follow OAI rules.
" >> ./build_results.html - else - if [ $PU_TRIG -eq 1 ]; then echo "
$NB_FILES files in repository DO NOT follow OAI rules. $NB_FILES modified files in Merge-Request DO NOT follow OAI rules.
"$1"
" >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + echo " " >> ./build_results.html + awk '{print " "}' ./oai_rules_result_list.txt >> ./build_results.html + echo "
Filename
"$1"
" >> ./build_results.html + echo " " >> ./build_results.html fi - echo " " >> ./build_results.html - echo "

Please apply the following command to this(ese) file(s):

" >> ./build_results.html - echo "

astyle --options=ci-scripts/astyle-options.txt filename(s)

" >> ./build_results.html fi -fi -echo "

Ubuntu 16.04 LTS -- Summary

" >> ./build_results.html + echo "

Ubuntu 16.04 LTS -- Summary

" >> ./build_results.html -sca_summary_table_header "OAI Static Code Analysis with CPPCHECK" -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds -sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder -sca_summary_table_footer ./archives/cppcheck/cppcheck.xml + sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK" + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds + sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder + sca_summary_table_footer ./archives/cppcheck/cppcheck.xml -summary_table_header "OAI Build eNB -- USRP option" -summary_table_row "LTE SoftModem - Release 14" ./archives/enb_usrp/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_row1.html -summary_table_row "Coding - Release 14" ./archives/enb_usrp/coding.Rel14.txt "Built target coding" ./enb_usrp_row2.html -summary_table_row "OAI USRP device if - Release 14" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html -summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_row4.html -summary_table_footer + summary_table_header "OAI Build eNB -- USRP option" ./archives/enb_usrp + summary_table_row "LTE SoftModem - Release 14" ./archives/enb_usrp/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_row1.html + summary_table_row "Coding - Release 14" ./archives/enb_usrp/coding.Rel14.txt "Built target coding" ./enb_usrp_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_row4.html + summary_table_footer -summary_table_header "OAI Build basic simulator option" -summary_table_row "Basic Simulator eNb - Release 14" ./archives/basic_sim/basic_simulator_enb.txt "Built target lte-softmodem" ./basic_sim_row1.html -summary_table_row "Basic Simulator UE - Release 14" ./archives/basic_sim/basic_simulator_ue.txt "Built target lte-uesoftmodem" ./basic_sim_row2.html -summary_table_row "Conf 2 UE data - Release 14" ./archives/basic_sim/conf2uedata.Rel14.txt "Built target conf2uedata" ./basic_sim_row3.html -summary_table_footer + summary_table_header "OAI Build basic simulator option" ./archives/basic_sim + summary_table_row "Basic Simulator eNb - Release 14" ./archives/basic_sim/basic_simulator_enb.txt "Built target lte-softmodem" ./basic_sim_row1.html + summary_table_row "Basic Simulator UE - Release 14" ./archives/basic_sim/basic_simulator_ue.txt "Built target lte-uesoftmodem" ./basic_sim_row2.html + summary_table_row "Conf 2 UE data - Release 14" ./archives/basic_sim/conf2uedata.Rel14.txt "Built target conf2uedata" ./basic_sim_row3.html + summary_table_footer -summary_table_header "OAI Build Physical simulators option" -summary_table_row "DL Simulator - Release 14" ./archives/phy_sim/dlsim.Rel14.txt "Built target dlsim" ./phy_sim_row1.html -summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt "Built target ulsim" ./phy_sim_row2.html -summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html -summary_table_footer + summary_table_header "OAI Build Physical simulators option" ./archives/phy_sim + summary_table_row "DL Simulator - Release 14" ./archives/phy_sim/dlsim.Rel14.txt "Built target dlsim" ./phy_sim_row1.html + summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt "Built target ulsim" ./phy_sim_row2.html + summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html + summary_table_footer -summary_table_header "OAI Build eNB -- ETHERNET transport option" -summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html -summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html -summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_eth_row3.html -summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_eth_row4.html -summary_table_row "RB Tools - Release 14" ./archives/enb_eth/rb_tool.Rel14.txt "Built target rb_tool" ./enb_eth_row5.html -summary_table_row "NAS Mesh - Release 14" ./archives/enb_eth/nasmesh.Rel14.txt "Built target nasmesh" ./enb_eth_row6.html -summary_table_footer -summary_table_header "OAI Build UE -- ETHERNET transport option" -summary_table_row "LTE UE SoftModem w/o S1 - Release 14" ./archives/ue_eth/lte-uesoftmodem-nos1.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html -summary_table_row "Coding - Release 14" ./archives/ue_eth/coding.Rel14.txt "Built target coding" ./ue_eth_row2.html -summary_table_row "OAI ETHERNET transport - Release 14" ./archives/ue_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./ue_eth_row3.html -summary_table_row "Parameters Lib Config - Release 14" ./archives/ue_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./ue_eth_row4.html -summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "Built target rb_tool" ./ue_eth_row5.html -summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html -summary_table_footer + if [ -f archives/gnb_usrp/nr-softmodem.Rel14.txt ] + then + summary_table_header "OAI Build gNB -- USRP option" ./archives/gnb_usrp + summary_table_row "LTE SoftModem - Release 14" ./archives/gnb_usrp/nr-softmodem.Rel14.txt "Built target nr-softmodem" ./gnb_usrp_row1.html + summary_table_row "Coding - Release 14" ./archives/gnb_usrp/coding.Rel14.txt "Built target coding" ./gnb_usrp_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/gnb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/gnb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./gnb_usrp_row4.html + summary_table_footer + fi -echo "

Red Hat (CentOS Linux release 7.4.1708) -- Summary

" >> ./build_results.html + if [ -f archives/nrue_usrp/nr-uesoftmodem.Rel14.txt ] + then + summary_table_header "OAI Build 5G NR UE -- USRP option" ./archives/nrue_usrp + summary_table_row "UE SoftModem - Release 14" ./archives/nrue_usrp/nr-uesoftmodem.Rel14.txt "Built target nr-uesoftmodem" ./nrue_usrp_row1.html + summary_table_row "Coding - Release 14" ./archives/nrue_usrp/coding.Rel14.txt "Built target coding" ./nrue_usrp_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/nrue_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./nrue_usrp_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/nrue_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./nrue_usrp_row4.html + summary_table_footer + fi -summary_table_header "Red Hat -- OAI Build eNB -- USRP option" -summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html -summary_table_row "Coding - Release 14" ./archives/red_hat/coding.Rel14.txt "Built target coding" ./enb_usrp_rh_row2.html -summary_table_row "OAI USRP device if - Release 14" ./archives/red_hat/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_rh_row3.html -summary_table_row "Parameters Lib Config - Release 14" ./archives/red_hat/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_rh_row4.html -summary_table_footer + summary_table_header "OAI Build eNB -- ETHERNET transport option" ./archives/enb_eth + summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html + summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html + summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_eth_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_eth_row4.html + summary_table_row "RB Tools - Release 14" ./archives/enb_eth/rb_tool.Rel14.txt "Built target rb_tool" ./enb_eth_row5.html + summary_table_row "NAS Mesh - Release 14" ./archives/enb_eth/nasmesh.Rel14.txt "Built target nasmesh" ./enb_eth_row6.html + summary_table_footer -echo "

Details

" >> ./build_results.html + summary_table_header "OAI Build UE -- ETHERNET transport option" ./archives/ue_eth + summary_table_row "LTE UE SoftModem w/o S1 - Release 14" ./archives/ue_eth/lte-uesoftmodem-nos1.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html + summary_table_row "Coding - Release 14" ./archives/ue_eth/coding.Rel14.txt "Built target coding" ./ue_eth_row2.html + summary_table_row "OAI ETHERNET transport - Release 14" ./archives/ue_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./ue_eth_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/ue_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./ue_eth_row4.html + summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "Built target rb_tool" ./ue_eth_row5.html + summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html + summary_table_footer -for DETAILS_TABLE in `ls ./enb_usrp_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -for DETAILS_TABLE in `ls ./basic_sim_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -for DETAILS_TABLE in `ls ./phy_sim_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -for DETAILS_TABLE in `ls ./enb_eth_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -for DETAILS_TABLE in `ls ./ue_eth_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html` -do - cat $DETAILS_TABLE >> ./build_results.html -done -rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./enb_eth_row*.html ./ue_eth_row*.html ./enb_usrp_rh_row*.html + if [ -e ./archives/red_hat ] + then + echo "

Red Hat (CentOS Linux release 7.4.1708) -- Summary

" >> ./build_results.html -echo "" >> ./build_results.html -echo "" >> ./build_results.html + summary_table_header "Red Hat -- OAI Build eNB -- USRP option" ./archives/red_hat + summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html + summary_table_row "Coding - Release 14" ./archives/red_hat/coding.Rel14.txt "Built target coding" ./enb_usrp_rh_row2.html + summary_table_row "OAI USRP device if - Release 14" ./archives/red_hat/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_rh_row3.html + summary_table_row "Parameters Lib Config - Release 14" ./archives/red_hat/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_rh_row4.html + summary_table_footer + fi -exit 0 + echo "

Details

" >> ./build_results.html + echo " " >> ./build_results.html + echo "
" >> ./build_results.html + + for DETAILS_TABLE in `ls ./enb_usrp_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + for DETAILS_TABLE in `ls ./basic_sim_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + for DETAILS_TABLE in `ls ./phy_sim_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + + for DETAILS_TABLE in `ls ./gnb_usrp_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + for DETAILS_TABLE in `ls ./nrue_usrp_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + for DETAILS_TABLE in `ls ./enb_eth_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + for DETAILS_TABLE in `ls ./ue_eth_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + if [ -e ./archives/red_hat ] + then + for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html` + do + cat $DETAILS_TABLE >> ./build_results.html + done + fi + rm -f ./*_row*.html + + echo "
" >> ./build_results.html + echo "

" >> ./build_results.html + echo "
End of Build Report -- Copyright 2018 OpenAirInterface. All Rights Reserved.
" >> ./build_results.html + echo "" >> ./build_results.html + echo "" >> ./build_results.html +} diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index e00956199c..004e021de1 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -20,14 +20,13 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI Test Report script" +function report_test_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" echo "" echo "Usage:" echo "------" - echo "" - echo " reportTestLocally.sh [OPTIONS]" + echo " oai-ci-vm-tool report-test [OPTIONS]" echo "" echo "Options:" echo "--------" @@ -47,6 +46,9 @@ function usage { echo " --build-id #### OR -id ####" echo " Specify the build ID of the Jenkins job." echo "" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace." + echo "" echo " --trigger merge-request OR -mr" echo " --trigger push OR -pu" echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event." @@ -78,513 +80,579 @@ function usage { echo "" } -function trigger_usage { - echo "OAI Test Report script" - echo " Original Author: Raphael Defosseux" - echo "" - echo " --trigger merge-request OR -mr" - echo " --trigger push OR -pu" - echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event." - echo "" -} +function report_test { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" -jb_checker=0 -mr_checker=0 -pu_checker=0 -MR_TRIG=0 -PU_TRIG=0 -while [[ $# -gt 0 ]] -do -key="$1" + echo "JENKINS_WKSP = $JENKINS_WKSP" -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -gu|--git-url) - GIT_URL="$2" - let "jb_checker|=0x1" - shift - shift - ;; - -jn|--job-name) - JOB_NAME="$2" - let "jb_checker|=0x2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - let "jb_checker|=0x4" - shift - shift - ;; - --trigger) - TRIG="$2" - case $TRIG in - merge-request) - MR_TRIG=1 - ;; - push) - PU_TRIG=1 - ;; - *) - echo "" - echo "Syntax Error: Invalid Trigger option -> $TRIG" - echo "" - trigger_usage - exit - ;; - esac - let "jb_checker|=0x8" - shift - shift - ;; - -mr) - MR_TRIG=1 - let "jb_checker|=0x8" - shift - ;; - -pu) - PU_TRIG=1 - let "jb_checker|=0x8" - shift - ;; - -sb|--src-branch) - SOURCE_BRANCH="$2" - let "mr_checker|=0x1" - shift - shift - ;; - -sc|--src-commit) - SOURCE_COMMIT_ID="$2" - let "mr_checker|=0x2" - shift - shift - ;; - -tb|--target-branch) - TARGET_BRANCH="$2" - let "mr_checker|=0x4" - shift - shift - ;; - -tc|--target-commit) - TARGET_COMMIT_ID="$2" - let "mr_checker|=0x8" - shift - shift - ;; - -br|--branch) - SOURCE_BRANCH="$2" - let "pu_checker|=0x1" - shift - shift - ;; - -co|--commit) - SOURCE_COMMIT_ID="$2" - let "pu_checker|=0x2" - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 - ;; -esac - -done - -if [ $jb_checker -ne 15 ] -then - echo "" - echo "Syntax Error: missing job information." - # TODO : list missing info - echo "" - exit 1 -fi - -if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ] -then - echo "" - echo "Syntax Error: trigger action incoherent." - echo "" - trigger_usage - exit 1 -fi - -if [ $PU_TRIG -eq 1 ] -then - if [ $pu_checker -ne 3 ] - then - echo "" - echo "Syntax Error: missing push information." - # TODO : list missing info - echo "" - exit 1 - fi -fi - -if [ $MR_TRIG -eq 1 ] -then - if [ $mr_checker -ne 15 ] - then - echo "" - echo "Syntax Error: missing merge-request information." - # TODO : list missing info - echo "" - exit 1 - fi -fi - -echo "" > ./test_simulator_results.html -echo "" >> ./test_simulator_results.html -echo "" >> ./test_simulator_results.html -echo " Simulator Results for $JOB_NAME job build #$BUILD_ID" >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo "" >> ./test_simulator_results.html -echo "" >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo "
" >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " \"\"" >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID" >> ./test_simulator_results.html -echo "
" >> ./test_simulator_results.html -echo "
" >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -echo " " >> ./test_simulator_results.html -if [ $PU_TRIG -eq 1 ]; then echo " " >> ./test_simulator_results.html; fi -if [ $MR_TRIG -eq 1 ]; then echo " " >> ./test_simulator_results.html; fi -echo " " >> ./test_simulator_results.html -if [ $PU_TRIG -eq 1 ] -then - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html -fi -if [ $MR_TRIG -eq 1 ] -then - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html -fi -echo "
Build Start Time (UTC)TEMPLATE_BUILD_TIME
GIT Repository$GIT_URL
Job TriggerPush EventMerge-Request
Branch$SOURCE_BRANCH
Commit ID$SOURCE_COMMIT_ID
Source Branch$SOURCE_BRANCH
Source Commit ID$SOURCE_COMMIT_ID
Target Branch$TARGET_BRANCH
Target Commit ID$TARGET_COMMIT_ID
" >> ./test_simulator_results.html -echo "

Test Summary

" >> ./test_simulator_results.html - -ARCHIVES_LOC=archives/basic_sim/test -if [ -d $ARCHIVES_LOC ] -then - echo "

Basic Simulator Check

" >> ./test_simulator_results.html + cd ${JENKINS_WKSP} + echo "" > ./test_simulator_results.html + echo "" >> ./test_simulator_results.html + echo "" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " Simulator Results for $JOB_NAME job build #$BUILD_ID" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo "" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " \"\"" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + if [ $PU_TRIG -eq 1 ]; then echo " " >> ./test_simulator_results.html; fi + if [ $MR_TRIG -eq 1 ]; then echo " " >> ./test_simulator_results.html; fi + echo " " >> ./test_simulator_results.html + if [ $PU_TRIG -eq 1 ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + if [ $MR_TRIG -eq 1 ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + echo "
Log File NameCommandStatusStatistics
Build Start Time (UTC)TEMPLATE_BUILD_TIME
GIT Repository$GIT_URL
Job TriggerPush EventMerge-Request
Branch$SOURCE_BRANCH
Commit ID$SOURCE_COMMIT_ID
Source Branch$SOURCE_BRANCH
Source Commit ID$SOURCE_COMMIT_ID
Target Branch$TARGET_BRANCH
Target Commit ID$TARGET_COMMIT_ID
" >> ./test_simulator_results.html + echo "

Test Summary

" >> ./test_simulator_results.html - TRANS_MODES=("fdd" "tdd") - BW_CASES=(05 10 20) - for TMODE in ${TRANS_MODES[@]} - do - for BW in ${BW_CASES[@]} - do - ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log - UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` - if [ -f $ENB_LOG ] && [ -f $UE_LOG ] + ARCHIVES_LOC=archives/basic_sim/test + if [ -d $ARCHIVES_LOC ] + then + echo "

Basic Simulator Check

" >> ./test_simulator_results.html + + if [ -f $ARCHIVES_LOC/test_final_status.log ] + then + if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] then - NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` - NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` - echo " " >> ./test_simulator_results.html - echo " $NAME_ENB --- $NAME_UE" >> ./test_simulator_results.html - echo " N/A" >> ./test_simulator_results.html - NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` - NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` - NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG` - if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] - then - echo " OK" >> ./test_simulator_results.html - else - echo " KO" >> ./test_simulator_results.html - fi - echo "
" >> ./test_simulator_results.html
-                if [ $NB_ENB_GOT_SYNC -eq 1 ]
-                then
-                    echo "- eNB --> got sync" >> ./test_simulator_results.html
-                else
-                    echo "- eNB NEVER got sync" >> ./test_simulator_results.html
-                fi
-                if [ $NB_UE_GOT_SYNC -eq 2 ]
-                then
-                    echo "- UE --> got sync" >> ./test_simulator_results.html
-                else
-                    echo "- UE NEVER got sync" >> ./test_simulator_results.html
-                fi
-                if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
-                then
-                    echo "- UE attached to eNB" >> ./test_simulator_results.html
-                else
-                    echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
-                fi
-                NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
-                if [ $NB_SEGFAULT_ENB -ne 0 ]
-                then
-                    echo "- eNB --> Segmentation Fault" >> ./test_simulator_results.html
-                fi
-                NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
-                if [ $NB_SEGFAULT_UE -ne 0 ]
-                then
-                    echo "- UE --> Segmentation Fault" >> ./test_simulator_results.html
-                fi
-                NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
-                if [ $NB_ASSERTION_ENB -ne 0 ]
-                then
-                    echo "- eNB --> Assertion" >> ./test_simulator_results.html
-                    awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
-                fi
-                NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
-                if [ $NB_ASSERTION_UE -ne 0 ]
-                then
-                    echo "- eNB --> Assertion" >> ./test_simulator_results.html
-                    awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
-                fi
-                echo "        
" >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + else + echo "
" >> ./test_simulator_results.html + echo " TEST was a FAILURE! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html fi - PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt - if [ -f $PING_CASE ] - then - echo " " >> ./test_simulator_results.html - NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"` - echo " $NAME" >> ./test_simulator_results.html - CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"` - echo " $CMD" >> ./test_simulator_results.html - FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE` - if [ $FILE_COMPLETE -eq 0 ] + else + echo "
" >> ./test_simulator_results.html + echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + + TRANS_MODES=("fdd" "tdd") + BW_CASES=(05 10 20) + for TMODE in ${TRANS_MODES[@]} + do + for BW in ${BW_CASES[@]} + do + ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log + UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` + if [ -f $ENB_LOG ] && [ -f $UE_LOG ] then - echo " " >> ./test_simulator_results.html + NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html - else - NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"` - NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"` - if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ] + NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` + NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` + NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG` + if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] then echo " " >> ./test_simulator_results.html else echo " " >> ./test_simulator_results.html fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt + if [ -f $PING_CASE ] + then + echo " " >> ./test_simulator_results.html + NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"` + echo " " >> ./test_simulator_results.html + FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE` + if [ $FILE_COMPLETE -eq 0 ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + else + NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"` + NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"` + if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + + if [ -f $ARCHIVES_LOC/${TMODE}_${BW}*iperf*dl*client*txt ] + then + IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt` + else + echo "There are no iperf files" + IPERF_TESTS="" + fi + for IPERF_CASE in $IPERF_TESTS + do + echo " " >> ./test_simulator_results.html + NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"` + echo " " >> ./test_simulator_results.html + REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"` + if [[ $REQ_BITRATE =~ .*K.* ]] + then + REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"` + FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l` + fi + if [[ $REQ_BITRATE =~ .*M.* ]] + then + REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"` + FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l` + fi + if [[ $REQ_BITRATE =~ .*G.* ]] + then + REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"` + FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l` + fi + FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE` + if [ $FILE_COMPLETE -eq 0 ] + then + echo " " >> ./test_simulator_results.html + SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"` + FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'` + EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'` + PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'` + JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'` + PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'` + PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"` + else + EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"` + if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]] + then + EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"` + FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l` + fi + if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]] + then + EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"` + FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l` + fi + if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]] + then + EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"` + FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l` + fi + PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'` + PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'` + if [[ $PERF_INT -lt 90 ]] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"` + JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"` + PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"` + fi echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - fi - - if [ -f $ARCHIVES_LOC/${TMODE}_${BW}*iperf*dl*client*txt ] - then - IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt` - else - echo "There are no iperf files" - IPERF_TESTS="" - fi - for IPERF_CASE in $IPERF_TESTS - do - echo " " >> ./test_simulator_results.html - NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"` - echo " " >> ./test_simulator_results.html - CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"` - echo " " >> ./test_simulator_results.html - REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"` - if [[ $REQ_BITRATE =~ .*K.* ]] - then - REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"` - FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l` - fi - if [[ $REQ_BITRATE =~ .*M.* ]] - then - REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"` - FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l` - fi - if [[ $REQ_BITRATE =~ .*G.* ]] - then - REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"` - FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l` - fi - FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE` - if [ $FILE_COMPLETE -eq 0 ] - then - echo " " >> ./test_simulator_results.html - SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"` - FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'` - EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'` - PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'` - JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'` - PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'` - PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"` - else - EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"` - if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]] - then - EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"` - FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l` - fi - if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]] - then - EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"` - FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l` - fi - if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]] - then - EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"` - FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l` - fi - PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'` - PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'` - if [[ $PERF_INT -lt 90 ]] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"` - JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"` - PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"` - fi - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + done done done - done - echo "
Log File NameCommandStatusStatistics
KO
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
+                    if [ $NB_ENB_GOT_SYNC -eq 1 ]
+                    then
+                        echo "- eNB --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_UE_GOT_SYNC -eq 2 ]
+                    then
+                        echo "- UE --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
+                    then
+                        echo "- UE attached to eNB" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
+                    fi
+                    NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
+                    if [ $NB_SEGFAULT_ENB -ne 0 ]
+                    then
+                        echo "- eNB --> Segmentation Fault" >> ./test_simulator_results.html
+                    fi
+                    NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
+                    if [ $NB_SEGFAULT_UE -ne 0 ]
+                    then
+                        echo "- UE --> Segmentation Fault" >> ./test_simulator_results.html
+                    fi
+                    NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
+                    if [ $NB_ASSERTION_ENB -ne 0 ]
+                    then
+                        echo "- eNB --> Assertion" >> ./test_simulator_results.html
+                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
+                    fi
+                    NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
+                    if [ $NB_ASSERTION_UE -ne 0 ]
+                    then
+                        echo "- eNB --> Assertion" >> ./test_simulator_results.html
+                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
+                    fi
+                    echo "        
$NAME$CMDKON/AOKKO" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html
+                        STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
+                        echo "Packet Loss : $STATS" >> ./test_simulator_results.html
+                        RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
+                        echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
+                        RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
+                        echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
+                        RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
+                        echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
+                        echo "            
" >> ./test_simulator_results.html + echo "
$NAME$CMDKOKOOK" >> ./test_simulator_results.html echo "
" >> ./test_simulator_results.html
-                    STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
-                    echo "Packet Loss : $STATS" >> ./test_simulator_results.html
-                    RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
-                    echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
-                    RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
-                    echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
-                    RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
-                    echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
+                    echo "Bitrate      : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
+                    echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
+                    echo "Jitter       : $JITTER" >> ./test_simulator_results.html
+                    echo "Packet Loss  : $PACKETLOSS" >> ./test_simulator_results.html
                     echo "            
" >> ./test_simulator_results.html echo "
$NAME$CMDKOKOOK" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html
-                echo "Bitrate      : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
-                echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
-                echo "Jitter       : $JITTER" >> ./test_simulator_results.html
-                echo "Packet Loss  : $PACKETLOSS" >> ./test_simulator_results.html
-                echo "            
" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html -fi + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi -ARCHIVES_LOC=archives/phy_sim/test -if [ -d $ARCHIVES_LOC ] -then - echo "

Physical Simulators Check

" >> ./test_simulator_results.html - - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - - XML_TESTS=`ls $ARCHIVES_LOC/*xml` - for XML_FILE in $XML_TESTS - do - echo " " >> ./test_simulator_results.html - NAME=`echo $XML_FILE | sed -e "s#$ARCHIVES_LOC/##"` - NB_TESTS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*tests='##" -e "s#' *time=.*##"` - NB_ERRORS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*errors='##" -e "s#' *failures=.*##"` - NB_FAILURES=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*failures='##" -e "s#' *hostname=.*##"` - NB_SKIPPED=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*skipped='##" -e "s#' *tests=.*##"` - if [ $NB_ERRORS -eq 0 ] && [ $NB_FAILURES -eq 0 ] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - done - - echo "
Log File NameNb TestsNb ErrorsNb FailuresNb Failures
$NAME$NAME$NB_TESTS$NB_ERRORS$NB_FAILURES$NB_SKIPPED
" >> ./test_simulator_results.html - - echo "

Details

" >> ./test_simulator_results.html - for XML_FILE in $XML_TESTS - do + if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] + then + echo "

Basic Simulator + FlexRan Controller Check

" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html - TESTCASES_LIST=`sed -e "s# #@#g" $XML_FILE | grep testcase` - for TESTCASE in $TESTCASES_LIST + + FLEXRAN_QUERIES=`ls $ARCHIVES_LOC/flexran_ctl_query_*log` + for QUERY in $FLEXRAN_QUERIES do echo " " >> ./test_simulator_results.html - NAME=`echo $TESTCASE | sed -e "s#^.*name='##" -e "s#'@description=.*##" | sed -e "s#@# #g"` - echo " " >> ./test_simulator_results.html - DESC=`echo $TESTCASE | sed -e "s#^.*description='##" -e "s#'@Run_result=.*##" | sed -e "s#@# #g"` - echo " " >> ./test_simulator_results.html - RESULT=`echo $TESTCASE | sed -e "s#^.*RESULT='##" -e "s#'.*##" | sed -e "s#@# #g"` - if [[ $RESULT =~ .*PASS.* ]] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - TIME=`echo $TESTCASE | sed -e "s#^.*time='##" -e "s#'@RESULT=.*##" | sed -e "s#@# #g"` - echo " " >> ./test_simulator_results.html + NAME=`echo $QUERY | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html done echo "
Test NameDescriptionResultTimeLog File NameJSON Query Response
$NAME$DESC$RESULT$RESULT$TIME$NAME
" >> ./test_simulator_results.html
+            egrep -v "LOG_NAME|\-\-\-\-\-" $QUERY >> ./test_simulator_results.html
+            echo "        
" >> ./test_simulator_results.html - done -fi + echo "
" >> ./test_simulator_results.html + fi -echo "" >> ./test_simulator_results.html -echo "" >> ./test_simulator_results.html + ARCHIVES_LOC=archives/l2_sim/test + if [ -d $ARCHIVES_LOC ] + then + echo "

L2-NFAPI Simulator Check

" >> ./test_simulator_results.html -exit 0 + if [ -f $ARCHIVES_LOC/test_final_status.log ] + then + if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] + then + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + else + echo "
" >> ./test_simulator_results.html + echo " TEST was a FAILURE! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + else + echo "
" >> ./test_simulator_results.html + echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + + TRANS_MODES=("fdd") + BW_CASES=(05) + for TMODE in ${TRANS_MODES[@]} + do + for BW in ${BW_CASES[@]} + do + ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log + UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` + if [ -f $ENB_LOG ] && [ -f $UE_LOG ] + then + NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` + NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` + NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG` + if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 3 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_epc.txt + if [ -f $PING_CASE ] + then + echo " " >> ./test_simulator_results.html + NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"` + echo " " >> ./test_simulator_results.html + FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE` + if [ $FILE_COMPLETE -eq 0 ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + else + NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"` + NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"` + if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + fi + + done + done + + echo "
Log File NameCommandStatusStatistics
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
+                    if [ $NB_ENB_GOT_SYNC -eq 1 ]
+                    then
+                        echo "- eNB --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_UE_GOT_SYNC -eq 3 ]
+                    then
+                        echo "- UE --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
+                    then
+                        echo "- UE attached to eNB" >> ./test_simulator_results.html
+                    else
+                        echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
+                    fi
+                    echo "        
$NAME$CMDKON/AOKKO" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html
+                        STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
+                        echo "Packet Loss : $STATS" >> ./test_simulator_results.html
+                        RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
+                        echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
+                        RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
+                        echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
+                        RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
+                        echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
+                        echo "            
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + ARCHIVES_LOC=archives/phy_sim/test + if [ -d $ARCHIVES_LOC ] + then + echo "

Physical Simulators Check

" >> ./test_simulator_results.html + + if [ -f $ARCHIVES_LOC/test_final_status.log ] + then + if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] + then + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + else + echo "
" >> ./test_simulator_results.html + echo " TEST was a FAILURE! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + else + echo "
" >> ./test_simulator_results.html + echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + + XML_TESTS=`ls $ARCHIVES_LOC/*xml` + for XML_FILE in $XML_TESTS + do + echo " " >> ./test_simulator_results.html + NAME=`echo $XML_FILE | sed -e "s#$ARCHIVES_LOC/##"` + NB_TESTS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*tests='##" -e "s#' *time=.*##"` + NB_ERRORS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*errors='##" -e "s#' *failures=.*##"` + NB_FAILURES=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*failures='##" -e "s#' *hostname=.*##"` + NB_SKIPPED=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*skipped='##" -e "s#' *tests=.*##"` + if [ $NB_ERRORS -eq 0 ] && [ $NB_FAILURES -eq 0 ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + done + + echo "
Log File NameNb TestsNb ErrorsNb FailuresNb Failures
$NAME$NAME$NB_TESTS$NB_ERRORS$NB_FAILURES$NB_SKIPPED
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + + echo "

Details

" >> ./test_simulator_results.html + for XML_FILE in $XML_TESTS + do + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + PREV_SECTION=0 + PREV_TIME_IN_SECS=0 + TESTCASES_LIST=`sed -e "s# #@#g" $XML_FILE | grep testcase` + for TESTCASE in $TESTCASES_LIST + do + NAME=`echo $TESTCASE | sed -e "s#^.*name='##" -e "s#'@description=.*##" | sed -e "s#@# #g"` + SECTION=`echo $NAME | sed -e "s#\..*##"` + if [ $SECTION != $PREV_SECTION ] + then + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + PREV_SECTION=$SECTION + PREV_TIME_IN_SECS=0 + fi + DESC=`echo $TESTCASE | sed -e "s#^.*description='##" -e "s#'@Run_result=.*##" | sed -e "s#@# #g"` + RESULT=`echo $TESTCASE | sed -e "s#^.*RESULT='##" -e "s#'.*##" | sed -e "s#@# #g"` + TIME_IN_SECS=`echo $TESTCASE | sed -e "s#^.*time='##" -e "s#'@RESULT=.*##" | sed -e "s#@# #g" -e "s# s.*##"` + TIME=`echo "$TIME_IN_SECS - $PREV_TIME_IN_SECS" | bc -l | awk '{printf "%.2f s", $0}'` + PREV_TIME_IN_SECS=$TIME_IN_SECS + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + if [[ $RESULT =~ .*PASS.* ]] + then + echo " " >> ./test_simulator_results.html + else + SPLITTED_LINE=`echo -e $TESTCASE | sed -e "s#@#\n#g"` + NB_RUNS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "Run_"` + NB_FAILS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "=FAIL"` + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + done + echo "
Test NameDescriptionResultTime
\"$SECTION\" series
$NAME$DESC$RESULT${RESULT} (${NB_FAILS}/${NB_RUNS})$TIME
" >> ./test_simulator_results.html + done + fi + + echo "
" >> ./test_simulator_results.html + echo "

" >> ./test_simulator_results.html + echo "
End of Test Report -- Copyright 2018 OpenAirInterface. All Rights Reserved.
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "" >> ./test_simulator_results.html +} diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index efdfcec3e0..7ff04e23f8 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -20,15 +20,18 @@ # * contact@openairinterface.org # */ -function usage { - echo "OAI VM Test Run script" +function run_test_usage { + echo "OAI CI VM script" echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" + echo " -- xenial image already synced" echo " Default:" echo " -- eNB with USRP" echo "" echo "Usage:" echo "------" - echo " runTestOnVM.sh [OPTIONS]" + echo " oai-ci-vm-tool test [OPTIONS]" echo "" echo "Options:" echo "--------" @@ -41,12 +44,7 @@ function usage { echo " --workspace #### OR -ws ####" echo " Specify the workspace." echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" + variant_usage echo " Specify the variant to build." echo "" echo " --keep-vm-alive OR -k" @@ -57,25 +55,13 @@ function usage { echo "" } -function variant_usage { - echo "OAI VM Test Run script" - echo " Original Author: Raphael Defosseux" - echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" - echo " --variant enb-ethernet OR -v7" - echo " --variant ue-ethernet OR -v8" - echo "" -} - function start_basic_sim_enb { local LOC_VM_IP_ADDR=$2 local LOC_EPC_IP_ADDR=$3 local LOC_LOG_FILE=$4 local LOC_NB_RBS=$5 local LOC_CONF_FILE=$6 + local LOC_FLEXRAN_CTL_IP_ADRR=$7 echo "cd /home/ubuntu/tmp" > $1 echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1 echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 @@ -86,13 +72,22 @@ function start_basic_sim_enb { echo "cd ci-scripts/conf_files/" >> $1 echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1 echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1 + if [[ $LOC_FLEXRAN_CTL_IP_ADRR =~ .*none.* ]] + then + echo "sed -i -e 's#CI_FLEXRAN_CTL_IP_ADDR#127.0.0.1#' ci-$LOC_CONF_FILE" >> $1 + else + echo "sed -i -e 's#FLEXRAN_ENABLED = .*no.*;#FLEXRAN_ENABLED = \"yes\";#' -e 's#CI_FLEXRAN_CTL_IP_ADDR#$LOC_FLEXRAN_CTL_IP_ADRR#' ci-$LOC_CONF_FILE" >> $1 + fi echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1 echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1 echo "echo \"cd /home/ubuntu/tmp/cmake_targets/basic_simulator/enb/\"" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/basic_simulator" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/basic_simulator/enb/" >> $1 echo "cd /home/ubuntu/tmp/cmake_targets/basic_simulator/enb/" >> $1 echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1 echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 echo "cat ./my-lte-softmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/enb -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 @@ -105,10 +100,12 @@ function start_basic_sim_ue { local LOC_NB_RBS=$4 local LOC_FREQUENCY=$5 echo "echo \"cd /home/ubuntu/tmp/cmake_targets/basic_simulator/ue\"" > $1 - echo "cd /home/ubuntu/tmp/cmake_targets/basic_simulator/ue" > $1 + echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/basic_simulator/ue" >> $1 + echo "cd /home/ubuntu/tmp/cmake_targets/basic_simulator/ue" >> $1 echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --ue-rxgain 140\" > ./my-lte-uesoftmodem-run.sh" >> $1 echo "chmod 775 ./my-lte-uesoftmodem-run.sh" >> $1 echo "cat ./my-lte-uesoftmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE; fi" >> $1 echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/ue -o /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ./my-lte-uesoftmodem-run.sh" >> $1 ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 @@ -151,6 +148,15 @@ function ping_ue_ip_addr { rm -f $1 } +function ping_epc_ip_addr { + echo "echo \"COMMAND IS: ping -I oip1 -c 20 $3\" > $4" > $1 + echo "rm -f $4" >> $1 + echo "ping -I oip1 -c 20 $3 | tee -a $4" >> $1 + cat $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm -f $1 +} + function check_ping_result { local LOC_PING_FILE=$1 local LOC_NB_PINGS=$2 @@ -160,16 +166,19 @@ function check_ping_result { if [ $FILE_COMPLETE -eq 0 ] then PING_STATUS=-1 + echo "ping file incomplete" else local ALL_PACKET_RECEIVED=`egrep -c "$LOC_NB_PINGS received" $LOC_PING_FILE` if [ $ALL_PACKET_RECEIVED -eq 1 ] then echo "got all ping packets" else + echo "got NOT all ping packets" PING_STATUS=-1 fi fi else + echo "ping file not present" PING_STATUS=-1 fi } @@ -283,276 +292,10 @@ function recover_core_dump { fi } -function terminate_ltebox_epc { - echo "echo \"cd /opt/ltebox/tools\"" > $1 - echo "cd /opt/ltebox/tools" >> $1 - echo "echo \"sudo ./stop_ltebox\"" >> $1 - echo "sudo ./stop_ltebox" >> $1 - echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1 - echo "sudo daemon --name=simulated_hss --stop" >> $1 - echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1 - echo "sudo killall --signal SIGKILL hss_sim" >> $1 - ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 -} +function install_epc_on_vm { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 -if [ $# -lt 1 ] || [ $# -gt 9 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi - -VM_TEMPLATE=ci- -JOB_NAME=XX -BUILD_ID=XX -VM_NAME=ci-enb-usrp -ARCHIVES_LOC=enb_usrp/test -KEEP_VM_ALIVE=0 -RUN_OPTIONS="none" -STATUS=0 - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - -ws|--workspace) - JENKINS_WKSP="$2" - shift - shift - ;; - -k|--keep-vm-alive) - KEEP_VM_ALIVE=1 - shift - ;; - -v1) - VM_NAME=ci-enb-usrp - shift - ;; - -v2) - VM_NAME=ci-basic-sim - RUN_OPTIONS="complex" - ARCHIVES_LOC=basic_sim/test - shift - ;; - -v3) - VM_NAME=ci-phy-sim - RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" - ARCHIVES_LOC=phy_sim/test - shift - ;; - -v4) - VM_NAME=ci-cppcheck - shift - ;; - -v7) - VM_NAME=ci-enb-ethernet - shift - ;; - -v8) - VM_NAME=ci-ue-ethernet - shift - ;; - --variant) - variant="$2" - case $variant in - enb-usrp) - VM_NAME=ci-enb-usrp - ;; - basic-sim) - VM_NAME=ci-basic-sim - RUN_OPTIONS="complex" - ARCHIVES_LOC=basic_sim/test - ;; - phy-sim) - VM_NAME=ci-phy-sim - RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" - ARCHIVES_LOC=phy_sim/test - ;; - cppcheck) - VM_NAME=ci-cppcheck - ;; - enb-ethernet) - VM_NAME=ci-enb-ethernet - ;; - ue-ethernet) - VM_NAME=ci-ue-ethernet - ;; - *) - echo "" - echo "Syntax Error: Invalid Variant option -> $variant" - echo "" - variant_usage - exit 1 - esac - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] -then - VM_TEMPLATE=ci- -else - VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- -fi - -VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` -VM_CMDS=${VM_NAME}_cmds.txt -ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} - -echo "VM_NAME = $VM_NAME" -echo "VM_CMD_FILE = $VM_CMDS" -echo "JENKINS_WKSP = $JENKINS_WKSP" -echo "ARCHIVES_LOC = $ARCHIVES_LOC" - -echo "############################################################" -echo "Waiting for VM to be started" -echo "############################################################" -uvt-kvm wait $VM_NAME --insecure - -VM_IP_ADDR=`uvt-kvm ip $VM_NAME` -echo "$VM_NAME has for IP addr = $VM_IP_ADDR" - -if [ "$RUN_OPTIONS" == "none" ] -then - echo "No run on VM testing for this variant currently" - exit $STATUS -fi - -if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]] -then - echo "############################################################" - echo "Running test script on VM ($VM_NAME)" - echo "############################################################" - echo "echo \"sudo apt-get --yes --quiet install bc \"" > $VM_CMDS - echo "sudo apt-get update > bc-install.txt 2>&1" >> $VM_CMDS - echo "sudo apt-get --yes install bc >> bc-install.txt 2>&1" >> $VM_CMDS - echo "cd tmp" >> $VM_CMDS - echo "echo \"source oaienv\"" >> $VM_CMDS - echo "source oaienv" >> $VM_CMDS - echo "echo \"cd cmake_targets/autotests\"" >> $VM_CMDS - echo "cd cmake_targets/autotests" >> $VM_CMDS - echo "echo \"rm -Rf log\"" >> $VM_CMDS - echo "rm -Rf log" >> $VM_CMDS - echo "$RUN_OPTIONS" | sed -e 's@"@\\"@g' -e 's@^@echo "@' -e 's@$@"@' >> $VM_CMDS - echo "$RUN_OPTIONS" >> $VM_CMDS - echo "cp /home/ubuntu/bc-install.txt log" >> $VM_CMDS - echo "cd log" >> $VM_CMDS - echo "zip -r -qq tmp.zip *.* 0*" >> $VM_CMDS - - ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS - - echo "############################################################" - echo "Creating a tmp folder to store results and artifacts" - echo "############################################################" - - if [ -d $ARCHIVES_LOC ] - then - rm -Rf $ARCHIVES_LOC - fi - mkdir --parents $ARCHIVES_LOC - - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/autotests/log/tmp.zip $ARCHIVES_LOC - pushd $ARCHIVES_LOC - unzip -qq -DD tmp.zip - rm tmp.zip - if [ -f results_autotests.xml ] - then - FUNCTION=`echo $VM_NAME | sed -e "s@$VM_TEMPLATE@@"` - NEW_NAME=`echo "results_autotests.xml" | sed -e "s@results_autotests@results_autotests-$FUNCTION@"` - echo "" > $NEW_NAME - echo "" >> $NEW_NAME - cat results_autotests.xml >> $NEW_NAME - sed -e "s@TEMPLATE@$FUNCTION@" $JENKINS_WKSP/ci-scripts/template.xsl > $FUNCTION.xsl - #mv results_autotests.xml $NEW_NAME - rm results_autotests.xml - fi - popd - - if [ $KEEP_VM_ALIVE -eq 0 ] - then - echo "############################################################" - echo "Destroying VM" - echo "############################################################" - uvt-kvm destroy $VM_NAME - ssh-keygen -R $VM_IP_ADDR - fi - rm -f $VM_CMDS - - echo "############################################################" - echo "Checking run status" - echo "############################################################" - - LOG_FILES=`ls $ARCHIVES_LOC/results_autotests*.xml` - NB_FOUND_FILES=0 - NB_RUNS=0 - NB_FAILURES=0 - - for FULLFILE in $LOG_FILES - do - TESTSUITES=`egrep "testsuite errors" $FULLFILE` - for TESTSUITE in $TESTSUITES - do - if [[ "$TESTSUITE" == *"tests="* ]] - then - RUNS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` - NB_RUNS=$((NB_RUNS + RUNS)) - fi - if [[ "$TESTSUITE" == *"failures="* ]] - then - FAILS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` - NB_FAILURES=$((NB_FAILURES + FAILS)) - fi - done - NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) - done - - echo "NB_FOUND_FILES = $NB_FOUND_FILES" - echo "NB_RUNS = $NB_RUNS" - echo "NB_FAILURES = $NB_FAILURES" - - if [ $NB_FOUND_FILES -eq 0 ]; then STATUS=-1; fi - if [ $NB_RUNS -eq 0 ]; then STATUS=-1; fi - if [ $NB_FAILURES -ne 0 ]; then STATUS=-1; fi - -fi - -if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-basic-sim.* ]] -then - PING_STATUS=0 - IPERF_STATUS=0 - if [ -d $ARCHIVES_LOC ] - then - rm -Rf $ARCHIVES_LOC - fi - mkdir --parents $ARCHIVES_LOC - - EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"` - LTEBOX=0 if [ -d /opt/ltebox-archives/ ] then # Checking if all ltebox archives are available to run ltebx epc on a brand new VM @@ -567,28 +310,27 @@ then # Here we could have other types of EPC detection # Do we need to start the EPC VM - EPC_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#epc-cmds#"` - echo "EPC_VM_CMD_FILE = $EPC_VM_CMDS" - IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $EPC_VM_NAME` + echo "EPC_VM_CMD_FILE = $LOC_EPC_VM_CMDS" + IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $LOC_EPC_VM_NAME` if [ $IS_EPC_VM_ALIVE -eq 0 ] then echo "############################################################" - echo "Creating test EPC VM ($EPC_VM_NAME) on Ubuntu Cloud Image base" + echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base" echo "############################################################" - uvt-kvm create $EPC_VM_NAME release=xenial --unsafe-caching + uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching fi - uvt-kvm wait $EPC_VM_NAME --insecure - EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` - echo "$EPC_VM_NAME has for IP addr = $EPC_VM_IP_ADDR" - scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu + uvt-kvm wait $LOC_EPC_VM_NAME --insecure + local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME` + echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR" + scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu # ltebox specific actions (install and start) LTE_BOX_TO_INSTALL=1 if [ $LTEBOX -eq 1 ] then - echo "ls -ls /opt/ltebox/tools/start_ltebox" > $EPC_VM_CMDS - RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` + echo "ls -ls /opt/ltebox/tools/start_ltebox" > $LOC_EPC_VM_CMDS + RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` NB_EXES=`echo $RESPONSE | grep -c ltebox` if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi fi @@ -596,61 +338,429 @@ then if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ] then echo "############################################################" - echo "Copying ltebox archives into EPC VM ($EPC_VM_NAME)" + echo "Copying ltebox archives into EPC VM ($LOC_EPC_VM_NAME)" echo "############################################################" - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu echo "############################################################" - echo "Install EPC on EPC VM ($EPC_VM_NAME)" + echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)" echo "############################################################" - echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $EPC_VM_CMDS - echo "touch /home/ubuntu/.hushlogin" >> $EPC_VM_CMDS - echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $EPC_VM_CMDS - echo "sudo apt-get update > zip-install.txt 2>&1" >> $EPC_VM_CMDS - echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $EPC_VM_CMDS + echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS + echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS + echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS # Installing HSS - echo "echo \"cd /opt\"" >> $EPC_VM_CMDS - echo "cd /opt" >> $EPC_VM_CMDS - echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $EPC_VM_CMDS - echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $EPC_VM_CMDS - echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS - echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS + echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $LOC_EPC_VM_CMDS + echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $LOC_EPC_VM_CMDS + echo "echo \"cd /opt/hss_sim0609\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS # Installing ltebox - echo "echo \"cd /home/ubuntu\"" >> $EPC_VM_CMDS - echo "cd /home/ubuntu" >> $EPC_VM_CMDS - echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $EPC_VM_CMDS - echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $EPC_VM_CMDS + echo "echo \"cd /home/ubuntu\"" >> $LOC_EPC_VM_CMDS + echo "cd /home/ubuntu" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $LOC_EPC_VM_CMDS + echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS - echo "echo \"cd /opt/ltebox/etc/\"" >> $EPC_VM_CMDS - echo "cd /opt/ltebox/etc/" >> $EPC_VM_CMDS - echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $EPC_VM_CMDS - echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $EPC_VM_CMDS - echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' gw.conf" >> $EPC_VM_CMDS - echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' mme.conf" >> $EPC_VM_CMDS + echo "echo \"cd /opt/ltebox/etc/\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/ltebox/etc/" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $LOC_EPC_VM_CMDS + echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $LOC_EPC_VM_CMDS + echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' gw.conf" >> $LOC_EPC_VM_CMDS + echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' mme.conf" >> $LOC_EPC_VM_CMDS + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS + rm -f $LOC_EPC_VM_CMDS fi +} + +function start_epc { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 + local LOC_EPC_VM_IP_ADDR=$3 - # Starting EPC if [ $LTEBOX -eq 1 ] then echo "############################################################" - echo "Start EPC on EPC VM ($EPC_VM_NAME)" + echo "Start EPC on EPC VM ($LOC_EPC_VM_NAME)" echo "############################################################" - echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS - echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS - echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $EPC_VM_CMDS - echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $EPC_VM_CMDS + echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS + echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS + echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS - echo "echo \"cd /opt/ltebox/tools/\"" >> $EPC_VM_CMDS - echo "cd /opt/ltebox/tools/" >> $EPC_VM_CMDS - echo "echo \"sudo ./start_ltebox\"" >> $EPC_VM_CMDS - echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $EPC_VM_CMDS + echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo ./start_ltebox\"" >> $LOC_EPC_VM_CMDS + echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $LOC_EPC_VM_CMDS - ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS - rm -f $EPC_VM_CMDS + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS + rm -f $LOC_EPC_VM_CMDS + + i="0" + echo "ifconfig tun5 | egrep -c \"inet addr\"" > $LOC_EPC_VM_CMDS + while [ $i -lt 10 ] + do + sleep 2 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $LOC_EPC_VM_CMDS + if [ $i -lt 50 ] + then + echo "Problem w/ starting ltebox EPC" + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + fi + + # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC + +} + +function retrieve_real_epc_ip_addr { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 + local LOC_EPC_VM_IP_ADDR=$3 + + if [ $LTEBOX -eq 1 ] + then + # in our configuration file, we are using pool 5 + echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS + REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` + echo "EPC IP Address is : $REAL_EPC_IP_ADDR" + rm $LOC_EPC_VM_CMDS + fi +} + +function terminate_epc { + if [ $LTEBOX -eq 1 ] + then + echo "echo \"cd /opt/ltebox/tools\"" > $1 + echo "cd /opt/ltebox/tools" >> $1 + echo "echo \"sudo ./stop_ltebox\"" >> $1 + echo "sudo ./stop_ltebox" >> $1 + echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1 + echo "sudo daemon --name=simulated_hss --stop" >> $1 + echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1 + echo "sudo killall --signal SIGKILL hss_sim" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm $1 + fi +} + +function start_flexran_ctrl { + echo "cd /home/ubuntu/tmp" > $1 + echo "if [ -f cmake_targets/log/flexran_ctl_run.log ]; then rm -f cmake_targets/log/flexran_ctl_run.log cmake_targets/log/flexran_ctl_query*.log; fi" >> $1 + echo "echo \" sudo build/rt_controller -c log_config/basic_log\"" >> $1 + echo "nohup sudo build/rt_controller -c log_config/basic_log > cmake_targets/log/flexran_ctl_run.log 2>&1 &" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm $1 + sleep 10 +} + +function stop_flexran_ctrl { + echo "echo \"sudo killall --signal SIGKILL rt_controller\"" > $1 + echo "sudo killall --signal SIGKILL rt_controller" > $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm $1 + sleep 2 +} + +function query_flexran_ctrl_status { + local LOC_MESSAGE=$3 + echo "cd /home/ubuntu/tmp" > $1 + echo "echo \"------------------------------------------------------------\" > cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 + echo "echo \"LOG_NAME: $LOC_MESSAGE\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 + echo "echo \"------------------------------------------------------------\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 + echo "curl http://localhost:9999/stats | jq '.' | tee -a cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm $1 +} + +function build_ue_on_separate_folder { + echo "mkdir tmp-ue" > $1 + echo "cd tmp-ue" >> $1 + echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $1 + echo "unzip -qq -DD ../localZip.zip" >> $1 + + # We may have some adaptation to do + if [ -f /opt/ltebox-archives/adapt_ue_l2_sim.txt ] + then + echo "############################################################" + echo "Doing some adaptation on UE side" + echo "############################################################" + cat /opt/ltebox-archives/adapt_ue_l2_sim.txt >> $1 + fi + + echo "echo \"source oaienv\"" >> $1 + echo "source oaienv" >> $1 + echo "cd cmake_targets/" >> $1 + echo "mkdir log" >> $1 + echo "chmod 777 log" >> $1 + echo "echo \"./build_oai --UE -t ETHERNET \"" >> $1 + echo "./build_oai --UE -t ETHERNET > log/ue-build.txt 2>&1" >> $1 + echo "cd tools" >> $1 + echo "sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up" >> $1 + echo "sudo chmod 666 /etc/iproute2/rt_tables" >> $1 + echo "source init_nas_s1 UE" >> $1 + echo "ifconfig" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm -f $1 +} + +function start_l2_sim_enb { + local LOC_VM_IP_ADDR=$2 + local LOC_EPC_IP_ADDR=$3 + local LOC_LOG_FILE=$4 + local LOC_NB_RBS=$5 + local LOC_CONF_FILE=$6 + echo "cd /home/ubuntu/tmp" > $1 + echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1 + echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 + echo "echo \"source oaienv\"" >> $1 + echo "source oaienv" >> $1 + echo "cd ci-scripts/conf_files/" >> $1 + echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1 + echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1 + echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1 + echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1 + echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1 + echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1 + echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1 + echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 + echo "cat ./my-lte-softmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 + echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 + rm $1 + + local i="0" + echo "egrep -c \"Waiting for PHY_config_req\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 + while [ $i -lt 10 ] + do + sleep 5 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` + if [ $CONNECTED -ne 0 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $1 + if [ $i -lt 50 ] + then + ENB_SYNC=0 + echo "L2-SIM eNB is NOT sync'ed: process still alive?" + else + ENB_SYNC=1 + echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect" + fi +} + +function start_l2_sim_ue { + local LOC_VM_IP_ADDR=$2 + local LOC_LOG_FILE=$3 + local LOC_CONF_FILE=$4 + echo "echo \"cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/\"" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1 + echo "cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1 + echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp-ue/ci-scripts/conf_files/$LOC_CONF_FILE --L2-emul 3 --num-ues 1\" > ./my-lte-softmodem-run.sh " >> $1 + echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 + echo "cat ./my-lte-softmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 + echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 + rm $1 + + local i="0" + echo "egrep -c \"Received NFAPI_START_REQ\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 + while [ $i -lt 10 ] + do + sleep 5 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $1 + if [ $i -lt 50 ] + then + UE_SYNC=0 + echo "L2-SIM UE is NOT sync'ed w/eNB" + else + UE_SYNC=1 + echo "L2-SIM UE is sync'ed w/eNB" + fi + sleep 10 +} + +function run_test_on_vm { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" + echo "VM_NAME = $VM_NAME" + echo "VM_CMD_FILE = $VM_CMDS" + echo "JENKINS_WKSP = $JENKINS_WKSP" + echo "ARCHIVES_LOC = $ARCHIVES_LOC" + + echo "############################################################" + echo "Waiting for VM to be started" + echo "############################################################" + uvt-kvm wait $VM_NAME --insecure + + VM_IP_ADDR=`uvt-kvm ip $VM_NAME` + echo "$VM_NAME has for IP addr = $VM_IP_ADDR" + + if [ "$RUN_OPTIONS" == "none" ] + then + echo "No run on VM testing for this variant currently" + exit $STATUS + fi + + if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]] + then + echo "############################################################" + echo "Running test script on VM ($VM_NAME)" + echo "############################################################" + echo "echo \"sudo apt-get --yes --quiet install bc \"" > $VM_CMDS + echo "sudo apt-get update > bc-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install bc >> bc-install.txt 2>&1" >> $VM_CMDS + echo "cd tmp" >> $VM_CMDS + echo "echo \"source oaienv\"" >> $VM_CMDS + echo "source oaienv" >> $VM_CMDS + echo "echo \"cd cmake_targets/autotests\"" >> $VM_CMDS + echo "cd cmake_targets/autotests" >> $VM_CMDS + echo "echo \"rm -Rf log\"" >> $VM_CMDS + echo "rm -Rf log" >> $VM_CMDS + echo "$RUN_OPTIONS" | sed -e 's@"@\\"@g' -e 's@^@echo "@' -e 's@$@"@' >> $VM_CMDS + echo "$RUN_OPTIONS" >> $VM_CMDS + echo "cp /home/ubuntu/bc-install.txt log" >> $VM_CMDS + echo "cd log" >> $VM_CMDS + echo "zip -r -qq tmp.zip *.* 0*" >> $VM_CMDS + + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + + echo "############################################################" + echo "Creating a tmp folder to store results and artifacts" + echo "############################################################" + + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC + + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/autotests/log/tmp.zip $ARCHIVES_LOC + pushd $ARCHIVES_LOC + unzip -qq -DD tmp.zip + rm tmp.zip + if [ -f results_autotests.xml ] + then + FUNCTION=`echo $VM_NAME | sed -e "s@$VM_TEMPLATE@@"` + NEW_NAME=`echo "results_autotests.xml" | sed -e "s@results_autotests@results_autotests-$FUNCTION@"` + echo "" > $NEW_NAME + echo "" >> $NEW_NAME + cat results_autotests.xml >> $NEW_NAME + sed -e "s@TEMPLATE@$FUNCTION@" $JENKINS_WKSP/ci-scripts/template.xsl > $FUNCTION.xsl + #mv results_autotests.xml $NEW_NAME + rm results_autotests.xml + fi + popd + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VM" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + fi + rm -f $VM_CMDS + + echo "############################################################" + echo "Checking run status" + echo "############################################################" + + LOG_FILES=`ls $ARCHIVES_LOC/results_autotests*.xml` + NB_FOUND_FILES=0 + NB_RUNS=0 + NB_FAILURES=0 + + for FULLFILE in $LOG_FILES + do + TESTSUITES=`egrep "testsuite errors" $FULLFILE` + for TESTSUITE in $TESTSUITES + do + if [[ "$TESTSUITE" == *"tests="* ]] + then + RUNS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` + NB_RUNS=$((NB_RUNS + RUNS)) + fi + if [[ "$TESTSUITE" == *"failures="* ]] + then + FAILS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` + NB_FAILURES=$((NB_FAILURES + FAILS)) + fi + done + NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) + done + + echo "NB_FOUND_FILES = $NB_FOUND_FILES" + echo "NB_RUNS = $NB_RUNS" + echo "NB_FAILURES = $NB_FAILURES" + + if [ $NB_FOUND_FILES -eq 0 ]; then STATUS=-1; fi + if [ $NB_RUNS -eq 0 ]; then STATUS=-1; fi + if [ $NB_FAILURES -ne 0 ]; then STATUS=-1; fi + + if [ $STATUS -eq 0 ] + then + echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + else + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + fi + fi + + if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-basic-sim.* ]] + then + PING_STATUS=0 + IPERF_STATUS=0 + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC + + # Creating a VM for EPC and installing SW + EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"` + EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt + LTEBOX=0 + install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS + EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` + + # Starting EPC + start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR + + # Retrieve EPC real IP address + retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR # We may have some adaptation to do if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ] @@ -661,371 +771,542 @@ then ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt fi - i="0" - echo "ifconfig tun5 | egrep -c \"inet addr\"" > $EPC_VM_CMDS - while [ $i -lt 10 ] - do - sleep 2 - CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` - if [ $CONNECTED -eq 1 ] - then - i="100" - else - i=$[$i+1] - fi - done - rm $EPC_VM_CMDS - if [ $i -lt 50 ] + echo "############################################################" + echo "Starting the eNB in FDD-5MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf none + + echo "############################################################" + echo "Starting the UE in FDD-5MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680 + if [ $UE_SYNC -eq 0 ] then - echo "Problem w/ starting ltebox EPC" + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi - fi + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR - # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC + echo "############################################################" + echo "Pinging the UE" + echo "############################################################" + PING_LOG_FILE=fdd_05MHz_ping_ue.txt + ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - # Retrieve EPC real IP address - if [ $LTEBOX -eq 1 ] - then - # in our configuration file, we are using pool 5 - echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $EPC_VM_CMDS - REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` - echo "EPC IP Address is : $REAL_EPC_IP_ADDR" - rm $EPC_VM_CMDS - fi + echo "############################################################" + echo "Iperf DL" + echo "############################################################" + CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_dl + iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 - echo "############################################################" - echo "Starting the eNB in FDD-5MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf + echo "############################################################" + echo "Iperf UL" + echo "############################################################" + CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_ul + iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2 - echo "############################################################" - echo "Starting the UE in FDD-5MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - exit -1 - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + sleep 10 - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=fdd_05MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + echo "############################################################" + echo "Starting the eNB in FDD-10MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_10MHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-fdd-basic-sim.conf none - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_dl - iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 + echo "############################################################" + echo "Starting the UE in FDD-10MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_10MHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2680 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR - echo "############################################################" - echo "Iperf UL" - echo "############################################################" - CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_ul - iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2 + echo "############################################################" + echo "Pinging the UE" + echo "############################################################" + PING_LOG_FILE=fdd_10MHz_ping_ue.txt + ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + echo "############################################################" + echo "Iperf DL" + echo "############################################################" + CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_dl + iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 - echo "############################################################" - echo "Starting the eNB in FDD-10MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=fdd_10MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-fdd-basic-sim.conf + echo "############################################################" + echo "Iperf UL" + echo "############################################################" + CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_ul + iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2 - echo "############################################################" - echo "Starting the UE in FDD-10MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=fdd_10MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2680 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - exit -1 - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + sleep 10 - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=fdd_10MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + echo "############################################################" + echo "Starting the eNB in FDD-20MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_20MHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-fdd-basic-sim.conf none - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_dl - iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 + echo "############################################################" + echo "Starting the UE in FDD-20MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_20MHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2680 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR - echo "############################################################" - echo "Iperf UL" - echo "############################################################" - CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_ul - iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2 + echo "############################################################" + echo "Pinging the UE" + echo "############################################################" + PING_LOG_FILE=fdd_20MHz_ping_ue.txt + ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + echo "############################################################" + echo "Iperf DL" + echo "############################################################" + CURR_IPERF_LOG_BASE=fdd_20MHz_iperf_dl + iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 - echo "############################################################" - echo "Starting the eNB in FDD-20MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=fdd_20MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-fdd-basic-sim.conf - - echo "############################################################" - echo "Starting the UE in FDD-20MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=fdd_20MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2680 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - exit -1 - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + sleep 10 - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=fdd_20MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + if [ -d $JENKINS_WKSP/flexran ] + then + echo "############################################################" + echo "Flexran testing is possible" + echo "############################################################" + local j="0" + while [ $j -lt 20 ] + do + if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] + then + echo "Found an proper flexran controller vm build" + j="100" + else + j=$[$j+1] + sleep 30 + fi + done + if [ $j -lt 50 ] + then + echo "ERROR: compiling flexran controller on vm went wrong" + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + FLEXRAN_CTL_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#flexran-rtc#"` + FLEXRAN_CTL_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#flexran-rtc-cmds#"` + IS_FLEXRAN_VM_ALIVE=`uvt-kvm list | grep -c $FLEXRAN_CTL_VM_NAME` + if [ $IS_FLEXRAN_VM_ALIVE -eq 0 ] + then + echo "ERROR: Flexran Ctl VM is not alive" + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + uvt-kvm wait $FLEXRAN_CTL_VM_NAME --insecure + FLEXRAN_CTL_VM_IP_ADDR=`uvt-kvm ip $FLEXRAN_CTL_VM_NAME` - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - CURR_IPERF_LOG_BASE=fdd_20MHz_iperf_dl - iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15 + echo "$FLEXRAN_CTL_VM_NAME has for IP addr = $FLEXRAN_CTL_VM_IP_ADDR" + echo "FLEXRAN_CTL_VM_CMDS = $FLEXRAN_CTL_VM_CMDS" + echo "############################################################" + echo "Starting the FLEXRAN CONTROLLER" + echo "############################################################" + start_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR + query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 01_no_enb_connected - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + echo "############################################################" + echo "Starting the eNB in FDD-5MHz mode with Flexran ON" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_05fMHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf $FLEXRAN_CTL_VM_IP_ADDR + query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 02_enb_connected - echo "############################################################" - echo "Starting the eNB in TDD-5MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=tdd_05MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-tdd-basic-sim.conf + echo "############################################################" + echo "Starting the UE in FDD-5MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_05fMHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 03_enb_ue_connected + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR - echo "############################################################" - echo "Starting the UE in TDD-5MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=tdd_05MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2350 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" + sleep 30 + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + sleep 10 + + echo "############################################################" + echo "Stopping the FLEXRAN CONTROLLER" + echo "############################################################" + stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$FLEXRAN_CTL_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/flexran_ctl_*.log $ARCHIVES_LOC + fi + + echo "############################################################" + echo "Starting the eNB in TDD-5MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=tdd_05MHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-tdd-basic-sim.conf none + + echo "############################################################" + echo "Starting the UE in TDD-5MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=tdd_05MHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2350 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + + echo "############################################################" + echo "Pinging the UE" + echo "############################################################" + PING_LOG_FILE=tdd_05MHz_ping_ue.txt + ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + +# Bug in TDD 5Mhz --- not running it +# echo "############################################################" +# echo "Iperf DL" +# echo "############################################################" +# CURR_IPERF_LOG_BASE=tdd_05MHz_iperf_dl +# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE +# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC +# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC +# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 + + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - exit -1 - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + sleep 10 - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=tdd_05MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + echo "############################################################" + echo "Starting the eNB in TDD-10MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=tdd_10MHz_enb.log + start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-tdd-basic-sim.conf none -# Bug in TDD 5Mhz --- not running it -# echo "############################################################" -# echo "Iperf DL" -# echo "############################################################" -# CURR_IPERF_LOG_BASE=tdd_05MHz_iperf_dl -# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE -# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC -# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC -# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 + echo "############################################################" + echo "Starting the UE in TDD-10MHz mode" + echo "############################################################" + CURRENT_UE_LOG_FILE=tdd_10MHz_ue.log + start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2350 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + get_ue_ip_addr $VM_CMDS $VM_IP_ADDR - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + echo "############################################################" + echo "Pinging the UE" + echo "############################################################" + PING_LOG_FILE=tdd_10MHz_ping_ue.txt + ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - echo "############################################################" - echo "Starting the eNB in TDD-10MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=tdd_10MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-tdd-basic-sim.conf + echo "############################################################" + echo "Iperf DL" + echo "############################################################" + CURR_IPERF_LOG_BASE=tdd_10MHz_iperf_dl + iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 - echo "############################################################" - echo "Starting the UE in TDD-10MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=tdd_10MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2350 - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - exit -1 - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR + sleep 10 - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=tdd_10MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC - check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 - - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - CURR_IPERF_LOG_BASE=tdd_10MHz_iperf_dl - iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE - scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 - - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - -# Disabling TDD-20MHz test since it is very unstable +# Disabling TDD-20MHz in order to stop getting false negatives +# echo "############################################################" +# echo "Starting the eNB in TDD-20MHz mode" +# echo "############################################################" +# CURRENT_ENB_LOG_FILE=tdd_20MHz_enb.log +# start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-tdd-basic-sim.conf none # -# echo "############################################################" -# echo "Starting the eNB in TDD-20MHz mode" -# echo "############################################################" -# CURRENT_ENB_LOG_FILE=tdd_20MHz_enb.log -# start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-tdd-basic-sim.conf +# echo "############################################################" +# echo "Starting the UE in TDD-20MHz mode" +# echo "############################################################" +# CURRENT_UE_LOG_FILE=tdd_20MHz_ue.log +# start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2350 +# if [ $UE_SYNC -eq 0 ] +# then +# echo "Problem w/ eNB and UE not syncing" +# terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR +# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC +# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC +# recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC +# terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR +# echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log +# exit -1 +# fi +# get_ue_ip_addr $VM_CMDS $VM_IP_ADDR # -# echo "############################################################" -# echo "Starting the UE in TDD-20MHz mode" -# echo "############################################################" -# CURRENT_UE_LOG_FILE=tdd_20MHz_ue.log -# start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2350 -# if [ $UE_SYNC -eq 0 ] -# then -# echo "Problem w/ eNB and UE not syncing" +# echo "############################################################" +# echo "Pinging the UE" +# echo "############################################################" +# PING_LOG_FILE=tdd_20MHz_ping_ue.txt +# ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE +# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC +# check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 +# +# echo "############################################################" +# echo "Iperf DL" +# echo "############################################################" +# CURR_IPERF_LOG_BASE=tdd_20MHz_iperf_dl +# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE +# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC +# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC +# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 +# +# echo "############################################################" +# echo "Terminate enb/ue simulators" +# echo "############################################################" # terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR # scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC # scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC # recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC -# terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR -# exit -1 -# fi -# get_ue_ip_addr $VM_CMDS $VM_IP_ADDR -# -# echo "############################################################" -# echo "Pinging the UE" -# echo "############################################################" -# PING_LOG_FILE=tdd_20MHz_ping_ue.txt -# ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE -# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC -# check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 -# -# echo "############################################################" -# echo "Iperf DL" -# echo "############################################################" -# CURR_IPERF_LOG_BASE=tdd_20MHz_iperf_dl -# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE -# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC -# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC -# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6 -# -# echo "############################################################" -# echo "Terminate enb/ue simulators" -# echo "############################################################" -# terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR -# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC -# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC -# recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC +# sleep 10 - echo "############################################################" - echo "Terminate EPC" - echo "############################################################" + echo "############################################################" + echo "Terminate EPC" + echo "############################################################" - if [ $LTEBOX -eq 1 ] - then - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VMs" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + uvt-kvm destroy $EPC_VM_NAME + ssh-keygen -R $EPC_VM_IP_ADDR + if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] + then + uvt-kvm destroy $FLEXRAN_CTL_VM_NAME + ssh-keygen -R $FLEXRAN_CTL_VM_IP_ADDR + fi + fi + + echo "############################################################" + echo "Checking run status" + echo "############################################################" + + if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi + if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi + + if [ $STATUS -eq 0 ] + then + echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + else + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + fi fi - echo "############################################################" - echo "Checking run status" - echo "############################################################" + if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-l2-sim.* ]] + then + PING_STATUS=0 + IPERF_STATUS=0 + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC - if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi - if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi + # Building UE elsewhere in VM + build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR -fi + # Creating a VM for EPC and installing SW + EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#l2-epc#"` + EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt + LTEBOX=0 + install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS + EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` -if [ $STATUS -eq 0 ] -then - echo "STATUS seems OK" -else - echo "STATUS failed?" -fi + # Starting EPC + start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR -exit $STATUS + # Retrieve EPC real IP address + retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR + + echo "############################################################" + echo "Starting the eNB in FDD-5MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log + start_l2_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf + + echo "############################################################" + echo "Starting the UEs" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log + start_l2_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + + echo "############################################################" + echo "Pinging the EPC from UE" + echo "############################################################" + PING_LOG_FILE=fdd_05MHz_ping_epc.txt + ping_epc_ip_addr $VM_CMDS $VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC + check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 + + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + + echo "############################################################" + echo "Terminate EPC" + echo "############################################################" + + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VMs" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + uvt-kvm destroy $EPC_VM_NAME + ssh-keygen -R $EPC_VM_IP_ADDR + fi + + echo "############################################################" + echo "Checking run status" + echo "############################################################" + + if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi + if [ $STATUS -eq 0 ] + then + echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + else + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + fi + fi +} diff --git a/ci-scripts/tcp_iperf_stats.awk b/ci-scripts/tcp_iperf_stats.awk index e5c64b6283..3a00e4555f 100644 --- a/ci-scripts/tcp_iperf_stats.awk +++ b/ci-scripts/tcp_iperf_stats.awk @@ -1,3 +1,23 @@ +#/* +# * 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 +# */ BEGIN{max=0;min=10000} { if ($0 ~/Mbits/) { diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh new file mode 100755 index 0000000000..2820b88647 --- /dev/null +++ b/ci-scripts/waitBuildOnVM.sh @@ -0,0 +1,194 @@ +#!/bin/bash +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ + +function wait_usage { + echo "OAI CI VM script" + echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" + echo " -- xenial image already synced" + echo " Default:" + echo " -- eNB with USRP" + echo "" + echo "Usage:" + echo "------" + echo " oai-ci-vm-tool wait [OPTIONS]" + echo "" + echo "Mandatory Options:" + echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace." + echo "" + variant_usage + echo " Specify the variant to build." + echo "" + echo "Options:" + echo "--------" + echo " --keep-vm-alive OR -k" + echo " Keep the VM alive after the build." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +function wait_on_vm_build { + echo "############################################################" + echo "OAI CI VM script" + echo "############################################################" + + echo "VM_NAME = $VM_NAME" + echo "VM_CMD_FILE = $VM_CMDS" + echo "JENKINS_WKSP = $JENKINS_WKSP" + echo "ARCHIVES_LOC = $ARCHIVES_LOC" + echo "BUILD_OPTIONS = $BUILD_OPTIONS" + + IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME` + + if [ $IS_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "You should have created the VM before doing anything" + echo "############################################################" + STATUS=1 + return + fi + + echo "Waiting for VM to be started" + uvt-kvm wait $VM_NAME --insecure + + VM_IP_ADDR=`uvt-kvm ip $VM_NAME` + echo "$VM_NAME has for IP addr = $VM_IP_ADDR" + + echo "############################################################" + echo "Waiting build process to end on VM ($VM_NAME)" + echo "############################################################" + + if [[ "$VM_NAME" == *"-cppcheck"* ]] + then + echo "echo \"ps -aux | grep cppcheck \"" >> $VM_CMDS + echo "while [ \$(ps -aux | grep --color=never cppcheck | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS + else + echo "echo \"ps -aux | grep build \"" >> $VM_CMDS + echo "while [ \$(ps -aux | grep --color=never build_oai | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS + fi + + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + rm -f $VM_CMDS +} + +function check_on_vm_build { + echo "############################################################" + echo "Creating a tmp folder to store results and artifacts" + echo "############################################################" + if [ ! -d $JENKINS_WKSP/archives ] + then + mkdir $JENKINS_WKSP/archives + fi + + if [ ! -d $ARCHIVES_LOC ] + then + mkdir $ARCHIVES_LOC + fi + + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC + if [[ "$VM_NAME" == *"-cppcheck"* ]] + then + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC + fi + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VM" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + fi + rm -f $VM_CMDS + + echo "############################################################" + echo "Checking build status" + echo "############################################################" + + if [[ "$VM_NAME" == *"-cppcheck"* ]] + then + LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml` + else + LOG_FILES=`ls $ARCHIVES_LOC/*.txt` + fi + STATUS=0 + NB_FOUND_FILES=0 + + for FULLFILE in $LOG_FILES + do + if [[ $FULLFILE == *"$LOG_PATTERN"* ]] + then + filename=$(basename -- "$FULLFILE") + if [ "$LOG_PATTERN" == ".Rel14.txt" ] + then + PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"` + fi + if [ "$LOG_PATTERN" == "basic_simulator" ] + then + PASS_PATTERN="lte-" + fi + if [ "$LOG_PATTERN" == "cppcheck.xml" ] + then + PASS_PATTERN="results version" + LOCAL_STAT=`egrep -c "$PASS_PATTERN" $FULLFILE` + else + LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE` + fi + if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi + NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) + fi + done + + if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ] + then + echo "Expecting $NB_PATTERN_FILES log files and found $NB_FOUND_FILES" + STATUS=-1 + fi + + # If we were building the FlexRan Controller, flag-touch for basic-simulator to continue + if [[ "$VM_NAME" == *"-flexran-rtc"* ]] + then + if [[ $STATUS -eq 0 ]] + then + touch $JENKINS_WKSP/flexran/flexran_build_complete.txt + fi + fi + + if [[ $STATUS -eq 0 ]] + then + echo "BUILD_OK" > $ARCHIVES_LOC/build_final_status.log + else + echo "BUILD_KO" > $ARCHIVES_LOC/build_final_status.log + fi +} diff --git a/ci-scripts/xml_files/enb_usrp210_band40_build.xml b/ci-scripts/xml_files/enb_usrp210_band40_build.xml new file mode 100644 index 0000000000..8f9489b03e --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_build.xml @@ -0,0 +1,54 @@ + + + build-tab + Build + wrench + + 010101 + 050101 060101 070101 + + + + + Build_eNB + Build eNB (USRP) + -w USRP -c --eNB + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band40_epc_closure.xml b/ci-scripts/xml_files/enb_usrp210_band40_epc_closure.xml new file mode 100644 index 0000000000..ad34381a2a --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_epc_closure.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/enb_usrp210_band40_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml new file mode 100644 index 0000000000..d5a25c7fa7 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml @@ -0,0 +1,119 @@ + + + test-05-tm1 + Test-05MHz-TM1 + tasks + + 040101 + 030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (TDD/Band40/5MHz) + -O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 25 + + + + Iperf + iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(balanced) + -u -b 6.5M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(single-ue) + -u -b 6.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(unbalanced) + -u -b 6.5M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec)(balanced) + -u -b 2M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec)(single-ue) + -u -b 2M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec)(unbalanced) + -u -b 2M -t 30 -i 1 -R + 50 + unbalanced + + + diff --git a/ci-scripts/xml_files/enb_usrpb210_band40.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml similarity index 51% rename from ci-scripts/xml_files/enb_usrpb210_band40.xml rename to ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml index 1af1c319cf..ef50933d4a 100644 --- a/ci-scripts/xml_files/enb_usrpb210_band40.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml @@ -21,43 +21,21 @@ --> + test-10-tm1 + Test-10MHz-TM1 + tasks - 010101 - 050101 060101 070101 040101 - 030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201 + 040101 030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201 - 050201 060201 070201 - - - - Build_eNB - Build eNB (USRP) - -w USRP -c --eNB - - - - Initialize_eNB - Initialize eNB (TDD/Band40/5MHz) - -O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf --codingw --fepw - - Initialize_eNB Initialize eNB (TDD/Band40/10MHz/info) - -O ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf --codingw --fepw + -O ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf - - Initialize_eNB - Initialize eNB (TDD/Band40/20MHz/info) - -O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf --codingw --fepw - - Terminate_eNB Terminate eNB @@ -83,13 +61,6 @@ Detach UE - - Ping - ping (5MHz - 20 sec) - -c 20 - 25 - - Ping ping (10MHz - 20 sec) @@ -97,30 +68,6 @@ 25 - - Iperf - iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(balanced) - -u -b 6.5M -t 30 -i 1 - 50 - balanced - - - - Iperf - iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(single-ue) - -u -b 6.5M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(unbalanced) - -u -b 6.5M -t 30 -i 1 - 50 - unbalanced - - Iperf iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(balanced) @@ -145,30 +92,6 @@ unbalanced - - Iperf - iperf (5MHz - UL/2Mbps/UDP)(30 sec)(balanced) - -u -b 2M -t 30 -i 1 -R - 50 - balanced - - - - Iperf - iperf (5MHz - UL/2Mbps/UDP)(30 sec)(single-ue) - -u -b 2M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (5MHz - UL/2Mbps/UDP)(30 sec)(unbalanced) - -u -b 2M -t 30 -i 1 -R - 50 - unbalanced - - Iperf iperf (10MHz - UL/2Mbps/UDP)(30 sec)(balanced) @@ -193,34 +116,4 @@ unbalanced - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - - - Terminate_HSS - Terminate HSS - - - - Terminate_MME - Terminate MME - - - - Terminate_SPGW - Terminate SPGW - - 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 new file mode 100644 index 0000000000..9a96baac3f --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml @@ -0,0 +1,119 @@ + + + test-20-tm1 + Test-20MHz-TM1 + tasks + + 040101 + 030124 040301 040521 040622 040621 040623 040662 040661 040663 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (TDD/Band40/20MHz/info) + -O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf + + + + 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/13.5Mbps/UDP)(30 sec)(balanced) + -u -b 13.5M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue) + -u -b 13.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(unbalanced) + -u -b 13.5M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (20MHz - UL/2Mbps/UDP)(30 sec)(balanced) + -u -b 2M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (20MHz - UL/2Mbps/UDP)(30 sec)(single-ue) + -u -b 2M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/2Mbps/UDP)(30 sec)(unbalanced) + -u -b 2M -t 30 -i 1 -R + 50 + unbalanced + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band40_tracer.xml b/ci-scripts/xml_files/enb_usrp210_band40_tracer.xml new file mode 100644 index 0000000000..dceb6be97a --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_tracer.xml @@ -0,0 +1,65 @@ + + + tracer-test + T-Tracer + duplicate + + 040101 + 030100 040300 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (TDD/Band40/5MHz) with T Tracer on + -O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf --T_stdout 0 + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach single UE + 1 + + + + Detach_UE + Detach UE + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7.xml b/ci-scripts/xml_files/enb_usrp210_band7.xml deleted file mode 100644 index 0785ad815d..0000000000 --- a/ci-scripts/xml_files/enb_usrp210_band7.xml +++ /dev/null @@ -1,350 +0,0 @@ - - - - 010101 - 050101 060101 070101 040101 - 030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201 - 030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201 - 030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201 - 050201 060201 070201 - - - - - Build_eNB - Build eNB (USRP) - -w USRP -c --eNB - - - - Initialize_eNB - Initialize eNB (FDD/Band7/5MHz) - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --codingw --fepw - - - - Initialize_eNB - Initialize eNB (FDD/Band7/10MHz) - -O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --codingw --fepw - - - - Initialize_eNB - Initialize eNB (FDD/Band7/20MHz) - -O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf --codingw --fepw - - - - Terminate_eNB - Terminate eNB - - - - Initialize_UE - Initialize UE - - - - Terminate_UE - Terminate UE - - - - Attach_UE - Attach UE - - - - Detach_UE - Detach UE - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - - - Ping - ping (10MHz - 20 sec) - -c 20 - 5 - - - - Ping - ping (20MHz - 20 sec) - -c 20 - 5 - - - - Iperf - iperf (5MHz - DL/15Mbps/UDP)(30 sec)(balanced profile) - -u -b 15M -t 30 -i 1 - 50 - balanced - - - - Iperf - iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile) - -u -b 15M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (5MHz - DL/15Mbps/UDP)(30 sec)(unbalanced profile) - -u -b 15M -t 30 -i 1 - 50 - unbalanced - - - - Iperf - iperf (5MHz - DL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm - 50 - single-ue - - - - Iperf - iperf (5MHz - DL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm - 50 - balanced - - - - Iperf - iperf (5MHz - UL/9Mbps/UDP)(30 sec)(balanced profile) - -u -b 9M -t 30 -i 1 -R - 50 - balanced - - - - Iperf - iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile) - -u -b 9M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (5MHz - UL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm -R - 50 - single-ue - - - - Iperf - iperf (5MHz - UL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm -R - 50 - balanced - - - - Iperf - iperf (10MHz - DL/30Mbps/UDP)(30 sec)(balanced profile) - -u -b 30M -t 30 -i 1 - 50 - balanced - - - - Iperf - iperf (10MHz - DL/30Mbps/UDP)(30 sec)(single-ue profile) - -u -b 30M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (10MHz - DL/30Mbps/UDP)(30 sec)(unbalanced profile) - -u -b 30M -t 30 -i 1 - 50 - unbalanced - - - - Iperf - iperf (10MHz - DL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm - 50 - single-ue - - - - Iperf - iperf (10MHz - DL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm - 50 - balanced - - - - Iperf - iperf (10MHz - UL/20Mbps/UDP)(30 sec)(balanced profile) - -u -b 20M -t 30 -i 1 -R - 50 - balanced - - - - Iperf - iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) - -u -b 20M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (10MHz - UL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm -R - 50 - single-ue - - - - Iperf - iperf (10MHz - UL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm -R - 50 - balanced - - - - Iperf - iperf (20MHz - DL/70Mbps/UDP)(30 sec)(balanced profile) - -u -b 70M -t 30 -i 1 - 50 - balanced - - - - Iperf - iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile) - -u -b 70M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (20MHz - DL/70Mbps/UDP)(30 sec)(unbalanced profile) - -u -b 70M -t 30 -i 1 - 50 - unbalanced - - - - Iperf - iperf (20MHz - DL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm - 50 - single-ue - - - - Iperf - iperf (20MHz - DL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm - 50 - balanced - - - - Iperf - iperf (20MHz - UL/20Mbps/UDP)(30 sec)(balanced profile) - -u -b 20M -t 30 -i 1 -R - 50 - balanced - - - - Iperf - iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) - -u -b 20M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (20MHz - UL/TCP)(30 sec)(single-ue profile) - -t 30 -i 1 -fm -R - 50 - single-ue - - - - Iperf - iperf (20MHz - UL/TCP)(30 sec)(balanced profile) - -t 30 -i 1 -fm -R - 50 - balanced - - - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - - - Terminate_HSS - Terminate HSS - - - - Terminate_MME - Terminate MME - - - - Terminate_SPGW - Terminate SPGW - - - diff --git a/ci-scripts/xml_files/enb_usrp210_band7_build.xml b/ci-scripts/xml_files/enb_usrp210_band7_build.xml new file mode 100644 index 0000000000..31ee57e941 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_build.xml @@ -0,0 +1,54 @@ + + + build-tab + Build + wrench + + 010101 + 050101 060101 070101 + + + + + Build_eNB + Build eNB (USRP) + -w USRP -c --eNB + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_epc_closure.xml b/ci-scripts/xml_files/enb_usrp210_band7_epc_closure.xml new file mode 100644 index 0000000000..07fb6951f8 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_epc_closure.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/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml new file mode 100644 index 0000000000..0057eaefa4 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml @@ -0,0 +1,143 @@ + + + test-05-tm1 + Test-05MHz-TM1 + tasks + + 040101 + 030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + + Iperf + iperf (5MHz - DL/15Mbps/UDP)(30 sec)(balanced profile) + -u -b 15M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile) + -u -b 15M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (5MHz - DL/15Mbps/UDP)(30 sec)(unbalanced profile) + -u -b 15M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (5MHz - DL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm + 50 + single-ue + + + + Iperf + iperf (5MHz - DL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm + 50 + balanced + + + + Iperf + iperf (5MHz - UL/9Mbps/UDP)(30 sec)(balanced profile) + -u -b 9M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile) + -u -b 9M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (5MHz - UL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm -R + 50 + single-ue + + + + Iperf + iperf (5MHz - UL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm -R + 50 + balanced + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml new file mode 100644 index 0000000000..92ec1efa6e --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml @@ -0,0 +1,143 @@ + + + test-10-tm1 + Test-10MHz-TM1 + tasks + + 040101 + 030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (FDD/Band7/10MHz) + -O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (10MHz - 20 sec) + -c 20 + 5 + + + + Iperf + iperf (10MHz - DL/30Mbps/UDP)(30 sec)(balanced profile) + -u -b 30M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (10MHz - DL/30Mbps/UDP)(30 sec)(single-ue profile) + -u -b 30M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (10MHz - DL/30Mbps/UDP)(30 sec)(unbalanced profile) + -u -b 30M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (10MHz - DL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm + 50 + single-ue + + + + Iperf + iperf (10MHz - DL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm + 50 + balanced + + + + Iperf + iperf (10MHz - UL/20Mbps/UDP)(30 sec)(balanced profile) + -u -b 20M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) + -u -b 20M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (10MHz - UL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm -R + 50 + single-ue + + + + Iperf + iperf (10MHz - UL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm -R + 50 + balanced + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml new file mode 100644 index 0000000000..b6c441b19a --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml @@ -0,0 +1,143 @@ + + + test-20-tm1 + Test-20MHz-TM1 + tasks + + 040101 + 030121 040301 040521 040623 040624 040625 040662 040401 040201 030201 + + 040626 040627 040661 040663 040664 + + + Initialize_eNB + Initialize eNB (FDD/Band7/20MHz) + -O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf + + + + 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 + 5 + + + + Iperf + iperf (20MHz - DL/70Mbps/UDP)(30 sec)(balanced profile) + -u -b 70M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile) + -u -b 70M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (20MHz - DL/70Mbps/UDP)(30 sec)(unbalanced profile) + -u -b 70M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (20MHz - DL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm + 50 + single-ue + + + + Iperf + iperf (20MHz - DL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm + 50 + balanced + + + + Iperf + iperf (20MHz - UL/12Mbps/UDP)(30 sec)(balanced profile) + -u -b 12M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (20MHz - UL/17Mbps/UDP)(30 sec)(single-ue profile) + -u -b 17M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/TCP)(30 sec)(single-ue profile) + -t 30 -i 1 -fm -R + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/TCP)(30 sec)(balanced profile) + -t 30 -i 1 -fm -R + 50 + balanced + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_tracer.xml b/ci-scripts/xml_files/enb_usrp210_band7_tracer.xml new file mode 100644 index 0000000000..4c74f52b0f --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_tracer.xml @@ -0,0 +1,65 @@ + + + tracer-test + T-Tracer + duplicate + + 040101 + 030100 040300 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) with T Tracer on + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --T_stdout 0 + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach single UE + 1 + + + + Detach_UE + Detach UE + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40.xml b/ci-scripts/xml_files/if4p5_usrp210_band40.xml deleted file mode 100644 index 9c1b721bef..0000000000 --- a/ci-scripts/xml_files/if4p5_usrp210_band40.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - 010101 - 050101 060101 070101 040101 - 030104 030105 040301 040501 040602 040401 040201 030201 030202 - 050201 060201 070201 - - - - - - - Build_eNB - Build eNB (USRP -- Ethernet Fronthaul) - -t ETHERNET -w USRP -c --eNB - - - - Initialize_eNB - Initialize RRU (TDD/Band40) - -O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw - 0 - - - - Initialize_eNB - Initialize RCC (TDD/Band40/5MHz) - -O ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf --codingw --fepw - 1 - - - - Initialize_eNB - Initialize RRU (TDD/Band40) - -O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw - 0 - - - - Initialize_eNB - Initialize RCC (TDD/Band40/10MHz/info) - -O ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf --codingw --fepw - 1 - - - - Initialize_eNB - Initialize RRU (TDD/Band40) - -O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw - 0 - - - - Initialize_eNB - Initialize RCC (TDD/Band40/20MHz/info) - -O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf --codingw --fepw - 1 - - - - Terminate_eNB - Terminate RCC - 1 - - - - Terminate_eNB - Terminate RRU - 0 - - - - Initialize_UE - Initialize UE - - - - Terminate_UE - Terminate UE - - - - Attach_UE - Attach UE - - - - Detach_UE - Detach UE - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 25 - - - - Ping - ping (10MHz - 20 sec) - -c 20 - 25 - - - - Ping - ping (20MHz - 20 sec) - -c 20 - 25 - - - - Iperf - iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(single-ue) - -u -b 6.5M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue) - -u -b 13.5M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (20MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue) - -u -b 13.5M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (5MHz - UL/2Mbps/UDP)(30 sec)(single-ue) - -u -b 2M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (10MHz - UL/2Mbps/UDP)(30 sec)(single-ue) - -u -b 2M -t 30 -i 1 -R - 50 - single-ue - - - - Iperf - iperf (20MHz - UL/2Mbps/UDP)(30 sec)(single-ue) - -u -b 2M -t 30 -i 1 -R - 50 - single-ue - - - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - - - Terminate_HSS - Terminate HSS - - - - Terminate_MME - Terminate MME - - - - Terminate_SPGW - Terminate SPGW - - - diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml new file mode 100644 index 0000000000..5bb7db5299 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml @@ -0,0 +1,55 @@ + + + build-tab + Build + wrench + + 010101 + 050101 060101 070101 + + + + + + Build_eNB + Build eNB (USRP -- Ethernet Fronthaul) + -t ETHERNET -w USRP -c --eNB + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_epc_closure.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_epc_closure.xml new file mode 100644 index 0000000000..c04a8b3cf4 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_epc_closure.xml @@ -0,0 +1,48 @@ + + + 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/if4p5_usrp210_band40_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml new file mode 100644 index 0000000000..1de23d05d6 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml @@ -0,0 +1,103 @@ + + + test-05 + Test-05MHz + tasks + + 040101 + 030104 030105 040301 040501 040602 040642 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (TDD/Band40) + -O ci-scripts/conf_files/rru.tdd.band40.conf + 0 + + + + Initialize_eNB + Initialize RCC (TDD/Band40/5MHz) + -O ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf + 1 + + + + Terminate_eNB + Terminate RCC + 1 + + + + Terminate_eNB + Terminate RRU + 0 + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 25 + + + + Iperf + iperf (5MHz - DL/6.5Mbps/UDP)(30 sec)(single-ue) + -u -b 6.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec)(single-ue) + -u -b 2M -t 30 -i 1 -R + 50 + single-ue + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml new file mode 100644 index 0000000000..6bc37db17a --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml @@ -0,0 +1,103 @@ + + + test-10 + Test-10MHz + tasks + + 040101 + 030114 030115 040301 040511 040612 040652 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (TDD/Band40) + -O ci-scripts/conf_files/rru.tdd.band40.conf + 0 + + + + Initialize_eNB + Initialize RCC (TDD/Band40/10MHz/info) + -O ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf + 1 + + + + Terminate_eNB + Terminate RCC + 1 + + + + Terminate_eNB + Terminate RRU + 0 + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (10MHz - 20 sec) + -c 20 + 25 + + + + Iperf + iperf (10MHz - DL/13.5Mbps/UDP)(30 sec)(single-ue) + -u -b 13.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (10MHz - UL/2Mbps/UDP)(30 sec)(single-ue) + -u -b 2M -t 30 -i 1 -R + 50 + single-ue + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml new file mode 100644 index 0000000000..512c958105 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml @@ -0,0 +1,103 @@ + + + test-20 + Test-20MHz + tasks + + 040101 + 030124 030125 040301 040521 040622 040662 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (TDD/Band40) + -O ci-scripts/conf_files/rru.tdd.band40.conf + 0 + + + + Initialize_eNB + Initialize RCC (TDD/Band40/20MHz/info) + -O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf + 1 + + + + Terminate_eNB + Terminate RCC + 1 + + + + Terminate_eNB + Terminate RRU + 0 + + + + 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/13.5Mbps/UDP)(30 sec)(single-ue) + -u -b 13.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/2Mbps/UDP)(30 sec)(single-ue) + -u -b 2M -t 30 -i 1 -R + 50 + single-ue + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7.xml b/ci-scripts/xml_files/if4p5_usrp210_band7.xml deleted file mode 100644 index a3e5ecd72c..0000000000 --- a/ci-scripts/xml_files/if4p5_usrp210_band7.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - 010101 - 050101 060101 070101 040101 - 030101 030102 040301 040501 040604 040642 040401 040201 030201 030202 - 050201 060201 070201 - - - - - - - Build_eNB - Build eNB (USRP -- Ethernet Fronthaul) - -t ETHERNET -w USRP -c --eNB - - - - Initialize_eNB - Initialize RRU (FDD/Band7) - -O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw - 1 - - - - Initialize_eNB - Initialize RCC (FDD/Band7/5MHz) - -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf --codingw --fepw - 0 - - - - Initialize_eNB - Initialize RRU (FDD/Band7) - -O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw - 1 - - - - Initialize_eNB - Initialize RCC (FDD/Band7/10MHz) - -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf --codingw --fepw - 0 - - - - Initialize_eNB - Initialize RRU (FDD/Band7) - -O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw - 1 - - - - Initialize_eNB - Initialize RCC (FDD/Band7/20MHz) - -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf --codingw --fepw - 0 - - - - Terminate_eNB - Terminate RCC - 0 - - - - Terminate_eNB - Terminate RRU - 1 - - - - Initialize_UE - Initialize UE - - - - Terminate_UE - Terminate UE - - - - Attach_UE - Attach UE - - - - Detach_UE - Detach UE - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - - - Iperf - iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile) - -u -b 15M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile) - -u -b 9M -t 30 -i 1 -R - 50 - single-ue - - - - Ping - ping (10MHz - 20 sec) - -c 20 - 5 - - - - Iperf - iperf (10MHz - DL/32Mbps/UDP)(30 sec)(single-ue profile) - -u -b 32M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) - -u -b 20M -t 30 -i 1 -R - 50 - single-ue - - - - Ping - ping (20MHz - 20 sec) - -c 20 - 5 - - - - Iperf - iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile) - -u -b 70M -t 30 -i 1 - 50 - single-ue - - - - Iperf - iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) - -u -b 20M -t 30 -i 1 -R - 50 - single-ue - - - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - - - Terminate_HSS - Terminate HSS - - - - Terminate_MME - Terminate MME - - - - Terminate_SPGW - Terminate SPGW - - - diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml new file mode 100644 index 0000000000..a0be9253db --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml @@ -0,0 +1,55 @@ + + + build-tab + Build + wrench + + 010101 + 050101 060101 070101 040101 + + + + + + Build_eNB + Build eNB (USRP -- Ethernet Fronthaul) + -t ETHERNET -w USRP -c --eNB + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_epc_closure.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_epc_closure.xml new file mode 100644 index 0000000000..8587db959d --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_epc_closure.xml @@ -0,0 +1,48 @@ + + + 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/if4p5_usrp210_band7_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml new file mode 100644 index 0000000000..b0501e9875 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml @@ -0,0 +1,103 @@ + + + test-05 + Test-05MHz + tasks + + 040101 + 030101 030102 040301 040501 040604 040642 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (FDD/Band7) + -O ci-scripts/conf_files/rru.fdd.band7.conf + 1 + + + + Initialize_eNB + Initialize RCC (FDD/Band7/5MHz) + -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf + 0 + + + + Terminate_eNB + Terminate RCC + 0 + + + + Terminate_eNB + Terminate RRU + 1 + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + + Iperf + iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile) + -u -b 15M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile) + -u -b 9M -t 30 -i 1 -R + 50 + single-ue + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml new file mode 100644 index 0000000000..88fb30b840 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml @@ -0,0 +1,103 @@ + + + test-10 + Test-10MHz + tasks + + 040101 + 030111 030112 040301 040511 040614 040652 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (FDD/Band7) + -O ci-scripts/conf_files/rru.fdd.band7.conf + 1 + + + + Initialize_eNB + Initialize RCC (FDD/Band7/10MHz) + -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf + 0 + + + + Terminate_eNB + Terminate RCC + 0 + + + + Terminate_eNB + Terminate RRU + 1 + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (10MHz - 20 sec) + -c 20 + 5 + + + + Iperf + iperf (10MHz - DL/32Mbps/UDP)(30 sec)(single-ue profile) + -u -b 32M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (10MHz - UL/5Mbps/UDP)(30 sec)(single-ue profile) + -u -b 5M -t 30 -i 1 -R + 60 + single-ue + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml new file mode 100644 index 0000000000..798fc1bc8f --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml @@ -0,0 +1,103 @@ + + + test-20 + Test-20MHz + tasks + + 040101 + 030121 030122 040301 040521 040624 040662 040401 040201 030201 030202 + + + + + + Initialize_eNB + Initialize RRU (FDD/Band7) + -O ci-scripts/conf_files/rru.fdd.band7.conf + 1 + + + + Initialize_eNB + Initialize RCC (FDD/Band7/20MHz) + -O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf + 0 + + + + Terminate_eNB + Terminate RCC + 0 + + + + Terminate_eNB + Terminate RRU + 1 + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (20MHz - 20 sec) + -c 20 + 5 + + + + Iperf + iperf (20MHz - DL/50Mbps/UDP)(30 sec)(single-ue profile) + -u -b 50M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/10Mbps/UDP)(30 sec)(single-ue profile) + -u -b 10M -t 30 -i 1 -R + 50 + single-ue + + + diff --git a/ci-scripts/xml_files/test_case_list_template.xml b/ci-scripts/xml_files/test_case_list_template.xml index 25519dcd03..bdf16af0e3 100644 --- a/ci-scripts/xml_files/test_case_list_template.xml +++ b/ci-scripts/xml_files/test_case_list_template.xml @@ -107,6 +107,28 @@ Reboot UE + + + + Initialize_CatM_module + Initialize CAT-M Module + + + + Terminate_CatM_module + Terminate CAT-M Module + + + + Attach_CatM_module + Attach CAT-M Module + + + + Detach_CatM_module + Detach CAT-M Module + + diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 341a593be8..1592c98e8e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -183,7 +183,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -add_definitions(-DCMAKER) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") @@ -232,7 +231,7 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") # Debug related options ######################################### add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug") -add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug") +add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug") add_boolean_option(MSG_PRINT False "print debug messages") add_boolean_option(DISABLE_XER_PRINT False "print XER Format") add_boolean_option(XER_PRINT False "print XER Format") @@ -260,17 +259,17 @@ add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain e set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) if (${ENABLE_ITTI}) add_library(ITTI - # add .h files if depend on (this one is generated) ${OCP_ITTI}/intertask_interface.cpp ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/memory_pools.c ) +add_dependencies(ITTI rrc_flag) set(ITTI_LIB ITTI) set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c) endif (${ENABLE_ITTI}) ############################# -# ASN.1 grammar C code generation & dependancies +# ASN.1 grammar C code generation & dependencies ################################ # A difficulty: asn1c generates C code of a un-predictable list of files # so, generate the c from asn1c once at cmake run time @@ -278,8 +277,6 @@ endif (${ENABLE_ITTI}) # (so creating new asn.1 objects instead of modifying the object attributes) # New C code source file, cmake must be re-run (instead of re-running make only) ############# -# set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") -# set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1") set(asn1_generated_dir ${OPENAIR_BIN_DIR}) set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") @@ -290,59 +287,54 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA") if (${RRC_ASN1_VERSION} STREQUAL "Rel8") - make_version(RRC_VERSION 8 6 0) + make_version(LTE_RRC_VERSION 8 6 0) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) elseif (${RRC_ASN1_VERSION} STREQUAL "CBA") - make_version(RRC_VERSION 10 2 0) + make_version(LTE_RRC_VERSION 10 2 0) add_definitions(-DCBA) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10") - make_version(RRC_VERSION 10 2 0) + make_version(LTE_RRC_VERSION 10 2 0) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel11") - make_version(RRC_VERSION 11 18 0) + make_version(LTE_RRC_VERSION 11 18 0) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel12") - make_version(RRC_VERSION 12 16 0) + make_version(LTE_RRC_VERSION 12 16 0) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel13") - make_version(RRC_VERSION 13 9 1) + make_version(LTE_RRC_VERSION 13 9 1) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel14") - make_version(RRC_VERSION 14 7 0) + make_version(LTE_RRC_VERSION 14 7 0) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel15") - make_version(RRC_VERSION 15 2 2) + make_version(LTE_RRC_VERSION 15 2 2) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1) endif (${RRC_ASN1_VERSION} STREQUAL "Rel8") -add_definitions(-DRRC_VERSION=${RRC_VERSION}) +add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION}) set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION}) -message("calling asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") -execute_process(COMMAND mkdir -p ${RRC_FULL_DIR} - COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR} + +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make +execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_" RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) - file(GLOB rrc_source ${RRC_FULL_DIR}/*.c) -file(GLOB rrc_h ${RRC_FULL_DIR}/*.h) -set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn_constant.h) -set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code -add_library(RRC_LIB ${rrc_h} ${rrc_source} - ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c - ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c) -include_directories ("${RRC_FULL_DIR}") - -# add the command to generate the source code -# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -add_custom_command ( - OUTPUT ${RRC_FULL_DIR}/asn_constant.h - COMMAND mkdir -p ${RRC_FULL_DIR} - COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR} +add_custom_target ( + rrc_flag ALL + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_" DEPENDS ${RRC_GRAMMAR} ) +set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code +add_library(RRC_LIB ${rrc_source} + ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c + ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c) +add_dependencies(RRC_LIB rrc_flag) +include_directories ("${RRC_FULL_DIR}") + # S1AP # Same limitation as described in RRC: unknown generated file list # so we generate it at cmake time @@ -378,28 +370,26 @@ endif(${S1AP_RELEASE} STREQUAL "R8") add_definitions(-DS1AP_VERSION=${S1AP_VERSION}) set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE}) set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE}) -message("calling ASN1C_PREFIX=S1AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}") -execute_process(COMMAND mkdir -p ${S1AP_C_DIR} - COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} + +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make +execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) -file(GLOB s1ap_h ${S1AP_C_DIR}/*.h) -set(s1ap_h ${s1ap_h}) - -add_custom_command ( - OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h - COMMAND mkdir -p ${S1AP_C_DIR} - COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} - DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} +add_custom_target ( + s1ap_flag ALL + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps + DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" ) + add_library(S1AP_LIB ${S1AP_source} ${S1AP_DIR}/s1ap_common.c ) +add_dependencies(S1AP_LIB rrc_flag s1ap_flag) include_directories ("${S1AP_C_DIR}") include_directories ("${S1AP_DIR}") @@ -418,6 +408,7 @@ add_library(S1AP_ENB ${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_ue_context.c ) +add_dependencies(S1AP_ENB rrc_flag s1ap_flag) #X2AP # Same limitation as described in RRC/S1AP: unknown generated file list @@ -445,22 +436,19 @@ endif(${X2AP_RELEASE} STREQUAL "R8") add_definitions(-DX2AP_VERSION=${X2AP_VERSION}) set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE}) set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE}) -message("calling ASN1C_PREFIX=X2AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}") -execute_process(COMMAND mkdir -p ${X2AP_C_DIR} - COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} + +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make +execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) + file(GLOB X2AP_source ${X2AP_C_DIR}/*.c) -file(GLOB x2ap_h ${X2AP_C_DIR}/*.h) -set(x2ap_h ${x2ap_h}) - -add_custom_command ( - OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h - COMMAND mkdir -p ${X2AP_C_DIR} - COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} +add_custom_target ( + x2_flag ALL + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} ) @@ -468,6 +456,7 @@ add_library(X2AP_LIB ${X2AP_source} ${X2AP_DIR}/x2ap_common.c ) +add_dependencies(X2AP_LIB rrc_flag x2_flag) include_directories ("${X2AP_C_DIR}") include_directories ("${X2AP_DIR}") @@ -481,6 +470,7 @@ add_library(X2AP_ENB ${X2AP_DIR}/x2ap_eNB_management_procedures.c ${X2AP_DIR}/x2ap_eNB_generate_messages.c ) +add_dependencies(X2AP_ENB rrc_flag x2_flag) # Hardware dependant options ################################### @@ -551,6 +541,15 @@ set(TPLIB_ETHERNET_SOURCE ) add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} ) +include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") +set(option_HWIRISLIB_lib "-l SoapySDR") +set(HWLIB_IRIS_SOURCE + ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp + ) +add_library(oai_irisdevif MODULE ${HWLIB_IRIS_SOURCE}) +target_include_directories(oai_irisdevif PRIVATE /usr/local/lib/SoapySDR/modules0.7/) +target_link_libraries(oai_irisdevif SoapySDR) + include_directories("${OPENAIR_TARGETS}/ARCH/mobipass/") set(TPLIB_MOBIPASS_SOURCE ${OPENAIR_TARGETS}/ARCH/mobipass/interface.c @@ -616,6 +615,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") +add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") ######################## # Include order @@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") -add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") ########################## @@ -873,6 +872,7 @@ add_library(FLEXRAN_AGENT ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c ) +add_dependencies(FLEXRAN_AGENT rrc_flag) set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) @@ -938,6 +938,7 @@ set(UTIL_SRC # ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c ) add_library(UTIL ${UTIL_SRC}) +add_dependencies(UTIL rrc_flag) #set(OMG_SUMO_SRC # ${OPENAIR2_DIR}/UTIL/OMG/client_traci_OMG.c @@ -977,12 +978,14 @@ set(SCHED_SRC ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c ) add_library(SCHED_LIB ${SCHED_SRC}) +add_dependencies(SCHED_LIB rrc_flag) set(SCHED_SRC_RU ${OPENAIR1_DIR}/SCHED/ru_procedures.c ${OPENAIR1_DIR}/SCHED/prach_procedures.c ) add_library(SCHED_RU_LIB ${SCHED_SRC_RU}) +add_dependencies(SCHED_RU_LIB rrc_flag) set(SCHED_SRC_UE ${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c @@ -992,6 +995,7 @@ set(SCHED_SRC_UE ${OPENAIR1_DIR}/SCHED_UE/srs_pc.c ) add_library(SCHED_UE_LIB ${SCHED_SRC_UE}) +add_dependencies(SCHED_UE_LIB rrc_flag) # nFAPI ################################# @@ -1043,6 +1047,7 @@ set(NFAPI_USER_SRC ${NFAPI_USER_DIR}/nfapi_vnf.c ) add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC}) +add_dependencies(NFAPI_USER_LIB rrc_flag) include_directories(${NFAPI_USER_DIR}) # Layer 1 @@ -1061,9 +1066,6 @@ set(PHY_TURBOIF add_library(coding MODULE ${PHY_TURBOSRC} ) set(PHY_SRC_COMMON - # depend on code generation from asn1c - ${RRC_FULL_DIR}/asn_constant.h - # actual source ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c # ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slss.c @@ -1114,7 +1116,6 @@ set(PHY_SRC_COMMON ) set(PHY_SRC - # actual source ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c @@ -1142,7 +1143,6 @@ set(PHY_SRC ) set(PHY_SRC_RU - # actual source ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c @@ -1158,7 +1158,6 @@ set(PHY_SRC_RU ) set(PHY_SRC_UE - # actual source ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sss_ue.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -1207,9 +1206,13 @@ if (${COMPILATION_AVX2} STREQUAL "True") endif () add_library(PHY_COMMON ${PHY_SRC_COMMON}) +add_dependencies(PHY_COMMON rrc_flag) add_library(PHY ${PHY_SRC}) +add_dependencies(PHY rrc_flag) add_library(PHY_UE ${PHY_SRC_UE}) +add_dependencies(PHY_UE rrc_flag) add_library(PHY_RU ${PHY_SRC_RU}) +add_dependencies(PHY_RU rrc_flag) #Library for mex functions #########################3 @@ -1379,11 +1382,13 @@ add_library(L2 ${MAC_SRC} ${ENB_APP_SRC}) # ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) +add_dependencies(L2 rrc_flag s1ap_flag x2_flag) add_library(L2_UE ${L2_SRC_UE} ${MAC_SRC_UE} ) +add_dependencies(L2_UE rrc_flag s1ap_flag x2_flag) include_directories(${NFAPI_USER_DIR}) @@ -1409,6 +1414,7 @@ set (GTPV1U_SRC ${GTPV1U_DIR}/gtpv1u_teid_pool.c ) add_library(GTPV1U ${GTPV1U_SRC}) +add_dependencies(GTPV1U rrc_flag) set(SCTP_SRC ${OPENAIR3_DIR}/SCTP/sctp_common.c @@ -1416,8 +1422,10 @@ set(SCTP_SRC ${OPENAIR3_DIR}/SCTP/sctp_eNB_itti_messaging.c ) add_library(SCTP_CLIENT ${SCTP_SRC}) +add_dependencies(SCTP_CLIENT rrc_flag) add_library(UDP ${OPENAIR3_DIR}/UDP/udp_eNB_task.c) +add_dependencies(UDP rrc_flag) set(NAS_SRC ${OPENAIR3_DIR}/NAS/) @@ -1666,6 +1674,7 @@ if(NAS_UE) ${libnas_ue_esm_OBJS} ${libnas_ue_esm_sap_OBJS} ) + add_dependencies(LIB_NAS_UE rrc_flag) set(NAS_UE_LIB LIB_NAS_UE) include_directories(${NAS_SRC}UE) @@ -1789,6 +1798,15 @@ include_directories(${CRYPTO_INCLUDE_DIRS}) if (${RF_BOARD} STREQUAL "OAI_USRP") find_package(Boost REQUIRED) include_directories(${LIBBOOST_INCLUDE_DIR}) + +elseif (${RF_BOARD} STREQUAL "OAI_IRIS") + include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") + include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} + ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) + LINK_DIRECTORIES("/usr/local/lib") + set(option_HW_lib "-lSoapySDR -rdynamic -ldl") + endif (${RF_BOARD} STREQUAL "OAI_USRP") pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) @@ -1923,13 +1941,12 @@ add_definitions(-DASN1_MINIMUM_VERSION=924) ################################################### add_executable(lte-softmodem - ${rrc_h} - ${s1ap_h} ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/ru_control.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c @@ -1947,6 +1964,7 @@ add_executable(lte-softmodem ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} ) +add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-softmodem -Wl,--start-group @@ -1963,13 +1981,12 @@ target_link_libraries (lte-softmodem ${T_LIB}) # lte-softmodem-nos1 is both eNB and UE implementation ################################################### add_executable(lte-softmodem-nos1 - ${rrc_h} - ${s1ap_h} ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/ru_control.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c @@ -1986,6 +2003,7 @@ add_executable(lte-softmodem-nos1 ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} ) +add_dependencies(lte-softmodem-nos1 rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${RAL_LIB} ${ITTI_LIB} @@ -2002,11 +2020,10 @@ target_link_libraries (lte-softmodem-nos1 ${T_LIB}) ####################################### add_executable(lte-uesoftmodem - ${rrc_h} - ${s1ap_h} ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/ru_control.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c @@ -2026,6 +2043,7 @@ add_executable(lte-uesoftmodem ${SHLIB_LOADER_SOURCES} ) +add_dependencies(lte-uesoftmodem rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU @@ -2041,11 +2059,10 @@ target_link_libraries (lte-uesoftmodem ${T_LIB}) # lte-uesoftmodem-nos1 is UE implementation ################################################### add_executable(lte-uesoftmodem-nos1 - ${rrc_h} - ${s1ap_h} ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/ru_control.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c @@ -2066,6 +2083,7 @@ add_executable(lte-uesoftmodem-nos1 ${SHLIB_LOADER_SOURCES} ) +add_dependencies(lte-uesoftmodem-nos1 rrc_flag s1ap_flag x2_flag) target_link_libraries (lte-uesoftmodem-nos1 -Wl,--start-group RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${RAL_LIB} ${ITTI_LIB} @@ -2142,7 +2160,6 @@ add_executable(test_epc_generate_scenario ${OPENAIR2_DIR}/ENB_APP/enb_config.h ${OPENAIR2_DIR}/COMMON/commonDef.h ${OPENAIR2_DIR}/COMMON/messages_def.h - ${OPENAIR2_DIR}/COMMON/messages_types.h ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario @@ -2162,7 +2179,6 @@ add_executable(test_epc_play_scenario ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h ${OPENAIR2_DIR}/COMMON/commonDef.h ${OPENAIR2_DIR}/COMMON/messages_def.h - ${OPENAIR2_DIR}/COMMON/messages_types.h ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 54f369f977..bd71125cf0 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -76,7 +76,6 @@ macro(add_boolean_option name val helpstr) endmacro(add_boolean_option) # compilation flags -# added CMAKER conditional compilation to not bother legacy building system ############################################# if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) @@ -84,7 +83,7 @@ endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel) # -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -DCMAKER") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat ") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2") diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index e7f274c2d0..fc4567269e 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -956,20 +956,20 @@ $OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash $OPENAIR_DIR/targets/bin/dlsim.Rel14 - -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60 - -m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O60 - -m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60 - -m15 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O60 - -m15 -gG -s1.4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O25 - -m15 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O25 - -m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O60 - -m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O60 - -m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60 - -m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O60 - -m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O60 - -m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O60 - -m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O60 - -m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O60 + -m=5 -g=F -s=-1= -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60 + -m=4 -g=F -s=0 -w=1.0 -f=.2 -n=500 -B=6 -c=4 -z=2 -O=60 + -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60 + -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=500 -B=25 -c=2 -z=2 -O=60 + -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=25 + -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=500 -B=25 -c=2 -z=2 -O=25 + -m=25 -g=F -s=17.4 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -z=2 -O=60 + -m=25 -g=F -s=17.5 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -z=2 -r=1022 -O=60 + -m=26 -g=F -s=17.7 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60 + -m=26 -g=F -s=17.6 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -O=60 + -m=26 -g=F -s=17.3 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -r=1600 -O=60 + -m=26 -g=F -s=16.6 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -r=1899 -O=60 + -m=14 -g=F -s=6.8 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -x=2 -y=2 -z=2 -O=60 + -m=13 -g=F -s=5.9 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -x=2 -y=2 -z=2 -O=60 dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.TM2_test1 dlsim.TM2_test1b "passed" segmentation fault|assertion|exiting|fatal diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 6b159d595a..99eb5d83b2 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -43,6 +43,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf MSC_GEN=0 XFORMS="True" UE_EXPANSION="False" +UESIM_EXPANSION="False" PRINT_STATS="False" VCD_TIMING="False" DEADLINE_SCHEDULER_FLAG_USER="False" @@ -107,7 +108,7 @@ Options Rel8 limits the implementation to 3GPP Release 8 version Rel10 limits the implementation to 3GPP Release 10 version -w | --hardware - EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, None (Default) + EXMIMO, USRP, BLADERF, ETHERNET, LMSSDR, IRIS, None (Default) Adds this RF board support (in external packages installation and in compilation) -t | --transport protocol ETHERNET , None @@ -218,6 +219,10 @@ function main() { UE_EXPANSION="True" echo_info "Will compile with UE_EXPANSION" shift;; + --musim) + UESIM_EXPANSION="True" + echo_info "Will compile with UESIM_EXPANSION" + shift;; --UE-conf-nvram) conf_nvram_path=$(readlink -f $2) shift 2;; @@ -231,7 +236,7 @@ function main() { -w | --hardware) HW="$2" #"${i#*=}" # Use OAI_USRP as the key word USRP is used inside UHD driver - if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" ] ; then + if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" -a "$HW" != "IRIS" ] ; then echo_fatal "Unknown HW type $HW will exit..." else if [ "$HW" == "USRP" ] ; then @@ -243,6 +248,9 @@ function main() { if [ "$HW" == "LMSSDR" ] ; then HW="OAI_LMSSDR" fi + if [ "$HW" == "IRIS" ] ; then + HW="OAI_IRIS" + fi echo_info "Setting hardware to: $HW" fi shift 2;; @@ -414,7 +422,9 @@ function main() { DEADLINE_SCHEDULER_FLAG_USER="False" elif [ "$HW" = "OAI_BLADERF" ] ; then DEADLINE_SCHEDULER_FLAG_USER="False" - elif [ "$HW" = "OAI_LMSSDR" ] ; then + elif [ "$HW" = "OAI_LMSSDR" ] ; then + DEADLINE_SCHEDULER_FLAG_USER="False" + elif [ "$HW" = "OAI_IRIS" ] ; then DEADLINE_SCHEDULER_FLAG_USER="False" elif [ "$HW" = "None" ] ; then DEADLINE_SCHEDULER_FLAG_USER="False" @@ -484,6 +494,13 @@ function main() { flash_firmware_bladerf fi fi + if [ "$HW" == "OAI_IRIS" ] ; then + echo_info "installing packages for IRIS support" + check_install_soapy + #if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then + # flash_firmware_iris + #fi + fi echo_info "installing protobuf/protobuf-c for flexran agent support" install_protobuf_from_source install_protobuf_c_from_source @@ -539,6 +556,7 @@ function main() { echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file + echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file @@ -651,6 +669,9 @@ function main() { compilations \ lte-simulators coding \ libcoding.so $dbin/libcoding.so +# compilations \ +# lte-simulators $config_libconfig_shlib \ +# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so fi # Core simulators @@ -755,6 +776,14 @@ function main() { ln -sf liboai_lmssdrdevif.so liboai_device.so ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so echo_info "liboai_device.so is linked to LMSSDR device library" + elif [ "$HW" == "OAI_IRIS" ] ; then + compilations \ + $build_dir oai_irisdevif \ + liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL + + ln -s liboai_irisdevif.so liboai_device.so + ln -s $dbin/liboai_irisdevif.so.$REL $dbin/liboai_device.so + echo_info "liboai_device.so is linked to IRIS device library" else echo_info "liboai_device.so is not linked to any device library" fi diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt index b7e83a92a0..1bfac2b20d 100644 --- a/cmake_targets/lte-simulators/CMakeLists.txt +++ b/cmake_targets/lte-simulators/CMakeLists.txt @@ -9,4 +9,5 @@ set(MU_RECIEVER False) set(NAS_UE False) set(MESSAGE_CHART_GENERATOR False) set(RRC_ASN1_VERSION "Rel14") +set (UE_TIMING_TRACE True) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 18e0d54746..18f59c8653 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -252,7 +252,7 @@ install_usrp_uhd_driver_from_source(){ rm -rf /tmp/uhd git clone https://github.com/EttusResearch/uhd.git cd uhd - git checkout tags/release_003_010_001_001 + git checkout tags/v3.13.0.2 mkdir -p host/build cd host/build $CMAKE ../ @@ -372,13 +372,81 @@ check_install_lmssdr_driver(){ else echo_error "lmssdr support implies installing lmssdr drivers and tools" \ " from sources. check:" - echo_info "https://open-cells.com/index.php/2017/05/10/limesdr-installation/" + echo_info "https://wiki.myriadrf.org/Lime_Suite" echo_fatal "Cannot compile lmssdr device" fi } +install_soapy_from_source(){ + soapy_install_log=$OPENAIR_DIR/cmake_targets/log/soapy_install_log.txt + echo_info "\nInstalling Soapy EcoSystem from source. The log file for Soapy installation is here: $soapy_install_log " + ( + cd /tmp + echo "Downloading SoapySDR" + rm -rf /tmp/soapysdr + git clone -b soapy-sdr-0.7.0 --single-branch https://github.com/pothosware/SoapySDR.git + cd SoapySDR + #git checkout tags/release_003_010_001_001 + mkdir -p build + cd build + $CMAKE ../ + echo "Compiling SoapySDR" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + cd /tmp + echo "Downloading SoapyRemote" + rm -rf /tmp/soapyremote + git clone -b soapy-remote-0.5.0 --single-branch https://github.com/pothosware/SoapyRemote.git + cd SoapyRemote + #git checkout tags/release_003_010_001_001 + mkdir -p build + cd build + cmake ../ + echo "Compiling SoapyRemote" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + ) >& $soapy_install_log +} + +install_soapy_iris_from_source(){ + iris_install_log=$OPENAIR_DIR/cmake_targets/log/iris_install_log.txt + echo_info "\nInstalling Iris driver from source. The log file for Iris driver installation is here: $iris_install_log " + ( + cd /tmp + echo "Downloading SoapyIris" + rm -rf /tmp/sklk-soapyiris + git clone -b soapy-iris-2018.08.0.1 --single-branch https://github.com/skylarkwireless/sklk-soapyiris.git + cd sklk-soapyiris + mkdir -p build + cd build + cmake ../ + echo "Compiling SoapyIris" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + ) >& $iris_install_log +} + +check_install_soapy () { + #if [[ "$OS_DISTRO" == "ubuntu" ]]; then + #first we remove old installation + $SUDO apt-get remove -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote || true + #$SUDO add-apt-repository -y ppa:myriadrf/drivers + #$SUDO apt-get update + #$SUDO apt-get install -y soapysdr soapysdr-server libsoapysdr-dev python-soapysdr python3-soapysdr soapysdr-module-remote + + #elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then + # $SUDO $INSTALLER -y install software-properties-common python3-software-properties python-software-properties subversion git python3 python-numpy python3-numpy cmake swig python-dev + install_soapy_from_source + #fi + install_soapy_iris_from_source + +} + check_install_additional_tools (){ $SUDO $INSTALLER update -y if [[ "$OS_DISTRO" == "ubuntu" ]]; then @@ -683,7 +751,7 @@ install_asn1c_from_source(){ # better to use a given commit than a branch in case the branch # is updated and requires modifications in the source of OAI #git checkout velichkov_s1ap_plus_option_group - git checkout d3aed06bb2bec7df1b5c6d0333f8c7dfc5993372 + git checkout 0a7524184f16e7093990a31d8d4db487a16e5782 autoreconf -iv ./configure make -j`nproc` diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1 index cab4ad047b..b78ab34ff9 100755 --- a/cmake_targets/tools/init_nas_s1 +++ b/cmake_targets/tools/init_nas_s1 @@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko if [ "$1" = "UE" ]; then echo "bring up $LTEIF interface for UE" - ifconfig $LTEIF up + sudo ifconfig $LTEIF up fi -ip route flush cache +sudo ip route flush cache sleep 1 -sysctl -w net.ipv4.conf.all.log_martians=1 +sudo sysctl -w net.ipv4.conf.all.log_martians=1 echo "Disabling reverse path filtering" -sysctl -w net.ipv4.conf.all.rp_filter=0 -ip route flush cache +sudo sysctl -w net.ipv4.conf.all.rp_filter=0 +sudo ip route flush cache # Check table 200 lte in /etc/iproute2/rt_tables fgrep lte /etc/iproute2/rt_tables > /dev/null if [ $? -ne 0 ]; then echo "200 lte " >> /etc/iproute2/rt_tables fi -ip rule add fwmark 1 table lte -ip route add default dev $LTEIF table lte +sudo ip rule add fwmark 1 table lte +sudo ip route add default dev $LTEIF table lte diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh new file mode 100755 index 0000000000..bd4254c938 --- /dev/null +++ b/cmake_targets/tools/make_asn1c_includes.sh @@ -0,0 +1,15 @@ +#!/bin/bash +GENERATED_FULL_DIR=$1 +shift +ASN1_SOURCE_DIR=$1 +shift +export ASN1C_PREFIX=$1 +shift +options=$* +done_flag="$GENERATED_FULL_DIR"/done +if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then + rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h + mkdir -p "$GENERATED_FULL_DIR" + asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u +fi +touch $done_flag diff --git a/common/config/DOC/config.md b/common/config/DOC/config.md new file mode 100644 index 0000000000..580ac5476f --- /dev/null +++ b/common/config/DOC/config.md @@ -0,0 +1,11 @@ +# OAI configuration module + +The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include a mechanism to check that no unknown options have been entered on the command line + +## Documentation + +* [runtime usage](config/rtusage.md) +* [developer usage](config/devusage.md) +* [module architecture](config/arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/config/DOC/config/arch.md b/common/config/DOC/config/arch.md new file mode 100644 index 0000000000..170241500b --- /dev/null +++ b/common/config/DOC/config/arch.md @@ -0,0 +1,7 @@ +# config module source files +![configmodule_srcdir](/uploads/fdc3e96011fd5592440900dfa05b4701/configmodule_srcdir.png) +# config module components +![configmodule_components](/uploads/54f8a3953d5ee53717cd9a3b71f85c68/configmodule_components.png) + + +[Configuration module home](../config.md) \ No newline at end of file diff --git a/common/config/DOC/config/devusage.md b/common/config/DOC/config/devusage.md new file mode 100644 index 0000000000..bfc1180ab8 --- /dev/null +++ b/common/config/DOC/config/devusage.md @@ -0,0 +1,20 @@ +The configuration module objectives are +1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem. +1. Use a common configuration API in all oai modules +1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file. + +As a developer you may need to look at these sections: + +* [add parameters in an existing section](devusage/addaparam.md) +* [add a parameter set, in a new section](devusage/addparamset.md) +* [configuration module API](devusage/api.md) +* [configuration module public structures](devusage/struct.md) + +Whatever your need is, configuration module usage examples can be found in oai sources: +* complex example, using all the configuration module functionalities, including parameter checking: +[NB-IoT configuration code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_config.c) and [NB-IoT configuration include file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_paramdef.h) +* very simple example, just reading a parameter set corresponding to a dedicated section: the telnetsrv_autoinit function in [common/utils/telnetsrv/telnetsrv.c, around line 726](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv.c#L726) +* an example with run-time definition of parameters, in the logging sub-system: the log_getconfig function at the top of [openair2/UTIL/LOG/log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/UTIL/LOG/log.c) + + +[Configuration module home](../config.md) diff --git a/common/config/DOC/config/devusage/addaparam.md b/common/config/DOC/config/devusage/addaparam.md new file mode 100644 index 0000000000..b7bb8a73b9 --- /dev/null +++ b/common/config/DOC/config/devusage/addaparam.md @@ -0,0 +1,86 @@ +To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument. + +existing code: +```c +unsigned int varopt1; +paramdef_t someoptions[] = { +/*---------------------------------------------------------------------------------*/ +/* configuration parameters for some module */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*---------------------------------------------------------------------------------*/ + {"opt1", "", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 }, +}; + +config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection"); + +``` +new code: +```c +unsigned int varopt1; + + +/* varopt2 will be allocated by the config module and free at end_configmodule call + except if PARAMFLAG_NOFREE bit is set in paramflags field*/ +char *varopt2; +paramdef_t someoptions[] = { +/*---------------------------------------------------------------------------------*/ +/* configuration parameters for some module */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*---------------------------------------------------------------------------------*/ + {"opt1", "", 0, uptr:&varopt1, defuintval:0,TYPE_UINT, 0 }, + {"opt2", "", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 }, +}; + +config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection"); + +``` + +The corresponding configuration file may now include opt2 parameter in the somesection section: + +```c +somesection = +{ +opt1 = 3; +opt2 = "abcd"; +}; +``` + +In these examples the variables used to retrieve the parameters values are pointed by the `uptr` or `strptr` fields of the `paramdef_t` structure. After the `config_get` call `varopt1` and `varopt2` have been set to the value specified in the config file. It is also possible to specify a `NULL` value to the `< XXX >ptr` fields, which are then allocated by the config module and possibly free when calling `config_end()`, if the `PARAMFLAG_NOFREE` bit has not been set in the `paramflags` field. + +The configuration module provides a mechanism to check the parameter value read from the configuration source. The following functions are implemented: +1. Check an integer parameter against a list of authorized values +1. Check an integer parameter against a list of authorized values and set the parameter to a new value +1. Check an integer parameter against a range +1. Check a C string parameter against a list of authorized values +1. Check a C string parameter against a list of authorized values and set the parameter to a new integer value + + A `checkedparam_t` structure array provides the parameter verification procedures: + +```c +/* + definition of the verification to be done on param opt1 and opt2. + opt1 is an integer option we must be set to 0,2,3,4 or 7 in the + config source. + if opt1 is set to 0 in the config file, it will be set to 1, etc + opt2 is C string option with the authorize values "zero","oneThird","twoThird","one" + */ +#define OPT1_OKVALUES {0,2,3,4,7} +#define OPT1_NEWVALUES {1,1,0,6,9} +#define OPT2_OKVALUES {"zero","oneThird","twoThird","one"} + +#define OPT_CHECK_DESC { \ + { .s1a= { config_check_modify_integer, OPT1_OKVALUE, OPT1_NEWVALUES ,5 }}, \ + { .s3= { config_check_strval, OPT2_OKVALUES,4 }}, \ +} +checkedparam_t checkopt[] = OPT_CHECK_DESC; +..... +/* assign the verification procedures to the parameters definitions */ +for(int i=0 ; i < sizeof(someoptions)/sizeof(paramdesc_t) ; i ++) { + someoptions[i].chkPptr = &(checkopt[i]); +} +.... +``` +When you need a specific verification algorithm, you can provide your own verification function and use it in place of the available ones, in the `checkedparam_t` union. If no existing structure definition match your need, you can enhance the configuration module. You then have to add a new verification function in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_userapi.c and add a new structure definition in the `checkedparam_t` type defined in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h + +[Configuration module developer main page](../../config/devusage.md) +[Configuration module home](../../config.md) diff --git a/common/config/DOC/config/devusage/addparamset.md b/common/config/DOC/config/devusage/addparamset.md new file mode 100644 index 0000000000..130a7eda74 --- /dev/null +++ b/common/config/DOC/config/devusage/addparamset.md @@ -0,0 +1,131 @@ +The configuration module maps a configuration file section to a `paramdef_t` structure array. One `config_get` call can be used to return the values of all the parameters described in the `paramdef_t` array. +Retrieving a single occurence of a parameter set ( a group in the libconfig terminology) is just a two steps task: +1. describe the parameters in a `paramdef_t` array +1. call the `config_get` function + + +[config_get example](../../config/devusage/addaparam.md) + + +In oai some parameters set may be instantiated a variable number of occurrences. In a configuration file this is mapped to lists of group of parameters, with this syntax: +```c +NB-IoT_MACRLCs = +/* start list element 1 */ +( + /* start a group of parameters */ + { + num_cc = 2; + ..... + remote_s_portd = 55001; + } +), +/* start list element 2 */ +( + /* start a group of parameters */ + { + num_cc = 1; + ...... + remote_s_portd = 65001; + } +); + +``` +The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call. + +```c +/* name of section containing the list */ +#define NBIOT_MACRLCLIST_CONFIG_STRING "NB-IoT_MACRLCs" + +/* +The following macro define the parameters names, as used in the +configuration file +*/ +#define CONFIG_STRING_MACRLC_CC "num_cc" +..... +#define CONFIG_MACRLC_S_PORTD "remote_s_portd" + +/* + now define a macro which will be used to initialize the NbIoT_MacRLC_Params + variable. NbIoT_MacRLC_Params is an array of paramdef_t structure, each item + describing a parameter. When using the config_getlist call you must let the config + module allocate the memory for the parameters values. +*/ +/*------------------------------------------------------------------------------------------------------------*/ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*------------------------------------------------------------------------------------------------------------*/ + +#define MACRLCPARAMS_DESC { \ +{CONFIG_STRING_MACRLC_CC, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ +............. \ +{CONFIG_MACRLC_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ +} + +/* +the following macros define the indexes used to access the NbIoT_MacRLC_Params array +items. They must be maintained consistent with the previous MACRLCPARAMS_DESC macro +which is used to initialize the NbIoT_MacRLC_Params variable +*/ +#define MACRLC_CC_IDX 0 +......... +#define MACRLC_REMOTE_S_PORTD_IDX 16 + + + +void RCconfig_NbIoTmacrlc(void) { + + +/* + define and initialize the array of paramdef_t structures describing the groups of + parameters we want to read. It will be passed as the second argument of the + config_getlist call, which will use it as an input only argument. +*/ + paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC; + +/* + now define and initialize a paramlist_def_t structure which will be passed + to the config_getlist call. The first field is the only one to be initialized + it contains the name of the section to be read. + that section contains the list of group of parameters. + The two other fields are output parameters used to return respectively + a pointer to a two dimensional array of paramdef_t structures pointers, and the + number of items in the list of groups (size of first dimension, the second one + being the number of parameters in each group. +*/ + paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0}; + + + /* + the config_getlist will allocate the second field of the paramlist_def_t structure, a +two dimensional array of paramdef_t pointers. In each param_def item it will allocate +the value pointer and set the value to what it will get from the config source. The +numelt field of the paramlist_def_t structure will be set to the number of groups of +parameters in the list. + in this example the last argument of config_getlist is unused, it may contain a +character string, used as a prefix for the section name. It has to be specified when the +list to be read is under another section. +*/ + config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params, + sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t), + NULL); + +/* + start a loop in the nuber of groups in the list, the numelt field of the + paramlist_def_t structure has been set in the config_getlist call +*/ + for (j=0 ; jeth_params_s.remote_portd = + *(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); +............ + + } // MacRLC_ParamList.numelt > 0 +} + + +``` + +[Configuration module developer main page](../../config/devusage.md) +[Configuration module home](../../config.md) diff --git a/common/config/DOC/config/devusage/api.md b/common/config/DOC/config/devusage/api.md new file mode 100644 index 0000000000..56b444a447 --- /dev/null +++ b/common/config/DOC/config/devusage/api.md @@ -0,0 +1,48 @@ +```c +configmodule_interface_t *load_configmodule(int argc, char **argv) +``` +* Parses the command line options, looking for the –O argument +* Loads the `libparams_.so` (today `libparams_libconfig.so`) shared library +* Looks for `config__init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option +* Looks for `config__get`, `config__getlist` and `config__end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional. +* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source. + +```c +void End_configmodule(void) +``` +* Free memory which has been allocated by the configuration module since its initialization. +* Possibly calls the `config__end` function + +```c +int config_get(paramdef_t *params,int numparams, char *prefix) +``` +* Reads as many parameters as described in params, they must all be in the same configuration file section +* Calls the `config__get` function +* Calls the `config_process_cmdline` function +* `params` points to an array of `paramdef_t` structures which describes the parameters to be read, possibly including a pointer to a checking function. The following bits can possibly be set in the `paramflags` mask before calling + - `PARAMFLAG_MANDATORY`: -1 is returned if the parameter is not explicitly defined in the config source. + - `PARAMFLAG_DISABLECMDLINE`: parameter cannot be modified via the command line + - `PARAMFLAG_DONOTREAD`: ignore the parameter, can be used at run-time, to alter a pre-defined `paramdef_t` array which is used in several `config_get` or/and `config_getlist` calls. + - `PARAMFLAG_NOFREE`: do not free the memory possibly allocated by the config module to store the value of the parameter. Default behavior is for the config module to free the memory it has allocated when the `config_end` function is called. + - `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1. + +* `params` is also used as an output parameter, `< XXX >ptr >` field is used by the config module to store the value it has read. The following bits can possibly be set in the `paramflags` mask after the call: + - `PARAMFLAG_MALLOCINCONFIG`: memory has been allocated for the ` < XXX >ptr > ` field + - `PARAMFLAG_PARAMSET`: parameter has been found in the config source, it is not set to default value. + - `PARAMFLAG_PARAMSET`: parameter has been set to its default value +* `numparams` is the number of entries in the params array +* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology). +* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured + +```c +int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) +``` +* Reads multiple occurrences of a parameters array +* Calls the `config__get` function for each list occurrence +* `params` points to an array of `paramdef_t` structures which describes the parameters in each occurrence of the list +* `ParamList` points to a structure, where `paramarray` field points to an array of `paramdef_t` structure, allocated by the function. It is used to return the values of the parameters. +* The returned value is the number of occurrences in the list or -1 in case of severe error + + +[Configuration module developer main page](../../config/devusage.md) +[Configuration module home](../../config.md) diff --git a/common/config/DOC/config/devusage/struct.md b/common/config/DOC/config/devusage/struct.md new file mode 100644 index 0000000000..236c1b4e03 --- /dev/null +++ b/common/config/DOC/config/devusage/struct.md @@ -0,0 +1,85 @@ +# `paramdef_t`structure +It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L103). This structure is used by developers to describe parameters and by the configuration module to return parameters value. A pointer to a `paramdef_t` array is passed to `config_get` and `config_getlist` calls to instruct the configuration module what parameters it should read. + +| Fields | Description | I/O | +|:-----------|:------------------------------------------------------------------|----:| +| `optname` | parameter name, as used when looking for it in the config source, 63 bytes max (64 with trailing \0) | I | +| `helstr` | pointer to a C string printed when using --help on the command line | I | +| `strptr` `strlistptr` `u8ptr` `i8ptr` `u16ptr` `i16ptr` `uptr` `iptr` `u64ptr` `i64ptr` `dblptr` `voidptr` | a pointer to a variable where the parameter value(s) will be returned. This field is an anonymous union, the supported pointer types have been built to avoid type mismatch warnings at compile time. | O | +| `defstrval` `defstrlistval` `defuintval` `defintval` `defint64val` `defintarrayval` `defdblval` | this field is an anonymous union, it can be used to define the default value for the parameter. It is ignored if `PARAMFLAG_MANDATORY` is set in the `paramflags` field.| I | +| `type` | Supported parameter types are defined as integer macros. Supported simple types are `TYPE_STRING`, parameter value is returned in `strptr` field, `TYPE_INT8` `TYPE_UINT8` `TYPE_INT16` `TYPE_UINT16` `TYPE_INT32` `TYPE_UINT32` `TYPE_INT64` `TYPE_UINT64`, parameter value is returned in the corresponding uXptr or iXptr, `TYPE_MASK`, value is returned in `u32ptr`, `TYPE_DOUBLE` value is returned in `dblptr`, `TYPE_IPV4ADDR` value is returned in binary, network bytes order in `u32ptr` field. `TYPE_STRINGLIST`, `TYPE_INTARRAY` and `TYPE_UINTARRAY` are multiple values types. Multiple values are returned in respectively, `strlistptr`, `iptr` and `uptr` fields which then point to arrays. The `numelt` field gives the number of item in the array. | I | +| `numelt` | For `TYPE_STRING` where `strptr` points to a preallocated string, this field must contain the size in bytes of the available memory. For all multiple values types, this field contains the number of values in the value field.| I/O | +| `chkPptr` | possible pointer to the structure containing the info used to check parameter values | I | +| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O | + +# `paramlist_def_t`structure +It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160). +It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters. + +| Fields | Description | I/O | +|:-----------|:------------------------------------------------------------------|----:| +| `listname` | Name of the section containing the list, 63 bytes max (64 with trailing \0). It is used to prefix each paramater name when looking for its value. In the libconfig syntax, the parameter name full path build by the configuration module is: listname.[occurence index].optname. | I | +| `paramarray` | Pointer to an array of `ǹumelt` `paramdef_t` pointers. It is allocated by the configuration module and is used to return the parameters values. All input fields of each `paramdef_t` occurence are a copy of the `paramdef_t` argument passed to the `config_getlist` call. | O | +| `numelt` | Number of items in the `paramarray` field | O | + +# `checkedparam_t` union +It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62). +This union of structures is used to provide a parameter checking mechanism. Each `paramdef_t` instance may include a pointer to a `checkedparam_t`structure which is then used by the configuration module to check the value it got from the config source. +Each structure in the union provides one parameter verification method, which returns `-1` when the verification fails. Currently the following structures are defined in the `checkedparam_t` union: + +| structure name | Description | +|:-----------|:------------------------------------------------------------------|----:| +| `s1` | check an integer against a list of authorized values | +| `s1a` | check an integer against a list of authorized values and set the parameter value to another integer depending on the read value| +| `s2` | check an integer against an authorized range, defined by its min and max value| +| `s3` | check a string against a list of authorized values | +| `s3a` | check a string against a list of authorized values and set the parameter value to an integer depending on the read value| +| `s4` | generic structure, to be used to provide a specific, not defined in the configuration module, verification algorithm | + +each of these structures provide the required fields to perform the specified parameter check. The first field is a pointer to a function, taking one argument, the `paramdef_t` structure describing the parameter to be checked. This function is called by the configuration module, in the `config_get` call , after the parameter value has been set, it then uses the other fields of the structure to perform the check. +The configuration module provides an implementation of the functions to be used to check parameters, qs described below. + +## `s1` structure +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f1` | pointer to the checking function. Initialize to `config_check_intval` to use the config module implementation | +| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values | +| `num_okintval` | number of used values in `okintval` | + +## `s1a` structure +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f1a` | pointer to the checking function. Initialize to `config_check_modify_integer` to use the config module implementation | +| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values | +| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okintval[i]` | +| `num_okintval` | number of used values in `okintval` and `setintval` | + +## `s2` structure +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f2` | pointer to the checking function. Initialize to `config_check_intrange` to use the config module implementation | +| `okintrange` | array of 2 integers containing the min and max values for the parameter | + +## `s3` structure +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f3` | pointer to the checking function. Initialize to `config_check_strval` to use the config module implementation | +| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values | +| `num_okstrval` | number of used values in `okstrtval` | + + +## `s3a` structure +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f3a` | pointer to the checking function. Initialize to `config_checkstr_assign_integer` to use the config module implementation | +| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values | +| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okstrval[i]` | +| `num_okstrval` | number of used values in `okintval` and `setintval` | + +## `s4` and `s5` structures +| field | Description | +|:-----------|:------------------------------------------------------------------| +| `f4` or `f5` | pointer to the checking function. they are generic structures to be used when no existing structure provides the required parameter verification. `f4` takes one argument, the `paramdef_t` structure corresponding to the parameter to be checked (`int (*f4)(paramdef_t *param)`), `f5` taxes no argument (`void (*checkfunc)(void)`) | + +[Configuration module developer main page](../../config/devusage.md) +[Configuration module home](../../config.md) diff --git a/common/config/DOC/config/rtusage.md b/common/config/DOC/config/rtusage.md new file mode 100644 index 0000000000..19519ef058 --- /dev/null +++ b/common/config/DOC/config/rtusage.md @@ -0,0 +1,52 @@ + + -O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters: +```bash +$ ./lte-softmodem -O :::... +``` + The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim) + +Currently the available config sources are: + +- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module. +```bash +$ ./lte-softmodem -O libconfig::dbgl +``` +- **cmdlineonly**: command line only, the default mode for lte-uesoftmodem and the phy simiulators. In this case -O may be used to specify the config module debug level. + +The debug level is a mask: +* bit 1: print parameters values +* bit 2: print memory allocation/free performed by the config module +* bit 3: print command line processing messages +* bit 4: disable execution abort when parameters checking fails + +As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages). + +```bash +$ ./lte-softmodem -O libconfig::dbgl1 +``` +```bash +$ ./lte-uesoftmodem -O cmdlineonly:dbgl1 +``` +For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level. + +```bash +$ ./lte-softmodem -O +``` + +Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file: + +``` +config: +{ + debugflags = 1; +} +``` +Configuration files examples can be found in the targets/PROJECTS/GENERIC-LTE-EPC/CONF sub-directory of the oai source tree. To minimize the number of configuration file to maintain, any parameter can also be specified on the command line. For example to modify the lte bandwidth to 20 MHz where the configuration file specifies 10MHz you can enter: + +```bash +$ ./lte-softmodem -O --eNBs.[0].component_carriers.[0].N_RB_DL 100 +``` + +As specified earlier, use the dbgl1 debug level to get the full name of a parameter you would like to modify on the command line. + +[Configuration module home](../config.md) \ No newline at end of file diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 3bd41cf6cc..635287afb4 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -20,7 +20,7 @@ */ /*! \file common/config/cmdline/config_libconfig.c - * \brief configuration module, command line parsing implementation + * \brief configuration module, command line parsing implementation * \author Francois TABURET * \date 2017 * \version 0.1 @@ -39,181 +39,250 @@ #include "config_userapi.h" -int parse_stringlist(paramdef_t *cfgoptions, char *val) -{ -char *atoken; -char *tokctx; -char *tmpval=strdup(val); -int numelt=0; +int parse_stringlist(paramdef_t *cfgoptions, char *val) { + char *atoken; + char *tokctx; + char *tmpval=strdup(val); + int numelt=0; + cfgoptions->numelt=0; + atoken=strtok_r(tmpval, ",",&tokctx); - cfgoptions->numelt=0; + while(atoken != NULL) { + numelt++ ; + atoken=strtok_r(NULL, ",",&tokctx); + } - atoken=strtok_r(tmpval, ",",&tokctx); - while(atoken != NULL) { - numelt++ ; - atoken=strtok_r(NULL, ",",&tokctx); - } - free(tmpval); - config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt); - cfgoptions->numelt=numelt; + free(tmpval); + config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt); + cfgoptions->numelt=numelt; + atoken=strtok_r(val, ",",&tokctx); - atoken=strtok_r(val, ",",&tokctx); - for( int i=0; inumelt && atoken != NULL ; i++) { - config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1); - sprintf(cfgoptions->strlistptr[i],"%s",atoken); - printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]); - atoken=strtok_r(NULL, ",",&tokctx); - } - return (cfgoptions->numelt > 0); -} - -int processoption(paramdef_t *cfgoptions, char *value) -{ -char *tmpval = value; -int optisset=0; -char defbool[2]="1"; + for( int i=0; inumelt && atoken != NULL ; i++) { + config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1); + sprintf(cfgoptions->strlistptr[i],"%s",atoken); + printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]); + atoken=strtok_r(NULL, ",",&tokctx); + } - - if ( value == NULL) { - if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */ - fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname); - return 0; - } else { /* boolean value option without argument, set value to true*/ - tmpval = defbool; - } - } - switch(cfgoptions->type) - { - case TYPE_STRING: - if (cfgoptions->numelt == 0 ) { - config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1); - sprintf(*(cfgoptions->strptr), "%s",tmpval); - } else { - sprintf( (char *)(cfgoptions->strptr), "%s",tmpval); - } - printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval); - optisset=1; - break; - - case TYPE_STRINGLIST: - optisset=parse_stringlist(cfgoptions,tmpval); - break; - case TYPE_UINT32: - case TYPE_INT32: - case TYPE_UINT16: - case TYPE_INT16: - case TYPE_UINT8: - case TYPE_INT8: - config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t)); - config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0)); - optisset=1; - break; - case TYPE_UINT64: - case TYPE_INT64: - config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t)); - *(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0); - printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr)); - optisset=1; - break; - case TYPE_UINTARRAY: - case TYPE_INTARRAY: - - break; - case TYPE_DOUBLE: - config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); - *(cfgoptions->dblptr) = strtof(tmpval,NULL); - printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr)); - optisset=1; - break; - - case TYPE_IPV4ADDR: - - break; - - default: - fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type); - break; - } /* switch on param type */ - if (optisset == 1) { - cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET; - } - return optisset; + return (cfgoptions->numelt > 0); } -int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) -{ +int processoption(paramdef_t *cfgoptions, char *value) { + char *tmpval = value; + int optisset=0; + char defbool[2]="1"; + + if ( value == NULL) { + if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */ + fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname); + exit_fun("[CONFIG] command line parsing fatal error"); + return 0; + } else { /* boolean value option without argument, set value to true*/ + tmpval = defbool; + } + } + + switch(cfgoptions->type) { + case TYPE_STRING: + if (cfgoptions->numelt == 0 ) { + config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1); + sprintf(*(cfgoptions->strptr), "%s",tmpval); + } else { + sprintf( (char *)(cfgoptions->strptr), "%s",tmpval); + } + + printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval); + optisset=1; + break; + + case TYPE_STRINGLIST: + optisset=parse_stringlist(cfgoptions,tmpval); + break; + + case TYPE_UINT32: + case TYPE_INT32: + case TYPE_UINT16: + case TYPE_INT16: + case TYPE_UINT8: + case TYPE_INT8: + config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t)); + config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0)); + optisset=1; + break; + + case TYPE_UINT64: + case TYPE_INT64: + config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t)); + *(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0); + printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr)); + optisset=1; + break; + + case TYPE_UINTARRAY: + case TYPE_INTARRAY: + break; + + case TYPE_DOUBLE: + config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); + *(cfgoptions->dblptr) = strtof(tmpval,NULL); + printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr)); + optisset=1; + break; + + case TYPE_IPV4ADDR: + break; + + default: + fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type); + break; + } /* switch on param type */ + + if (optisset == 1) { + cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET; + } + + return optisset; +} + +/*--------------------------------------------------------------------*/ +/* check unknown options in the command line +*/ +int config_check_unknown_cmdlineopt(char *prefix) { + int unknowndetected=0; + char testprefix[CONFIG_MAXOPTLENGTH]=""; + int finalcheck = 0; + + if (prefix != NULL) { + if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0) + finalcheck = 1; + else if (strlen(prefix) > 0) { + sprintf(testprefix,"--%s.",prefix); + } + } + + for (int i=1; iargc ; i++) { + if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue; + + if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue; + + if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue; + + if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue; + + if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) { + fprintf(stderr,"[CONFIG] unknown option: %s\n", + config_get_if()->argv[i] ); + unknowndetected++; + } + } + + printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n", + unknowndetected,testprefix,((prefix==NULL)?"":prefix)); + return unknowndetected; +} /* config_check_unknown_cmdlineopt */ + +int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) { int c = config_get_if()->argc; int i,j; char *pp; - char cfgpath[512]; /* 512 should be enough for the sprintf below */ - + char cfgpath[CONFIG_MAXOPTLENGTH]; j = 0; i = 0; - while (c > 0 ) { - char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */ - /* first check help options, either --help, -h or --help_
*/ - if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) { - char *tokctx; - pp=strtok_r(oneargv, "_",&tokctx); - if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) { - if( prefix == NULL) { - config_printhelp(cfgoptions,numoptions); - if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) - exit_fun("[CONFIG] Exiting after displaying help\n"); - } - } else { - pp=strtok_r(NULL, " ",&tokctx); - if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) { - printf ("Help for %s section:\n",prefix); - config_printhelp(cfgoptions,numoptions); - if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) { - fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix); - exit_fun(" Exiting after displaying help\n"); - } - } - } + + while (c > 0 ) { + char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */ + + /* first check help options, either --help, -h or --help_
*/ + if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) { + char *tokctx; + pp=strtok_r(oneargv, "_",&tokctx); + config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; + + if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) { + if( prefix == NULL) { + config_printhelp(cfgoptions,numoptions); + + if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) + exit_fun("[CONFIG] Exiting after displaying help\n"); + } + } else { + pp=strtok_r(NULL, " ",&tokctx); + + if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) { + printf ("Help for %s section:\n",prefix); + config_printhelp(cfgoptions,numoptions); + + if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) { + fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix); + exit_fun(" Exiting after displaying help\n"); + } + } + } + } + + /* now, check for non help options */ + if (oneargv[0] == '-') { + for(int n=0; n 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) { - char *valptr=NULL; - int ret; - if (c > 0) { - pp = config_get_if()->argv[i+1]; - if (pp != NULL ) { - ret = strlen(pp); - if (ret > 0 ) { - if (pp[0] != '-') - valptr=pp; - else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) ) - valptr=pp; - } - } - } - j += processoption(&(cfgoptions[n]), valptr); - if ( valptr != NULL ) { - i++; - c--; - } - break; - } - } /* for n... */ - } /* if (oneargv[0] == '-') */ - free(oneargv); - i++; - c--; - } /* fin du while */ + if (prefix != NULL) { + sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname); + } else { + sprintf(cfgpath,"%s",cfgoptions[n].optname); + } + + if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) { + char *valptr=NULL; + int ret; + config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; + + if (c > 0) { + pp = config_get_if()->argv[i+1]; + + if (pp != NULL ) { + ret = strlen(pp); + + if (ret > 0 ) { + if (pp[0] != '-') + valptr=pp; + else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) ) + valptr=pp; + } + } + } + + j += processoption(&(cfgoptions[n]), valptr); + + if ( valptr != NULL ) { + i++; + config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; + c--; + } + + break; + } + } /* for n... */ + } /* if (oneargv[0] == '-') */ + + free(oneargv); + i++; + c--; + } /* fin du while */ + printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j); - return j; + + if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) { + i=config_check_unknown_cmdlineopt(prefix); + + if (i > 0) { + fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n", + i,((prefix==NULL)?"\"root section\"":prefix)); + exit_fun(" Exiting after detecting errors in command line \n"); + } + } + + return j; } /* parse_cmdline*/ diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 2c6700c73e..e20672aa02 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -20,7 +20,7 @@ */ /*! \file common/config/config_load_configmodule.c - * \brief configuration module, load the shared library implementing the configuration module + * \brief configuration module, load the shared library implementing the configuration module * \author Francois TABURET * \date 2017 * \version 0.1 @@ -42,282 +42,314 @@ #include "config_userapi.h" #define CONFIG_SHAREDLIBFORMAT "libparams_%s.so" -int load_config_sharedlib(configmodule_interface_t *cfgptr) -{ -void *lib_handle; -char fname[128]; -char libname[FILENAME_MAX]; -int st; +int load_config_sharedlib(configmodule_interface_t *cfgptr) { + void *lib_handle; + char fname[128]; + char libname[FILENAME_MAX]; + int st; + st=0; + sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode); + lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); - st=0; - sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode); + if (!lib_handle) { + fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror()); + st = -1; + } else { + sprintf (fname,"config_%s_init",cfgptr->cfgmode); + cfgptr->init = dlsym(lib_handle,fname); - lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); - if (!lib_handle) { - fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror()); + if (cfgptr->init == NULL ) { + printf("[CONFIG] %s %d no function %s for config mode %s\n", + __FILE__, __LINE__,fname, cfgptr->cfgmode); + } else { + st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP); + printf("[CONFIG] function %s returned %i\n", + fname, st); + } + + sprintf (fname,"config_%s_get",cfgptr->cfgmode); + cfgptr->get = dlsym(lib_handle,fname); + + if (cfgptr->get == NULL ) { + printf("[CONFIG] %s %d no function %s for config mode %s\n", + __FILE__, __LINE__,fname, cfgptr->cfgmode); st = -1; - } else { - sprintf (fname,"config_%s_init",cfgptr->cfgmode); - cfgptr->init = dlsym(lib_handle,fname); + } - if (cfgptr->init == NULL ) { - printf("[CONFIG] %s %d no function %s for config mode %s\n", - __FILE__, __LINE__,fname, cfgptr->cfgmode); - } else { - st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP); - printf("[CONFIG] function %s returned %i\n", - fname, st); - } + sprintf (fname,"config_%s_getlist",cfgptr->cfgmode); + cfgptr->getlist = dlsym(lib_handle,fname); - sprintf (fname,"config_%s_get",cfgptr->cfgmode); - cfgptr->get = dlsym(lib_handle,fname); - if (cfgptr->get == NULL ) { - printf("[CONFIG] %s %d no function %s for config mode %s\n", - __FILE__, __LINE__,fname, cfgptr->cfgmode); - st = -1; - } - - sprintf (fname,"config_%s_getlist",cfgptr->cfgmode); - cfgptr->getlist = dlsym(lib_handle,fname); - if (cfgptr->getlist == NULL ) { - printf("[CONFIG] %s %d no function %s for config mode %s\n", - __FILE__, __LINE__,fname, cfgptr->cfgmode); - st = -1; - } + if (cfgptr->getlist == NULL ) { + printf("[CONFIG] %s %d no function %s for config mode %s\n", + __FILE__, __LINE__,fname, cfgptr->cfgmode); + st = -1; + } - sprintf (fname,"config_%s_end",cfgptr->cfgmode); - cfgptr->end = dlsym(lib_handle,fname); - if (cfgptr->getlist == NULL ) { - printf("[CONFIG] %s %d no function %s for config mode %s\n", - __FILE__, __LINE__,fname, cfgptr->cfgmode); - } - } - - return st; + sprintf (fname,"config_%s_end",cfgptr->cfgmode); + cfgptr->end = dlsym(lib_handle,fname); + + if (cfgptr->getlist == NULL ) { + printf("[CONFIG] %s %d no function %s for config mode %s\n", + __FILE__, __LINE__,fname, cfgptr->cfgmode); + } + } + + return st; } /*-----------------------------------------------------------------------------------*/ /* from here: interface implementtion of the configuration module */ int nooptfunc(void) { - return 0; + return 0; }; -int config_cmdlineonly_getlist(paramlist_def_t *ParamList, - paramdef_t *params, int numparams, char *prefix) -{ - ParamList->numelt = 0; - return 0; +int config_cmdlineonly_getlist(paramlist_def_t *ParamList, + paramdef_t *params, int numparams, char *prefix) { + ParamList->numelt = 0; + return 0; } -int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) -{ +int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { int defval; int fatalerror=0; int numdefvals=0; - - for(int i=0;i option, default cfgmode to libconfig - with one parameter, the path to the configuration file */ - modeparams=cfgmode; - cfgmode=strdup(CONFIG_LIBCONFIGFILE); - } + tmpflags = tmpflags | CONFIG_NOOOPT; - cfgptr = malloc(sizeof(configmodule_interface_t)); - memset(cfgptr,0,sizeof(configmodule_interface_t)); + if ( initflags & CONFIG_ENABLECMDLINEONLY) { + cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; + } else { + cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; + cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME; + } + } - cfgptr->rtflags = cfgptr->rtflags | tmpflags; - cfgptr->argc = argc; - cfgptr->argv = argv; - cfgptr->cfgmode=strdup(cfgmode); - cfgptr->num_cfgP=0; - atoken=strtok_r(modeparams,":",&strtokctx); - while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) { - /* look for debug level in the config parameters, it is commom to all config mode - and will be removed frome the parameter array passed to the shared module */ - char *aptr; - aptr=strcasestr(atoken,"dbgl"); - if (aptr != NULL) { - cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0); + /* parse the config parameters to set the config source */ + i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams); - } else { - cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken); - cfgptr->num_cfgP++; - } - atoken = strtok_r(NULL,":",&strtokctx); - } + if (i< 0) { + fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno)); + exit(-1) ; + } else if ( i == 1 ) { + /* -O argument doesn't contain ":" separator, assume -O option, default cfgmode to libconfig + with one parameter, the path to the configuration file cfgmode must not be NULL */ + modeparams=cfgmode; + cfgmode=strdup(CONFIG_LIBCONFIGFILE); + } - - printf("[CONFIG] get parameters from %s ",cfgmode); - for (i=0;inum_cfgP; i++) { - printf("%s ",cfgptr->cfgP[i]); - } - printf(", debug flags: 0x%08x\n",cfgptr->rtflags); + cfgptr = calloc(sizeof(configmodule_interface_t),1); + cfgptr->argv_info = calloc(sizeof(int32_t), argc); + cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED; - if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) { - i=load_config_sharedlib(cfgptr); - if (i == 0) { - printf("[CONFIG] config module %s loaded\n",cfgmode); - Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags); - config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME ); - } else { - fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode); - cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT; - } - } else { - cfgptr->init = (configmodule_initfunc_t)nooptfunc; - cfgptr->get = config_cmdlineonly_get; - cfgptr->getlist = config_cmdlineonly_getlist; - cfgptr->end = (configmodule_endfunc_t)nooptfunc; - } + if (OoptIdx >= 0) { + cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED; + cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED; + } - + cfgptr->rtflags = cfgptr->rtflags | tmpflags; + cfgptr->argc = argc; + cfgptr->argv = argv; + cfgptr->cfgmode=strdup(cfgmode); + cfgptr->num_cfgP=0; + atoken=strtok_r(modeparams,":",&strtokctx); - if (modeparams != NULL) free(modeparams); - if (cfgmode != NULL) free(cfgmode); - if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { - config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); -// exit(-1); - } - return cfgptr; + while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) { + /* look for debug level in the config parameters, it is commom to all config mode + and will be removed frome the parameter array passed to the shared module */ + char *aptr; + aptr=strcasestr(atoken,"dbgl"); + + if (aptr != NULL) { + cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0); + } else { + cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken); + cfgptr->num_cfgP++; + } + + atoken = strtok_r(NULL,":",&strtokctx); + } + + printf("[CONFIG] get parameters from %s ",cfgmode); + + for (i=0; inum_cfgP; i++) { + printf("%s ",cfgptr->cfgP[i]); + } + + printf(", debug flags: 0x%08x\n",cfgptr->rtflags); + + if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) { + i=load_config_sharedlib(cfgptr); + + if (i == 0) { + printf("[CONFIG] config module %s loaded\n",cfgmode); + Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags); + config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME ); + } else { + fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode); + cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT; + } + } else { + cfgptr->init = (configmodule_initfunc_t)nooptfunc; + cfgptr->get = config_cmdlineonly_get; + cfgptr->getlist = config_cmdlineonly_getlist; + cfgptr->end = (configmodule_endfunc_t)nooptfunc; + } + + if (modeparams != NULL) free(modeparams); + + if (cfgmode != NULL) free(cfgmode); + + if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { + config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); + // exit(-1); + } + + return cfgptr; } /* free memory allocated when reading parameters */ /* config module could be initialized again after this call */ -void end_configmodule(void) -{ +void end_configmodule(void) { if (cfgptr != NULL) { - if (cfgptr->end != NULL) { - printf ("[CONFIG] calling config module end function...\n"); - cfgptr->end(); - } + if (cfgptr->end != NULL) { + printf ("[CONFIG] calling config module end function...\n"); + cfgptr->end(); + } - printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs); - for(int i=0; inumptrs ; i++) { - if (cfgptr->ptrs[i] != NULL) { - free(cfgptr->ptrs[i]); - cfgptr->ptrs[i]=NULL; - } + printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs); + + for(int i=0; inumptrs ; i++) { + if (cfgptr->ptrs[i] != NULL) { + free(cfgptr->ptrs[i]); + cfgptr->ptrs[i]=NULL; } - cfgptr->numptrs=0; + } + + cfgptr->numptrs=0; } } /* free all memory used by config module */ /* should be called only at program exit */ -void free_configmodule(void) -{ +void free_configmodule(void) { if (cfgptr != NULL) { - end_configmodule(); - if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode); - printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP); - for (int i=0; inum_cfgP; i++) { - if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]); - } + end_configmodule(); + if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode); - free(cfgptr); - cfgptr=NULL; + printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP); + + for (int i=0; inum_cfgP; i++) { + if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]); + } + + free(cfgptr); + cfgptr=NULL; } } diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index ff3fa80f4e..2f5c055a00 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -20,8 +20,8 @@ */ /*! \file common/config/config_load_configmodule.h - * \brief: configuration module, include file to be used by the source code calling the - * configuration module initialization + * \brief: configuration module, include file to be used by the source code calling the + * configuration module initialization * \author Francois TABURET * \date 2017 * \version 0.1 @@ -31,12 +31,13 @@ * \warning */ #ifndef INCLUDE_CONFIG_LOADCONFIGMODULE_H -#define INCLUDE_CONFIG_LOADCONFIGMODULE_H +#define INCLUDE_CONFIG_LOADCONFIGMODULE_H #include #include #include "common/config/config_paramdesc.h" +#include "common/utils/T/T.h" #define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O :P1:P2... #define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module @@ -44,12 +45,14 @@ #define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file #define CONFIG_CMDLINEONLY "cmdline" // use only command line options #define DEFAULT_CFGFILENAME "oai.conf" // default config file - -/* rtflags bit position definitions */ +/* bit position definition for the argv_info mask of the configmodule_interface_t structure */ +#define CONFIG_CMDLINEOPT_PROCESSED (1<<0) // command line option has been processed +/* bit position definitions for the rtflags mask of the configmodule_interface_t structure*/ #define CONFIG_PRINTPARAMS 1 // print parameters values while processing #define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages #define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages -#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails +#define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options +#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails #define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help #define CONFIG_HELP (1<<20) // print help message #define CONFIG_ABORT (1<<21) // config failed,abort execution @@ -58,10 +61,10 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix); typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix); typedef void(*configmodule_endfunc_t)(void); -typedef struct configmodule_interface -{ +typedef struct configmodule_interface { int argc; char **argv; + uint32_t *argv_info; char *cfgmode; int num_cfgP; char *cfgP[CONFIG_MAX_OOPT_PARAMS]; @@ -71,7 +74,7 @@ typedef struct configmodule_interface configmodule_endfunc_t end; uint32_t numptrs; uint32_t rtflags; - char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; + char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; } configmodule_interface_t; #ifdef CONFIG_LOADCONFIG_MAIN @@ -81,17 +84,17 @@ static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugfl debugflags can also be defined in the config_libconfig section of the config file\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ 4->print command line processing debug messages\n "; - + #define CONFIG_SECTIONNAME "config" #define CONFIGPARAM_DEBUGFLAGS_IDX 0 static paramdef_t Config_Params[] = { -/*-----------------------------------------------------------------------------------------------------------------------*/ -/* config parameters for config module */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*-----------------------------------------------------------------------------------------------------------------------*/ -{"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0}, + /*-----------------------------------------------------------------------------------------------------------------------*/ + /* config parameters for config module */ + /* optname helpstr paramflags XXXptr defXXXval type numelt */ + /*-----------------------------------------------------------------------------------------------------------------------*/ + {"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0}, }; #else @@ -100,10 +103,11 @@ extern configmodule_interface_t *cfgptr; #define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); } -#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); } +#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); } - -extern configmodule_interface_t *load_configmodule(int argc, char **argv); + +#define CONFIG_ENABLECMDLINEONLY (1<<1) +extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags); extern void end_configmodule(void); #endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */ diff --git a/common/config/config_paramdesc.h b/common/config/config_paramdesc.h index c65e298dfb..627c232f85 100644 --- a/common/config/config_paramdesc.h +++ b/common/config/config_paramdesc.h @@ -38,7 +38,7 @@ #define MAX_OPTNAME_SIZE 64 - +#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[].prefix2.optname */ /* parameter flags definitions */ @@ -55,83 +55,81 @@ #define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions #define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions - /* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */ #define CONFIG_MAX_NUMCHECKVAL 20 typedef struct paramdef paramdef_t; typedef union checkedparam { - struct { - int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */ - int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */ - int num_okintval; /* number of valid values in the checkingval array */ - } s1; - struct { - int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */ - /* to the corresponding item in setintval array (mainly for RRC params) */ - int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */ - int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ - int num_okintval; /* number of valid values in the checkingval array */ - } s1a; - struct { - int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */ - int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */ - - } s2; - struct { - int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */ - char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ - int num_okstrval; /* number of valid values in the checkingval array */ - } s3; - struct { - int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */ - /* to the corresponding item in setintval array (mainly for RRC params) */ - char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ - int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ - int num_okstrval; /* number of valid values in the checkingval array */ - } s3a; - struct { - int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */ - - } s4; - struct { - void (*checkfunc)(void) ; - } s5; + struct { + int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */ + int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */ + int num_okintval; /* number of valid values in the checkingval array */ + } s1; + struct { + int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */ + /* to the corresponding item in setintval array (mainly for RRC params) */ + int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */ + int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ + int num_okintval; /* number of valid values in the checkingval array */ + } s1a; + struct { + int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */ + int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */ + + } s2; + struct { + int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */ + char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ + int num_okstrval; /* number of valid values in the checkingval array */ + } s3; + struct { + int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */ + /* to the corresponding item in setintval array (mainly for RRC params) */ + char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ + int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ + int num_okstrval; /* number of valid values in the checkingval array */ + } s3a; + struct { + int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */ + + } s4; + struct { + void (*checkfunc)(void) ; + } s5; } checkedparam_t; /* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */ /* config apis used to retrieve parameters values */ -typedef struct paramdef -{ - char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */ - char *helpstr; /* help string */ - unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */ - union { /* pointer to the parameter value, completed by the config module */ - char **strptr; - char **strlistptr; - uint8_t *u8ptr; - int8_t *i8ptr; - uint16_t *u16ptr; - int16_t *i16ptr; - uint32_t *uptr; - int32_t *iptr; - uint64_t *u64ptr; - int64_t *i64ptr; - double *dblptr; - void *voidptr; - } ; - union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */ - char *defstrval; - char **defstrlistval; - uint32_t defuintval; - int defintval; - uint64_t defint64val; - int *defintarrayval; - double defdblval; - } ; - char type; /* parameter value type, as listed below as TYPE_XXXX macro */ - int numelt; /* number of elements in a list or array parameters or max size of string value */ - checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */ - int *processedvalue; /* used to store integer values computed from string original value */ +typedef struct paramdef { + char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */ + char *helpstr; /* help string */ + unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */ + union { /* pointer to the parameter value, completed by the config module */ + char **strptr; + char **strlistptr; + uint8_t *u8ptr; + int8_t *i8ptr; + uint16_t *u16ptr; + int16_t *i16ptr; + uint32_t *uptr; + int32_t *iptr; + uint64_t *u64ptr; + int64_t *i64ptr; + double *dblptr; + void *voidptr; + } ; + union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */ + char *defstrval; + char **defstrlistval; + uint32_t defuintval; + int defintval; + uint64_t defint64val; + int *defintarrayval; + double defdblval; + } ; + char type; /* parameter value type, as listed below as TYPE_XXXX macro */ + int numelt; /* number of elements in a list or array parameters or max size of string value */ + checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */ + int *processedvalue; /* used to store integer values computed from string original value */ } paramdef_t; #define TYPE_INT TYPE_INT32 @@ -161,9 +159,9 @@ typedef struct paramdef #define ANY_IPV4ADDR_STRING "0.0.0.0" typedef struct paramlist_def { - char listname[MAX_OPTNAME_SIZE]; - paramdef_t **paramarray; - int numelt ; + char listname[MAX_OPTNAME_SIZE]; + paramdef_t **paramarray; + int numelt ; } paramlist_def_t; /* macro helpers for module users */ diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index 0ec2e23790..b149bfd636 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -44,409 +44,455 @@ #include "config_userapi.h" -configmodule_interface_t *config_get_if(void) -{ - if (cfgptr == NULL) { - fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__); - exit(-1); - } - return cfgptr; -} - -char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) -{ - if (ptr == NULL ) { - ptr = malloc(sizeof(char *)); - if (ptr != NULL) { - *ptr=NULL; - cfgoptions->strptr=ptr; - if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { - config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr; - config_get_if()->numptrs++; - } - } else { - fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n", - __FILE__, __LINE__, cfgoptions->optname, strerror(errno)); - exit(-1); - } - } - printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length); - if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */ - if (*ptr != NULL) { - return *ptr; - } else { - fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n", - __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt); - exit(-1); - } - } - - if (*ptr == NULL) { - *ptr = malloc(length); - if ( *ptr != NULL) { - memset(*ptr,0,length); - if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { - config_get_if()->ptrs[config_get_if()->numptrs] = *ptr; - config_get_if()->numptrs++; - } - } else { - fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); - exit(-1); - } - } - return *ptr; -} - -void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) -{ -int tmpval=val; - if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) { - tmpval =1; +configmodule_interface_t *config_get_if(void) { + if (cfgptr == NULL) { + fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__); + exit(-1); } + + return cfgptr; +} + +char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { + if (ptr == NULL ) { + ptr = malloc(sizeof(char *)); + + if (ptr != NULL) { + *ptr=NULL; + cfgoptions->strptr=ptr; + + if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { + config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr; + config_get_if()->numptrs++; + } + } else { + fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n", + __FILE__, __LINE__, cfgoptions->optname, strerror(errno)); + exit(-1); + } + } + + printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length); + + if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */ + if (*ptr != NULL) { + return *ptr; + } else { + fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n", + __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt); + exit(-1); + } + } + + if (*ptr == NULL) { + *ptr = malloc(length); + + if ( *ptr != NULL) { + memset(*ptr,0,length); + + if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { + config_get_if()->ptrs[config_get_if()->numptrs] = *ptr; + config_get_if()->numptrs++; + } + } else { + fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); + exit(-1); + } + } + + return *ptr; +} + +void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) { + int tmpval=val; + + if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) { + tmpval =1; + } + switch (cfgoptions->type) { - case TYPE_UINT8: - *(cfgoptions->u8ptr) = (uint8_t)tmpval; - printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval); - break; - case TYPE_INT8: - *(cfgoptions->i8ptr) = (int8_t)tmpval; - printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval); - break; - case TYPE_UINT16: - *(cfgoptions->u16ptr) = (uint16_t)tmpval; - printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval); - break; - case TYPE_INT16: - *(cfgoptions->i16ptr) = (int16_t)tmpval; - printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval); - break; - case TYPE_UINT32: - *(cfgoptions->uptr) = (uint32_t)tmpval; - printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval); - break; - case TYPE_MASK: - *(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval; - printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval); - break; - case TYPE_INT32: - *(cfgoptions->iptr) = (int32_t)tmpval; - printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval); - break; - default: - fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname); - break; + case TYPE_UINT8: + *(cfgoptions->u8ptr) = (uint8_t)tmpval; + printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval); + break; + + case TYPE_INT8: + *(cfgoptions->i8ptr) = (int8_t)tmpval; + printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval); + break; + + case TYPE_UINT16: + *(cfgoptions->u16ptr) = (uint16_t)tmpval; + printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval); + break; + + case TYPE_INT16: + *(cfgoptions->i16ptr) = (int16_t)tmpval; + printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval); + break; + + case TYPE_UINT32: + *(cfgoptions->uptr) = (uint32_t)tmpval; + printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval); + break; + + case TYPE_MASK: + *(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval; + printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval); + break; + + case TYPE_INT32: + *(cfgoptions->iptr) = (int32_t)tmpval; + printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval); + break; + + default: + fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname); + break; } } void config_assign_processedint(paramdef_t *cfgoption, int val) { - cfgoption->processedvalue = malloc(sizeof(int)); - if ( cfgoption->processedvalue != NULL) { - *(cfgoption->processedvalue) = val; - } else { - fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); - exit(-1); - } + cfgoption->processedvalue = malloc(sizeof(int)); + + if ( cfgoption->processedvalue != NULL) { + *(cfgoption->processedvalue) = val; + } else { + fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); + exit(-1); + } } int config_get_processedint(paramdef_t *cfgoption) { - int ret; - if ( cfgoption->processedvalue != NULL) { - ret=*(cfgoption->processedvalue); - free( cfgoption->processedvalue); - cfgoption->processedvalue=NULL; - printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret); - } else { - fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname); - ret=0; - } -return ret; + int ret; + + if ( cfgoption->processedvalue != NULL) { + ret=*(cfgoption->processedvalue); + free( cfgoption->processedvalue); + cfgoption->processedvalue=NULL; + printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret); + } else { + fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname); + ret=0; + } + + return ret; } -void config_printhelp(paramdef_t *params,int numparams) -{ - for (int i=0 ; is4.f4 != NULL) { - st += params[i].chkPptr->s4.f4(&(params[i])); - } - } - if (st != 0) { - fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st); - if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) { - exit_fun("exit because configuration failed\n"); - } - } -return st; + for (int i=0 ; is4.f4 != NULL) { + st += params[i].chkPptr->s4.f4(&(params[i])); + } + } + + if (st != 0) { + fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st); + + if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) { + exit_fun("exit because configuration failed\n"); + } + } + + return st; } -int config_get(paramdef_t *params,int numparams, char *prefix) -{ -int ret= -1; +int config_get(paramdef_t *params,int numparams, char *prefix) { + int ret= -1; -if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { + if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix); return ret; -} -configmodule_interface_t *cfgif = config_get_if(); - if (cfgif != NULL) { - ret = config_get_if()->get(params, numparams,prefix); - if (ret >= 0) { - config_process_cmdline(params,numparams,prefix); - config_execcheck(params,numparams,prefix); - } - return ret; } -return ret; + + configmodule_interface_t *cfgif = config_get_if(); + + if (cfgif != NULL) { + ret = config_get_if()->get(params, numparams,prefix); + + if (ret >= 0) { + config_process_cmdline(params,numparams,prefix); + config_execcheck(params,numparams,prefix); + } + + return ret; + } + + return ret; } -int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) -{ +int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) { if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n"); return -1; } + if (!config_get_if()) return -1; const int ret = config_get_if()->getlist(ParamList, params, numparams, prefix); + if (ret >= 0 && params) { char *newprefix; + if (prefix) { int rc = asprintf(&newprefix, "%s.%s", prefix, ParamList->listname); + if (rc < 0) newprefix = NULL; } else { newprefix = ParamList->listname; } + char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */ + for (int i = 0; i < ParamList->numelt; ++i) { // TODO config_process_cmdline? sprintf(cfgpath, "%s.[%i]", newprefix, i); config_execcheck(ParamList->paramarray[i], numparams, cfgpath); } + if (prefix) free(newprefix); } + return ret; } -int config_isparamset(paramdef_t *params,int paramidx) -{ +int config_isparamset(paramdef_t *params,int paramidx) { if ((params[paramidx].paramflags & PARAMFLAG_PARAMSET) != 0) { - return 1; + return 1; } else { - return 0; + return 0; } } void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) { - fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ", - fname,param->optname, (int)*(param->uptr)); - for ( int i=0; ichkPptr->s1.num_okintval ; i++) { - if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) { - return 0; - } - } - print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval); - return -1; + fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ", + fname,param->optname, (int)*(param->uptr)); + + for ( int i=0; ichkPptr->s1a.num_okintval ; i++) { - if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) { - printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]); - *(param->uptr) = param->chkPptr->s1a.setintval [i]; - return 0; - } - } - print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval); +int config_check_intval(paramdef_t *param) { + if ( param == NULL ) { + fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n"); return -1; + } + + for ( int i=0; ichkPptr->s1.num_okintval ; i++) { + if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) { + return 0; + } + } + + print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval); + return -1; } -int config_check_intrange(paramdef_t *param) -{ - if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) { - return 0; - } - fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n", - param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]); - return -1; +int config_check_modify_integer(paramdef_t *param) { + for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) { + if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) { + printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]); + *(param->uptr) = param->chkPptr->s1a.setintval [i]; + return 0; + } + } + + print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval); + return -1; +} + +int config_check_intrange(paramdef_t *param) { + if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) { + return 0; + } + + fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n", + param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]); + return -1; } void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) { - fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ", - fname,param->optname, *(param->strptr)); - for ( int i=0; ioptname, *(param->strptr)); + + for ( int i=0; ichkPptr->s3.num_okstrval ; i++) { - if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) { - return 0; - } - } - print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval); + +int config_check_strval(paramdef_t *param) { + if ( param == NULL ) { + fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n"); return -1; + } + + for ( int i=0; ichkPptr->s3.num_okstrval ; i++) { + if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) { + return 0; + } + } + + print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval); + return -1; } -int config_checkstr_assign_integer(paramdef_t *param) -{ +int config_checkstr_assign_integer(paramdef_t *param) { + for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) { + if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) { + config_assign_processedint(param, param->chkPptr->s3a.setintval[i]); + return 0; + } + } - - for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) { - if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) { - config_assign_processedint(param, param->chkPptr->s3a.setintval[i]); - return 0; - } - } - print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval); - - return -1; + print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval); + return -1; } -int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) -{ +void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams) { + for (int i=0; i< numparams ; i++ ) { + params[i].chkPptr = &(checkfunctions[i]); + } +} + +int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) { int status = 0; + if( cfgoptions->defstrval != NULL) { - status=1; + status=1; - if (cfgoptions->numelt == 0 ) { - config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *)); - config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1); - sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval); - printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr)); - } else { - sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval); - printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr)); - } + if (cfgoptions->numelt == 0 ) { + config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *)); + config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1); + sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval); + printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr)); + } else { + sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval); + printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr)); + } } + return status; } -int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) -{ +int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) { int status = 0; + if( cfgoptions->defstrlistval != NULL) { - cfgoptions->strlistptr=cfgoptions->defstrlistval; - status=1; - for(int j=0; jnumelt; j++) - printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]); + cfgoptions->strlistptr=cfgoptions->defstrlistval; + status=1; + + for(int j=0; jnumelt; j++) + printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]); } + return status; } -int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) -{ +int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) { int status = 0; config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t)); - if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { - config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval); - status=1; - printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname); - } - return status; -} -int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) -{ + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { + config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval); + status=1; + printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname); + } + + return status; +} + +int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) { int status = 0; config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long)); + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { - *(cfgoptions->u64ptr)=cfgoptions->defuintval; - status=1; - printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr))); + *(cfgoptions->u64ptr)=cfgoptions->defuintval; + status=1; + printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr))); } + return status; } -int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) -{ - int status = 0; +int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) { + int status = 0; + if( cfgoptions->defintarrayval != NULL) { - config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t*)); + config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t *)); cfgoptions->iptr=cfgoptions->defintarrayval; status=1; + for (int j=0; jnumelt ; j++) { - printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]); + printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]); } } + return status; } -int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) -{ +int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) { int status = 0; config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); - if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { - *(cfgoptions->u64ptr)=cfgoptions->defdblval; - status=1; - printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr)); - } - return status; -} -int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) -{ - config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int)); - int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr ); - if (rst == 1 && *(cfgoptions->uptr) > 0) { - printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr); - return 1; - } else { - if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) { - printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr); - *cfgoptions->uptr=INADDR_ANY; - return 1; - } else { - fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname); - return -1; - } + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { + *(cfgoptions->u64ptr)=cfgoptions->defdblval; + status=1; + printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr)); } + + return status; +} + +int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) { + config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int)); + int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr ); + + if (rst == 1 && *(cfgoptions->uptr) > 0) { + printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr); + return 1; + } else { + if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) { + printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr); + *cfgoptions->uptr=INADDR_ANY; + return 1; + } else { + fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname); + return -1; + } + } + return 0; } -int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) -{ +int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) { int status = 0; - + if (cfgoptions->defstrval != NULL) { - status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval); + status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval); } + return status; -} +} diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h index 2b40f8401b..d0508ffbeb 100644 --- a/common/config/config_userapi.h +++ b/common/config/config_userapi.h @@ -20,7 +20,7 @@ */ /*! \file common/config/config_userapi.h - * \brief: configuration module, include file to be used by the source code calling the + * \brief: configuration module, include file to be used by the source code calling the * configuration module to access configuration parameters * \author Francois TABURET * \date 2017 @@ -31,7 +31,7 @@ * \warning */ #ifndef INCLUDE_CONFIG_USERAPI_H -#define INCLUDE_CONFIG_USERAPI_H +#define INCLUDE_CONFIG_USERAPI_H #include "config_load_configmodule.h" #ifdef __cplusplus @@ -48,17 +48,22 @@ extern "C" #define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F)) /* utility functions, to be used by configuration module and/or configuration libraries */ extern configmodule_interface_t *config_get_if(void); -extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ; +extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ; extern void config_printhelp(paramdef_t *,int numparams); extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix); extern void config_assign_processedint(paramdef_t *cfgoption, int val); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr); -/* apis to get parameters, to be used by oai modules, at configuration time */ +/* apis to get/check parameters, to be used by oai modules, at configuration time */ +#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS" +extern int config_check_unknown_cmdlineopt(char *prefix); extern int config_get(paramdef_t *params,int numparams, char *prefix); extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix); +/* apis to set some of the paramdef_t fields before using the get/getlist api's */ +extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams); + /* apis to retrieve parameters info after calling get or getlist functions */ extern int config_isparamset(paramdef_t *params,int paramidx); extern int config_get_processedint(paramdef_t *cfgoption); diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index cb6fa46293..2d861f2dc3 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -42,60 +42,60 @@ #include "errno.h" #if ( LIBCONFIG_VER_MAJOR == 1 && LIBCONFIG_VER_MINOR < 5) -#define config_setting_lookup config_lookup_from + #define config_setting_lookup config_lookup_from #endif void config_libconfig_end(void ); -int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) -{ -const char *str; -int st; -int numelt; +int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) { + const char *str; + int st; + int numelt; + numelt=config_setting_length(setting); + config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt); + st=0; - numelt=config_setting_length(setting); - config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt); - st=0; - for (int i=0; i< numelt ; i++) { - str=config_setting_get_string_elem(setting,i); - if (str==NULL) { - printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i); - } else { - config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1); - sprintf(cfgoptions->strlistptr[i],"%s",str); - st++; - printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]); - } - } - cfgoptions->numelt=numelt; - return st; + for (int i=0; i< numelt ; i++) { + str=config_setting_get_string_elem(setting,i); + + if (str==NULL) { + printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i); + } else { + config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1); + sprintf(cfgoptions->strlistptr[i],"%s",str); + st++; + printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]); + } + } + + cfgoptions->numelt=numelt; + return st; } -int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) -{ +int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) { + cfgoptions->numelt=config_setting_length(setting); - cfgoptions->numelt=config_setting_length(setting); - - if (cfgoptions->numelt > 0) { - cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt)); - for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) { - cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i); - printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]); - } /* for loop on array element... */ - } - return cfgoptions->numelt; + if (cfgoptions->numelt > 0) { + cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt)); + + for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) { + cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i); + printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]); + } /* for loop on array element... */ + } + + return cfgoptions->numelt; } -int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) -{ +int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { config_setting_t *setting; char *str; int i,u; long long int llu; - double dbl; + double dbl; int rst; int status=0; int notfound; @@ -104,211 +104,244 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) int numdefvals=0; char cfgpath[512]; /* 512 should be enough for the sprintf below */ - for(i=0;iparamflags & PARAMFLAG_DONOTREAD) != 0) { + printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname ); + continue; + } - if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) { - printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname ); - continue; - } - notfound=0; - defval=0; - switch(cfgoptions[i].type) - { - case TYPE_STRING: - if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { - if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { - fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", - cfgpath,str,cfgoptions[i].numelt); - str[strlen(str)-1] = 0; - } - if (cfgoptions[i].numelt == 0 ) { - // config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); - config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); - sprintf( *(cfgoptions[i].strptr) , "%s", str); - printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) ); - } else { - sprintf( (char *)(cfgoptions[i].strptr) , "%s", str); - printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr ); - } - } else { - defval=config_setdefault_string(&(cfgoptions[i]),prefix); - } - break; - case TYPE_STRINGLIST: - setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); - if ( setting != NULL) { - read_strlist(&cfgoptions[i],setting,cfgpath); - } else { - defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix); - } - break; - case TYPE_UINT8: - case TYPE_INT8: - case TYPE_UINT16: - case TYPE_INT16: - case TYPE_UINT32: - case TYPE_INT32: - case TYPE_MASK: - if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) { - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t)); - config_assign_int(&(cfgoptions[i]),cfgpath,u); - } else { - defval=config_setdefault_int(&(cfgoptions[i]),prefix); - } - break; - case TYPE_UINT64: - case TYPE_INT64: - if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) { - config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); - if(cfgoptions[i].type==TYPE_UINT64) { - *(cfgoptions[i].u64ptr) = (uint64_t)llu; - printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) ); - } else { - *(cfgoptions[i].iptr) = llu; - printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); - } - } else { - defval=config_setdefault_int64(&(cfgoptions[i]),prefix); - } - break; - case TYPE_UINTARRAY: - case TYPE_INTARRAY: - setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); - if ( setting != NULL) { - read_intarray(&cfgoptions[i],setting,cfgpath); - } else { - defval=config_setdefault_intlist(&(cfgoptions[i]),prefix); - } - break; - case TYPE_DOUBLE: - if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) { - config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double)); - *(cfgoptions[i].dblptr) = dbl; - printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) ); - } else { - defval=config_setdefault_double(&(cfgoptions[i]),prefix); - } - break; - case TYPE_IPV4ADDR: - if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { - defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix); - } else { - rst=config_assign_ipv4addr(cfgoptions, str); - if (rst < 0) { - fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath); - fatalerror=1; - } - } - break; - case TYPE_LIST: - setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); - if ( setting) { - cfgoptions[i].numelt=config_setting_length(setting); - } else { - notfound=1; - } - break; - default: - fprintf(stderr,"[LIBCONFIG] %s type %i not supported\n", cfgpath,cfgoptions[i].type); - fatalerror=1; - break; - } /* switch on param type */ - if( notfound == 1) { - printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile ); - if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) { - fatalerror=1; - printf(" mandatory parameter missing\n"); + notfound=0; + defval=0; + + switch(cfgoptions[i].type) { + case TYPE_STRING: + if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { + if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { + fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", + cfgpath,str,cfgoptions[i].numelt); + str[strlen(str)-1] = 0; + } + + if (cfgoptions[i].numelt == 0 ) { + // config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); + config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); + sprintf( *(cfgoptions[i].strptr) , "%s", str); + printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) ); + } else { + sprintf( (char *)(cfgoptions[i].strptr) , "%s", str); + printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr ); + } } else { - printf("\n"); + defval=config_setdefault_string(&(cfgoptions[i]),prefix); } + + break; + + case TYPE_STRINGLIST: + setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); + + if ( setting != NULL) { + read_strlist(&cfgoptions[i],setting,cfgpath); + } else { + defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix); + } + + break; + + case TYPE_UINT8: + case TYPE_INT8: + case TYPE_UINT16: + case TYPE_INT16: + case TYPE_UINT32: + case TYPE_INT32: + case TYPE_MASK: + if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) { + config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t)); + config_assign_int(&(cfgoptions[i]),cfgpath,u); + } else { + defval=config_setdefault_int(&(cfgoptions[i]),prefix); + } + + break; + + case TYPE_UINT64: + case TYPE_INT64: + if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) { + config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); + + if(cfgoptions[i].type==TYPE_UINT64) { + *(cfgoptions[i].u64ptr) = (uint64_t)llu; + printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) ); + } else { + *(cfgoptions[i].iptr) = llu; + printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); + } + } else { + defval=config_setdefault_int64(&(cfgoptions[i]),prefix); + } + + break; + + case TYPE_UINTARRAY: + case TYPE_INTARRAY: + setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); + + if ( setting != NULL) { + read_intarray(&cfgoptions[i],setting,cfgpath); + } else { + defval=config_setdefault_intlist(&(cfgoptions[i]),prefix); + } + + break; + + case TYPE_DOUBLE: + if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) { + config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double)); + *(cfgoptions[i].dblptr) = dbl; + printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) ); + } else { + defval=config_setdefault_double(&(cfgoptions[i]),prefix); + } + + break; + + case TYPE_IPV4ADDR: + if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { + defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix); + } else { + rst=config_assign_ipv4addr(cfgoptions, str); + + if (rst < 0) { + fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath); + fatalerror=1; + } + } + + break; + + case TYPE_LIST: + setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); + + if ( setting) { + cfgoptions[i].numelt=config_setting_length(setting); + } else { + notfound=1; + } + + break; + + default: + fprintf(stderr,"[LIBCONFIG] %s type %i not supported\n", cfgpath,cfgoptions[i].type); + fatalerror=1; + break; + } /* switch on param type */ + + if( notfound == 1) { + printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile ); + + if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) { + fatalerror=1; + printf(" mandatory parameter missing\n"); + } else { + printf("\n"); + } } else { if (defval == 1) { - numdefvals++; - cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF; + numdefvals++; + cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF; } else { - cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET; + cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET; } + status++; } } /* for loop on options */ + printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n", - ((prefix == NULL)?"(root)":prefix), + ((prefix == NULL)?"(root)":prefix), status,numoptions,numdefvals ); + if (fatalerror == 1) { - fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile ); - config_libconfig_end(); - end_configmodule(); + fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile ); + config_libconfig_end(); + end_configmodule(); } + return status; } -int config_libconfig_getlist(paramlist_def_t *ParamList, - paramdef_t *params, int numparams, char *prefix) -{ -config_setting_t *setting; -int i,j,status; -char *listpath=NULL; -char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */ +int config_libconfig_getlist(paramlist_def_t *ParamList, + paramdef_t *params, int numparams, char *prefix) { + config_setting_t *setting; + int i,j,status; + char *listpath=NULL; + char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */ - if (prefix != NULL) - { - i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname); - } - else - { - i=asprintf(&listpath ,"%s",ParamList->listname); - } - setting = config_lookup(&(libconfig_privdata.cfg), listpath); - if ( setting) { - status = ParamList->numelt = config_setting_length(setting); - printf_params("[LIBCONFIG] %i %s in config file %s \n", - ParamList->numelt,listpath,libconfig_privdata.configfile ); + if (prefix != NULL) { + i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname); + } else { + i=asprintf(&listpath ,"%s",ParamList->listname); + } + + setting = config_lookup(&(libconfig_privdata.cfg), listpath); + + if ( setting) { + status = ParamList->numelt = config_setting_length(setting); + printf_params("[LIBCONFIG] %i %s in config file %s \n", + ParamList->numelt,listpath,libconfig_privdata.configfile ); + } else { + printf("[LIBCONFIG] list %s not found in config file %s \n", + listpath,libconfig_privdata.configfile ); + ParamList->numelt= 0; + status = -1; + } + + if (ParamList->numelt > 0 && params != NULL) { + ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *)); + + if ( ParamList->paramarray != NULL) { + config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray); + config_get_if()->numptrs++; } else { - printf("[LIBCONFIG] list %s not found in config file %s \n", - listpath,libconfig_privdata.configfile ); - ParamList->numelt= 0; - status = -1; + fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__); + exit(-1); } - if (ParamList->numelt > 0 && params != NULL) { - ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *)); - if ( ParamList->paramarray != NULL) { - config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray); - config_get_if()->numptrs++; - } else { - fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__); - exit(-1); - } - for (i=0 ; i < ParamList->numelt ; i++) { - ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t)); - if ( ParamList->paramarray[i] != NULL) { - config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]); - config_get_if()->numptrs++; - } else { - fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__); - exit(-1); - } - - memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams); - for (j=0;jparamarray[i][j].strptr = NULL ; - } - sprintf(cfgpath,"%s.[%i]",listpath,i); - config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath ); - } /* for i... */ - } /* ParamList->numelt > 0 && params != NULL */ - if (listpath != NULL) - free(listpath); - return status; + + for (i=0 ; i < ParamList->numelt ; i++) { + ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t)); + + if ( ParamList->paramarray[i] != NULL) { + config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]); + config_get_if()->numptrs++; + } else { + fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__); + exit(-1); + } + + memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams); + + for (j=0; jparamarray[i][j].strptr = NULL ; + } + + sprintf(cfgpath,"%s.[%i]",listpath,i); + config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath ); + } /* for i... */ + } /* ParamList->numelt > 0 && params != NULL */ + + if (listpath != NULL) + free(listpath); + + return status; } -int config_libconfig_init(char *cfgP[], int numP) -{ +int config_libconfig_init(char *cfgP[], int numP) { config_init(&(libconfig_privdata.cfg)); libconfig_privdata.configfile = strdup((char *)cfgP[0]); config_get_if()->numptrs=0; @@ -317,24 +350,22 @@ int config_libconfig_init(char *cfgP[], int numP) /* Read the file. If there is an error, report it and exit. */ if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) { fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__, - libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)), - config_error_text(&(libconfig_privdata.cfg))); + libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)), + config_error_text(&(libconfig_privdata.cfg))); config_destroy(&(libconfig_privdata.cfg)); printf( "\n"); return -1; } - return 0; } -void config_libconfig_end(void ) -{ +void config_libconfig_end(void ) { config_destroy(&(libconfig_privdata.cfg)); + if ( libconfig_privdata.configfile != NULL ) { - free(libconfig_privdata.configfile); - libconfig_privdata.configfile=NULL; - } - + free(libconfig_privdata.configfile); + libconfig_privdata.configfile=NULL; + } } diff --git a/common/utils/DOC/loader.md b/common/utils/DOC/loader.md new file mode 100644 index 0000000000..91ff0c02f0 --- /dev/null +++ b/common/utils/DOC/loader.md @@ -0,0 +1,17 @@ +# OAI shared library loader + +Shared libraries usage is modularization mechanism which provides the following advantages: +1. Prevents including in the main executable code which is not used in a given configuration +1. Provides flexibility, several implementation of a given functionality can be chosen at run-time, without any compilation step. For example you can build several devices (USRP, BladeFR, LimeSDR) and choose which one you want to use on the command line or via the configuration. +1. Makes code evolution easier: as soon as the shared library interface is clearly defined, you can work on the functionality implemented in a shared library while regularly updating the other components of the code. You can decide to develop your own version of a functionality, decide to deliver it or not, letting the user decide wwhat version he wants to use. + +The main drawback is a performance cost at init time, when loading libraries. + + +## Documentation + +* [runtime usage](loader/rtusage.md) +* [developer usage](loader/devusage.md) +* [module architecture](loader/arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/DOC/loader/arch.md b/common/utils/DOC/loader/arch.md new file mode 100644 index 0000000000..6fd1f47e7b --- /dev/null +++ b/common/utils/DOC/loader/arch.md @@ -0,0 +1,7 @@ +# loader source files + +The oai shared library loader is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils) +1. [load_module_shlib.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.c) contains the loader implementation +1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes. + +[loader home page](../loader.md) \ No newline at end of file diff --git a/common/utils/DOC/loader/devusage.md b/common/utils/DOC/loader/devusage.md new file mode 100644 index 0000000000..915075c361 --- /dev/null +++ b/common/utils/DOC/loader/devusage.md @@ -0,0 +1,16 @@ +The loader objectives are +1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code +1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code + +As a developer you may need to look at these sections: + +* [loading a shared library](devusage/loading.md) +* [loader API](devusage/api.md) +* [loader public structures](devusage/struct.md) + +Loader usage examples can be found in oai sources: + +* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91) +* turbo encoder and decoder initialization: [function `load_codinglib`in *openair1/PHY/CODING/__coding_load.c__*](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c#L113) + +[loader home page](../loader.md) diff --git a/common/utils/DOC/loader/devusage/api.md b/common/utils/DOC/loader/devusage/api.md new file mode 100644 index 0000000000..21c2a1d253 --- /dev/null +++ b/common/utils/DOC/loader/devusage/api.md @@ -0,0 +1,20 @@ + Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file. +```c +int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf) +``` +* possibly initializes the loader, if it has not been already initialized +* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters. +* loads the shared library, using the dlopen system call +* looks for `< modname >_autoinit` symbol, using the `dlsym` system call and possibly call the corresponding function. +* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function. +* If the farray pointer is null, looks for `< modname >_getfarray` symbol, calls the corresponding function when the symbol is found. `< modname >_getfarray` takes one argument, a pointer to a `loader_shlibfunc_t` array, and returns the number of items in this array, as defined by the `getfarrayfunc_t` type. The `loader_shlibfunc_t` array returned by the shared library must be fully filled (both `fname` and `fptr` fields). +* looks for the `numf` function symbols listed in the `farray[i].fname` arguments and set the corresponding `farray[i].fptr`function pointers + + +```c +void * get_shlibmodule_fptr(char *modname, char *fname) +``` +Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found. + +[loader home page](../../loader.md) +[loader developer home page](../devusage.md) \ No newline at end of file diff --git a/common/utils/DOC/loader/devusage/loading.md b/common/utils/DOC/loader/devusage/loading.md new file mode 100644 index 0000000000..766bf85462 --- /dev/null +++ b/common/utils/DOC/loader/devusage/loading.md @@ -0,0 +1,56 @@ +Implementing a shared library dynamic load using the oai loader is a two steps task: +1. define the `loader_shlibfunc_t` array, describing the list of externally available functions implemented in the library. This is the interface of the module. +1. Call the `load_module_shlib` function, passing it the previously defined array and the number of items in this array. The first argument to `load_module_shlib` is the name identifying the module, which is also used to format the corresponding library name, as described [here](loader/rtusage#shared-library-names) + +After a successful `load__module_shlib` call, the function pointer of each `loader_shlibfunc_t` array item has been set and can be used to call the corresponding function. + +Typical loader usage looks like: + +```c +/* shared library loader include file */ +#include "common/utils/load_module_shlib.h" +............. +/* + define and initialize the array, describing the list of functions + implemented in "mymodule" +*/ + loader_shlibfunc_t mymodule_fdesc[2]; + mymodule_fdesc[0].fname="mymodule_f1"; + mymodule_fdesc[1].fname="mymodule_f2"; + +/* + load the library, it's name must be libmymod.so. Configuration can be + used to specify a specific path to look for libmymod.so. Configuration + can also specify a version, for example "V1", in this case the loader + will look for libmymodV1.so +*/ + ret=load_module_shlib("mymod",mymodule_fdesc, sizeof(mymodule_fdesc)/sizeof(loader_shlibfunc_t)); + if (ret < 0) { + fprintf(stderr,"Library couldn't be loaded\n"); + } else { +/* +library has been loaded, we probably want to call some functions... +*/ + ret=((funcf1_t)mymodule_fdesc[0].fptr)(); + +.................. +/* +later and/or somewhere else in the code you may want to call function "mymodule_f2" +You can use the loader get_shlibmodule_fptr(char *modname, char *fname) function +to retrieve the pointer to that function +*/ +funcf2_t *f2; +int ret; +int intarg1; +char *strarg; +........................ +f2 = (funcf2_t)get_shlibmodule_fptr("mymodule", "mymodule_f2") +if (f2 != NULL) { + ret = f2(intarg1,strarg); +} +............... +``` +When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested. + +[loader home page](../loader.md) +[loader developer home page](../../loader/devusage.md) \ No newline at end of file diff --git a/common/utils/DOC/loader/devusage/struct.md b/common/utils/DOC/loader/devusage/struct.md new file mode 100644 index 0000000000..17504f3866 --- /dev/null +++ b/common/utils/DOC/loader/devusage/struct.md @@ -0,0 +1,10 @@ +# `loader_shlibfunc_t`structure +It is defined in include file [ common/util/load_module_shlib.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h#L38). This structure is used to list the symbols that should be searched by the loader when calling the `load_module_shlib` function. + +| Fields | Description | I/O | +|:-----------|:------------------------------------------------------------------|----:| +| `fname` | symbol name, is passed to the [`dlsym`](http://man7.org/linux/man-pages/man3/dlsym.3.html) system call performed by the loader to get a pointer to the symbol | I | +| `fptr` | pointer to the symbol name, set by the loader. `fptr` is defined as a `int (*fptr)(void)` function type | O | + +[loader home page](../../loader.md) +[loader developer home page](../devusage.md) \ No newline at end of file diff --git a/common/utils/DOC/loader/rtusage.md b/common/utils/DOC/loader/rtusage.md new file mode 100644 index 0000000000..bf87316e13 --- /dev/null +++ b/common/utils/DOC/loader/rtusage.md @@ -0,0 +1,50 @@ +## shared library names +Shared library full names are built by the loader using the format: +> < *path* >/lib< *module name* >< *module version* >.so + +1. the < *module name* > is defined at development time, it comes from the `modname` argument of the `load_module_shlib` call. +1. the < *module version* > and < *path* > optional parameters, are defined at run-time, depending on the configuration. + +## loader parameters +The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters. +### Global loader parameters +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `shlibpath` | `string of char` | `""` | directory path used to look for shared libraries, may be superseded by the library specific `shlibpath`.| +| `maxshlibs` | `integer` | 10 | Maximum number of shared libraries the loader can manage. | + +### library specific loader parameters +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `shlibpath` | `string of char` | `""` | directory path used to look for this shared library.| +| `shlibversion` | `string of char` | `""` | version to be used to load this shared library.| + +### loader configuration examples + +The following configuration file example just reproduce the default loader parameters: +```c +loader : +{ + shlibpath = "./"; + maxshlibs = 10; + liboai_device : + { + shlibpath = "./"; + shlibversion = ""; + } +}; +``` +If you want to load a device called *liboai_device_USRP.so* without writting a specific configuration, you can start the softmodem using the following command: +> ./lte-softmodem -O libconfig:/usr/local/oai/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf:dbgl5 --loader.oai_device.shlibversion _USRP + +With this latest example, nn the softmodem logs, you can check that the right device library has been loaded: +```bash +[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf +[LIBCONFIG] loader.oai_device.shlibversion set to default value "" +[LIBCONFIG] loader.oai_device: 1/2 parameters successfully set, (1 to default value) +[CONFIG] shlibversion set to _USRP from command line +[CONFIG] loader.oai_device 1 options set from command line + +``` + +[loader home page](../loader.md) \ No newline at end of file diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md new file mode 100644 index 0000000000..d850ac1036 --- /dev/null +++ b/common/utils/LOG/DOC/addconsoletrace.md @@ -0,0 +1,110 @@ +### Adding console traces in oai code +#### console messages macros +```C +LOG_E(,,,...) +LOG_W(,,,...) +LOG_I(,,,...) +LOG_D(,,,...) +LOG_T(,,,...) +) +``` +these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code. + +| macro | level letter | level value | level name | +|:---------|:---------------|:---------------|----------------:| +| LOG_E | E | 0 | error | +| LOG_W | W | 1 | warning | +| LOG_I | I | 2 | informational | +| LOG_D | D | 3 | debug | +| LOG_T | T | 4 | trace | + +component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt). + +Most oai sources are including LOG macros. + +#### conditional code macros + +```C +LOG_DEBUGFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md) +```C +if ( LOG_DEBUGFLAG() { +/* + the code below is only executed if the corresponding + _debug option is set. + */ +...................... +...................... +} +``` +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396) + +#### memory dump macros +```C +LOG_DUMPFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals. +```C +if ( LOG_DUMPFLAG() { +/* + the code below is only executed if the corresponding + _dump option is set. + */ +LOG_M(............. +LOG_M(............. +log_dump(... +} + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) +#### matlab format dump +```C +LOG_M(file, vector, data, len, dec, format) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| file | char* |path to the fle which will contain the dump | +|vector |char * |name of the dump, printed at the top of the dump file | +|data| void *| pointer to the memory to be dumpped | +|len | int | length of the data to be dumpped, in `dec` unit| +| dec| int | length of each data item.Interpretation depends on format| +|format| int | defines the type of data to be dumped| + +This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)** +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) + +#### hexadecimal format dump +```C +LOG_DUMPMSG(c, f, b, s, x...) +``` +dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md) + +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form. +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181) + +This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro + +```C +LOG_UDUMPMSG(c, b, s, f, x...) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) + +[logging facility developer main page](devusage.md) +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md new file mode 100644 index 0000000000..b9302927be --- /dev/null +++ b/common/utils/LOG/DOC/arch.md @@ -0,0 +1,12 @@ +# logging facility source files + +The oai logging facility is implemented in two source files, located in [common/utils/LOG](LOG) +1. [log.c](../log.c) contains logging implementation +1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. + +The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_` are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call to the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack. + +Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function. + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/configurelog.md b/common/utils/LOG/DOC/configurelog.md new file mode 100644 index 0000000000..c671c043bd --- /dev/null +++ b/common/utils/LOG/DOC/configurelog.md @@ -0,0 +1,49 @@ +### Initializing and configuring the logging facility + +#### logging facility APIs +```C +int logInit (void); +``` +Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md) + +```C +void logClean (void) +``` +Reset console attributes (color settings) and possibly close opened log files. Logging facility is still usable after this call, the internal data are not freed. + +```C +int set_log(int component, int level) +void set_glog(int level) +``` +Set a component or all components logiing level. Messages which level is lower than this level are not printed to the console. + +```C +void set_glog_onlinelog(int enable) +``` +Enable or disable all logging messages. Even error level messages are discarded, which is not advised. This can be usefull to temporarily workaround high rate of logging messages. + +```C +void set_component_filelog(int comp) +void close_component_filelog(int comp) +``` + +Redirect or reset to stdout the output stream used by the logging facility. When the output stream is redirected to a file, it is created under /tmp with a hard-coded filename including the componemt name. + +```C +SET_LOG_DEBUG(flag) +CLEAR_LOG_DEBUG(flag) +SET_LOG_DUMP(flag) +CLEAR_LOG_DUMP(flag) +``` + These macros are used to set or clear the corresponding bit flag, trigerring the activation or un-activation of conditional code or memory dumps generation. + +Example of using the logging utility APIs can be found, for initialization and cleanup, in [lte-softmodem.c](../../../../targets/RT/USER/lte-softmodem.c) and in the [telnet server log command implementation](../../telnetsrv/telnetsrv_proccmd.c) for a complete access to the logging facility features. + +#### components and debug flags definitions + +Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt). +To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h). + +[logging facility developer main page](devusage.md) +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md new file mode 100644 index 0000000000..d7790917fc --- /dev/null +++ b/common/utils/LOG/DOC/devusage.md @@ -0,0 +1,14 @@ +### logging facility developer usage +The logging facility objectives are +1. provide a common console tracing mechanism +1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running. + +Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration. + +[Adding console traces in oaicode](addconsoletrace.md) + +[Configuring the logging facility](configurelog.md) + + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md new file mode 100644 index 0000000000..121e227f3d --- /dev/null +++ b/common/utils/LOG/DOC/log.md @@ -0,0 +1,19 @@ +# OAI console logging facility + +oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream. +By default, this facility is included at build-time and activated at run-time. The T Tracer and the Logging facility share common options for activation: + +- To disable the logging facility (and T Tracer) at build-time use the *--disable-T-Tracer* switch: + +```bash +/build_oai --disable-T-Tracer +``` +- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer. + +## Documentation + +* [runtime usage](rtusage.md) +* [developer usage](devusage.md) +* [module architecture](arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md new file mode 100644 index 0000000000..60835bafaf --- /dev/null +++ b/common/utils/LOG/DOC/rtusage.md @@ -0,0 +1,265 @@ +## configuring the logging facility +The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior + +All logging facility parameters are defined in the log_config section. Some parameters are global to the logging facility, they modify the way messages are printed to stdout. Conversely, some parameters are specific to a component and only modify the behavior for messages issued by a given component. A third type of parameters can be used to activate conditional debug code or dump messages or buffers. + +### global parameters + +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`info`,`debug`,`trace` | +| `global_log_online` | `boolean` | 1 (=true) | If false, all console messages are discarded, whatever their level | +| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header| + +### Component specific parameters +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) | +| `_log_infile` | `boolean` | 0 = false| Triggers the redirection of log messages printed by the specified component in a file. The file path and name is /tmp/.[extension] the extension is optional and component dependant, it can be `log `, `dat `, `txt `| + +The list of components defined within oai can be retrieved from the [config module](../../../config/config.md) traces, when asking for config module debugging info on the command line: + +```bash +./lte-softmodem -O libconfig::dbgl5 + +[LIBCONFIG] log_config.global_log_level: "info" +[CONFIG] global_log_online: 1 +[CONFIG] log_config.global_log_online set to default value +[LIBCONFIG] log_config: 3/3 parameters successfully set, (1 to default value) +[LIBCONFIG] global_log_options[0]: nocolor +[LIBCONFIG] global_log_options[1]: level +[LIBCONFIG] global_log_options[2]: thread +[CONFIG] log_config 1 options set from command line +[LIBCONFIG] log_config.phy_log_level: "info" +[LIBCONFIG] log_config.mac_log_level: "info" +[CONFIG] log_config.sim_log_level set to default value "info" +[CONFIG] log_config.ocg_log_level set to default value "info" +[CONFIG] log_config.omg_log_level set to default value "info" +[CONFIG] log_config.opt_log_level set to default value "info" +[CONFIG] log_config.otg_log_level set to default value "info" +[CONFIG] log_config.otg_latency_log_level set to default value "info" +[CONFIG] log_config.otg_latency_bg_log_level set to default value "info" +[CONFIG] log_config.otg_gp_log_level set to default value "info" +[CONFIG] log_config.otg_gp_bg_log_level set to default value "info" +[CONFIG] log_config.otg_jitter_log_level set to default value "info" +[LIBCONFIG] log_config.rlc_log_level: "info" +[LIBCONFIG] log_config.pdcp_log_level: "info" +[LIBCONFIG] log_config.rrc_log_level: "info" +[CONFIG] log_config.nas_log_level set to default value "info" +[CONFIG] log_config.perf_log_level set to default value "info" +[CONFIG] log_config.oip_log_level set to default value "info" +[CONFIG] log_config.cli_log_level set to default value "info" +[CONFIG] log_config.msc_log_level set to default value "info" +[CONFIG] log_config.ocm_log_level set to default value "info" +[CONFIG] log_config.udp_log_level set to default value "info" +[CONFIG] log_config.gtpv1u_log_level set to default value "info" +[CONFIG] log_config.comp23?_log_level set to default value "info" +[CONFIG] log_config.s1ap_log_level set to default value "info" +[CONFIG] log_config.sctp_log_level set to default value "info" +[LIBCONFIG] log_config.hw_log_level: "info" +[CONFIG] log_config.osa_log_level set to default value "info" +[CONFIG] log_config.eral_log_level set to default value "info" +[CONFIG] log_config.mral_log_level set to default value "info" +[CONFIG] log_config.enb_app_log_level set to default value "info" +[CONFIG] log_config.flexran_agent_log_level set to default value "info" +[CONFIG] log_config.tmr_log_level set to default value "info" +[CONFIG] log_config.usim_log_level set to default value "info" +[CONFIG] log_config.localize_log_level set to default value "info" +[CONFIG] log_config.x2ap_log_level set to default value "info" +[CONFIG] log_config.loader_log_level set to default value "info" +[CONFIG] log_config.asn_log_level set to default value "info" +[LIBCONFIG] log_config: 38/38 parameters successfully set, (32 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] phy_log_infile: 0 +[CONFIG] log_config.phy_log_infile set to default value +[CONFIG] mac_log_infile: 0 +[CONFIG] log_config.mac_log_infile set to default value +[CONFIG] sim_log_infile: 0 +[CONFIG] log_config.sim_log_infile set to default value +[CONFIG] ocg_log_infile: 0 +[CONFIG] log_config.ocg_log_infile set to default value +[CONFIG] omg_log_infile: 0 +[CONFIG] log_config.omg_log_infile set to default value +[CONFIG] opt_log_infile: 0 +[CONFIG] log_config.opt_log_infile set to default value +[CONFIG] otg_log_infile: 0 +[CONFIG] log_config.otg_log_infile set to default value +[CONFIG] otg_latency_log_infile: 0 +[CONFIG] log_config.otg_latency_log_infile set to default value +[CONFIG] otg_latency_bg_log_infile: 0 +[CONFIG] log_config.otg_latency_bg_log_infile set to default value +[CONFIG] otg_gp_log_infile: 0 +[CONFIG] log_config.otg_gp_log_infile set to default value +[CONFIG] otg_gp_bg_log_infile: 0 +[CONFIG] log_config.otg_gp_bg_log_infile set to default value +[CONFIG] otg_jitter_log_infile: 0 +[CONFIG] log_config.otg_jitter_log_infile set to default value +[CONFIG] rlc_log_infile: 0 +[CONFIG] log_config.rlc_log_infile set to default value +[CONFIG] pdcp_log_infile: 0 +[CONFIG] log_config.pdcp_log_infile set to default value +[CONFIG] rrc_log_infile: 0 +[CONFIG] log_config.rrc_log_infile set to default value +[CONFIG] nas_log_infile: 0 +[CONFIG] log_config.nas_log_infile set to default value +[CONFIG] perf_log_infile: 0 +[CONFIG] log_config.perf_log_infile set to default value +[CONFIG] oip_log_infile: 0 +[CONFIG] log_config.oip_log_infile set to default value +[CONFIG] cli_log_infile: 0 +[CONFIG] log_config.cli_log_infile set to default value +[CONFIG] msc_log_infile: 0 +[CONFIG] log_config.msc_log_infile set to default value +[CONFIG] ocm_log_infile: 0 +[CONFIG] log_config.ocm_log_infile set to default value +[CONFIG] udp_log_infile: 0 +[CONFIG] log_config.udp_log_infile set to default value +[CONFIG] gtpv1u_log_infile: 0 +[CONFIG] log_config.gtpv1u_log_infile set to default value +[CONFIG] comp23?_log_infile: 0 +[CONFIG] log_config.comp23?_log_infile set to default value +[CONFIG] s1ap_log_infile: 0 +[CONFIG] log_config.s1ap_log_infile set to default value +[CONFIG] sctp_log_infile: 0 +[CONFIG] log_config.sctp_log_infile set to default value +[CONFIG] hw_log_infile: 0 +[CONFIG] log_config.hw_log_infile set to default value +[CONFIG] osa_log_infile: 0 +[CONFIG] log_config.osa_log_infile set to default value +[CONFIG] eral_log_infile: 0 +[CONFIG] log_config.eral_log_infile set to default value +[CONFIG] mral_log_infile: 0 +[CONFIG] log_config.mral_log_infile set to default value +[CONFIG] enb_app_log_infile: 0 +[CONFIG] log_config.enb_app_log_infile set to default value +[CONFIG] flexran_agent_log_infile: 0 +[CONFIG] log_config.flexran_agent_log_infile set to default value +[CONFIG] tmr_log_infile: 0 +[CONFIG] log_config.tmr_log_infile set to default value +[CONFIG] usim_log_infile: 0 +[CONFIG] log_config.usim_log_infile set to default value +[CONFIG] localize_log_infile: 0 +[CONFIG] log_config.localize_log_infile set to default value +[CONFIG] x2ap_log_infile: 0 +[CONFIG] log_config.x2ap_log_infile set to default value +[CONFIG] loader_log_infile: 0 +[CONFIG] log_config.loader_log_infile set to default value +[CONFIG] asn_log_infile: 0 +[CONFIG] log_config.asn_log_infile set to default value +[LIBCONFIG] log_config: 38/38 parameters successfully set, (38 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] PRACH_debug: 0 +[CONFIG] log_config.PRACH_debug set to default value +[CONFIG] RU_debug: 0 +[CONFIG] log_config.RU_debug set to default value +[CONFIG] UE_PHYPROC_debug: 0 +[CONFIG] log_config.UE_PHYPROC_debug set to default value +[CONFIG] LTEESTIM_debug: 0 +[CONFIG] log_config.LTEESTIM_debug set to default value +[CONFIG] DLCELLSPEC_debug: 0 +[CONFIG] log_config.DLCELLSPEC_debug set to default value +[CONFIG] ULSCH_debug: 0 +[CONFIG] log_config.ULSCH_debug set to default value +[CONFIG] RRC_debug: 0 +[CONFIG] log_config.RRC_debug set to default value +[CONFIG] PDCP_debug: 0 +[CONFIG] log_config.PDCP_debug set to default value +[CONFIG] DFT_debug: 0 +[CONFIG] log_config.DFT_debug set to default value +[CONFIG] ASN1_debug: 0 +[CONFIG] log_config.ASN1_debug set to default value +[CONFIG] CTRLSOCKET_debug: 0 +[CONFIG] log_config.CTRLSOCKET_debug set to default value +[CONFIG] SECURITY_debug: 0 +[CONFIG] log_config.SECURITY_debug set to default value +[CONFIG] NAS_debug: 0 +[CONFIG] log_config.NAS_debug set to default value +[CONFIG] RLC_debug: 0 +[CONFIG] log_config.RLC_debug set to default value +[CONFIG] UE_TIMING_debug: 0 +[CONFIG] log_config.UE_TIMING_debug set to default value +[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] PRACH_dump: 0 +[CONFIG] log_config.PRACH_dump set to default value +[CONFIG] RU_dump: 0 +[CONFIG] log_config.RU_dump set to default value +[CONFIG] UE_PHYPROC_dump: 0 +[CONFIG] log_config.UE_PHYPROC_dump set to default value +[CONFIG] LTEESTIM_dump: 0 +[CONFIG] log_config.LTEESTIM_dump set to default value +[CONFIG] DLCELLSPEC_dump: 0 +[CONFIG] log_config.DLCELLSPEC_dump set to default value +[CONFIG] ULSCH_dump: 0 +[CONFIG] log_config.ULSCH_dump set to default value +[CONFIG] RRC_dump: 0 +[CONFIG] log_config.RRC_dump set to default value +[CONFIG] PDCP_dump: 0 +[CONFIG] log_config.PDCP_dump set to default value +[CONFIG] DFT_dump: 0 +[CONFIG] log_config.DFT_dump set to default value +[CONFIG] ASN1_dump: 0 +[CONFIG] log_config.ASN1_dump set to default value +[CONFIG] CTRLSOCKET_dump: 0 +[CONFIG] log_config.CTRLSOCKET_dump set to default value +[CONFIG] SECURITY_dump: 0 +[CONFIG] log_config.SECURITY_dump set to default value +[CONFIG] NAS_dump: 0 +[CONFIG] log_config.NAS_dump set to default value +[CONFIG] RLC_dump: 0 +[CONFIG] log_config.RLC_dump set to default value +[CONFIG] UE_TIMING_dump: 0 +[CONFIG] log_config.UE_TIMING_dump set to default value +[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value) +[CONFIG] log_config 0 options set from command line +log init done + +``` +It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility) + +### parameters to activate conditional code +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `_debug` | `boolean` | 0 = false | Triggers the activation of conditional code identified by the specified flag. +| `_dump` | `boolean` | 0 = false| Triggers buffer dump, on the console in text form or in a file in matlab format, depending on the developper choice and forcasted usage| + +### Using the configuration file to configure the logging facility +The following example sets all components log level to info, exept for hw,phy,mac,rlc,pdcp,rrc which log levels are set to error or warning. +```bash + log_config : + { + global_log_level ="info"; + hw_log_level ="error"; + phy_log_level ="error"; + mac_log_level ="warn"; + rlc_log_level ="error" + pdcp_log_level ="error"; + rrc_log_level ="error"; + }; +``` +### Using the command line to configure the logging facility +Command line parameter values supersedes values specified in the configuration file. +```bash +./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug +``` +In this example to get all the debug PRACH messages it is necessary to also set the PRACH_debug flag. This is a choice from the developper. +The log messages will be printed whithout color and the header will include the lmessage evel and the thread name: +```bash +[PHY]I ru thread Time in secs now: 104652566 +[PHY]I ru thread Time in secs last pps: 91827117 +[PHY]I ru thread RU 0 rf device ready +[PHY]I ru thread RU 0 no asynch_south interface +[MAC]E rxtx processing SCHED_MODE=0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +[PHY]I lte-softmodem prach_I0 = 0.0 dB +[PHY]I rxtx processing max_I0 21, min_I0 0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +``` + +### Using the telnet server to configure the logging facility +The telnet server includes a `log` command which can be used to dymically modify the logging facility configuration parameters. +[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md) + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index d6dd97e34f..e2dbac43ef 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -39,13 +39,9 @@ #include "vcd_signal_dumper.h" #include "assertions.h" -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -#endif - -# include -# include -#include +#include +#include +#include #include "common/config/config_userapi.h" // main log variables @@ -75,16 +71,14 @@ char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */ -int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format) -{ - +int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format) { FILE *fp=NULL; int i; if (data == NULL) - return -1; - //printf("Writing %d elements of type %d to %s\n",length,format,fname); + return -1; + //printf("Writing %d elements of type %d to %s\n",length,format,fname); if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) { fp = fopen(fname,"a+"); @@ -92,8 +86,6 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length, fp = fopen(fname,"w+"); } - - if (fp== NULL) { printf("[OPENAIR][FILE OUTPUT] Cannot open file %s\n",fname); return(-1); @@ -102,121 +94,108 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length, if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) fprintf(fp,"%s = [",vname); - switch (format) { - case 0: // real 16-bit + case 0: // real 16-bit + for (i=0; i 0)) + fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]); + else if (i == 2*(length-1)) + fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]); + else if (i == 0) + fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]); + } - break; + break; - case 9: // real unsigned 8-bit - for (i=0; i 0)) + fprintf(fp,"%d,",((short *)data)[i]); + else if (i == (length-1)) + fprintf(fp,"%d;",((short *)data)[i]); + else if (i == 0) + fprintf(fp,"\n%d,",((short *)data)[i]); + } - break; - - - case 10 : // case eren 16 bit complex : - - for (i=0; i 0)) - fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]); - else if (i == 2*(length-1)) - fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]); - else if (i == 0) - fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]); - - - - } - - break; - - case 11 : //case eren 16 bit real for channel magnitudes: - for (i=0; i 0)) - fprintf(fp,"%d,",((short *)data)[i]); - else if (i == (length-1)) - fprintf(fp,"%d;",((short *)data)[i]); - else if (i == 0) - fprintf(fp,"\n%d,",((short *)data)[i]); - } - - printf("\n eren: length :%d",length); - break; - - case 12 : // case eren for log2_maxh real unsigned 8 bit - fprintf(fp,"%d \n",((unsigned char *)&data)[0]); - break; + printf("\n eren: length :%d",length); + break; + case 12 : // case eren for log2_maxh real unsigned 8 bit + fprintf(fp,"%d \n",((unsigned char *)&data)[0]); + break; } if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) { @@ -235,131 +214,153 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length, void log_getconfig(log_t *g_log) { char *gloglevel = NULL; int consolelog ; - - paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC; paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS]; paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS]; paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)]; paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)]; - + CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT); int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX); - if (ret <0) { - fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed"); - return; - } -/* set LOG display options (enable/disable color, thread name, level ) */ + if (ret <0) { + fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed"); + return; + } + + /* set LOG display options (enable/disable color, thread name, level ) */ for(int i=0; iflag = g_log->flag | log_options[j].value; - break; - } else if (log_options[j+1].name == NULL){ - fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]); - exit(-1); - } - } - } - -/* build the parameter array for setting per component log level and infile options */ + for(int j=0; log_options[j].name != NULL ; j++) { + if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) { + g_log->flag = g_log->flag | log_options[j].value; + break; + } else if (log_options[j+1].name == NULL) { + fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]); + exit(-1); + } + } + } + + /* build the parameter array for setting per component log level and infile options */ memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS); memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS); + for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) { if(g_log->log_component[i].name == NULL) { - g_log->log_component[i].name = malloc(16); - sprintf((char *)g_log->log_component[i].name,"comp%i?",i); - logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD; - logparams_level[i].paramflags = PARAMFLAG_DONOTREAD; + g_log->log_component[i].name = malloc(16); + sprintf((char *)g_log->log_component[i].name,"comp%i?",i); + logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD; + logparams_level[i].paramflags = PARAMFLAG_DONOTREAD; } + sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name); sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name); -/* workaround: all log options in existing configuration files use lower case component names - where component names include uppercase char in log.h.... */ - for (int j=0 ; jlog_component[i].level = map_str_to_int(log_level_names, *(logparams_level[i].strptr)); set_log(i, g_log->log_component[i].level); + if (*(logparams_logfile[i].uptr) == 1) - set_component_filelog(i); + set_component_filelog(i); } -/* build then read the debug and dump parameter array */ - for (int i=0;log_maskmap[i].name != NULL ; i++) { - sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name); - sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name); - logparams_debug[i].defuintval = 0; - logparams_debug[i].type = TYPE_UINT; - logparams_debug[i].paramflags = PARAMFLAG_BOOL; - logparams_debug[i].uptr = NULL; - logparams_debug[i].chkPptr = NULL; - logparams_debug[i].numelt = 0; - logparams_dump[i].defuintval = 0; - logparams_dump[i].type = TYPE_UINT; - logparams_dump[i].paramflags = PARAMFLAG_BOOL; - logparams_dump[i].uptr = NULL; - logparams_dump[i].chkPptr = NULL; - logparams_dump[i].numelt = 0; + /* build then read the debug and dump parameter array */ + for (int i=0; log_maskmap[i].name != NULL ; i++) { + sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name); + sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name); + logparams_debug[i].defuintval = 0; + logparams_debug[i].type = TYPE_UINT; + logparams_debug[i].paramflags = PARAMFLAG_BOOL; + logparams_debug[i].uptr = NULL; + logparams_debug[i].chkPptr = NULL; + logparams_debug[i].numelt = 0; + logparams_dump[i].defuintval = 0; + logparams_dump[i].type = TYPE_UINT; + logparams_dump[i].paramflags = PARAMFLAG_BOOL; + logparams_dump[i].uptr = NULL; + logparams_dump[i].chkPptr = NULL; + logparams_dump[i].numelt = 0; } + config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); + CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT); config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); -/* set the debug mask according to the debug parameters values */ + + /* set the debug mask according to the debug parameters values */ for (int i=0; log_maskmap[i].name != NULL ; i++) { if (*(logparams_debug[i].uptr) ) - g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value; + g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value; + if (*(logparams_dump[i].uptr) ) - g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value; - } -/* log globally enabled/disabled */ + g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value; + } + + /* log globally enabled/disabled */ set_glog_onlinelog(consolelog); } -int register_log_component(char *name, char *fext, int compidx) -{ -int computed_compidx=compidx; +int register_log_component(char *name, char *fext, int compidx) { + int computed_compidx=compidx; if (strlen(fext) > 3) { - fext[3]=0; /* limit log file extension to 3 chars */ + fext[3]=0; /* limit log file extension to 3 chars */ } + if (compidx < 0) { /* this is not a pre-defined component */ - for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) { - if (g_log->log_component[i].name == NULL) { - computed_compidx=i; - break; - } + for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) { + if (g_log->log_component[i].name == NULL) { + computed_compidx=i; + break; } + } } + if (computed_compidx >= 0 && computed_compidx log_component[computed_compidx].name = strdup(name); - g_log->log_component[computed_compidx].stream = stdout; - g_log->log_component[computed_compidx].filelog = 0; - g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/.%s */ - sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext); + g_log->log_component[computed_compidx].name = strdup(name); + g_log->log_component[computed_compidx].stream = stdout; + g_log->log_component[computed_compidx].filelog = 0; + g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/.%s */ + sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext); } else { - fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name); + fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name); } -return computed_compidx; + + return computed_compidx; } -int logInit (void) -{ +int isLogInitDone (void) { + if (g_log == NULL) + return 0; + + if (!(g_log->flag & FLAG_INITIALIZED)) + return 0; + + return 1; +} + +int logInit (void) { int i; g_log = calloc(1, sizeof(log_t)); @@ -367,10 +368,8 @@ int logInit (void) perror ("cannot allocated memory for log generation module \n"); exit(EXIT_FAILURE); } + memset(g_log,0,sizeof(log_t)); - - - register_log_component("PHY","log",PHY); register_log_component("MAC","log",MAC); register_log_component("OPT","log",OPT); @@ -386,143 +385,121 @@ int logInit (void) register_log_component("OTG_JITTER","dat",OTG_JITTER); register_log_component("OCG","",OCG); register_log_component("PERF","",PERF); - register_log_component("OIP","",OIP); - register_log_component("CLI","",CLI); - register_log_component("MSC","log",MSC); - register_log_component("OCM","log",OCM); - register_log_component("HW","",HW); - register_log_component("OSA","",OSA); - register_log_component("eRAL","",RAL_ENB); - register_log_component("mRAL","",RAL_UE); - register_log_component("ENB_APP","log",ENB_APP); - register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT); - register_log_component("TMR","",TMR); - register_log_component("USIM","txt",USIM); - register_log_component("SIM","txt",SIM); - + register_log_component("OIP","",OIP); + register_log_component("CLI","",CLI); + register_log_component("MSC","log",MSC); + register_log_component("OCM","log",OCM); + register_log_component("HW","",HW); + register_log_component("OSA","",OSA); + register_log_component("eRAL","",RAL_ENB); + register_log_component("mRAL","",RAL_UE); + register_log_component("ENB_APP","log",ENB_APP); + register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT); + register_log_component("TMR","",TMR); + register_log_component("USIM","txt",USIM); + register_log_component("SIM","txt",SIM); /* following log component are used for the localization*/ register_log_component("LOCALIZE","log",LOCALIZE); register_log_component("NAS","log",NAS); register_log_component("UDP","",UDP_); - - register_log_component("GTPV1U","",GTPU); - - register_log_component("S1AP","",S1AP); register_log_component("X2AP","",X2AP); - - register_log_component("SCTP","",SCTP); register_log_component("X2AP","",X2AP); register_log_component("LOADER","log",LOADER); register_log_component("ASN","log",ASN); - - for (int i=0 ; log_level_names[i].name != NULL ; i++) - g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name - - - - + g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name g_log->filelog_name = "/tmp/openair.log"; - log_getconfig(g_log); - - // set all unused component items to 0, they are for non predefined components for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { - memset(&(g_log->log_component[i]),0,sizeof(log_component_t)); + memset(&(g_log->log_component[i]),0,sizeof(log_component_t)); } - printf("log init done\n"); + g_log->flag = g_log->flag | FLAG_INITIALIZED; + printf("log init done\n"); return 0; } char *log_getthreadname(char *threadname, int bufsize) { + int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ; -int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ; - if (rt == 0) - { - return threadname; - } else { - return "thread?"; - } + if (rt == 0) { + return threadname; + } else { + return "thread?"; + } } static int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) { char threadname[PR_SET_NAME]; -return snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s%s", - log_level_highlight_end[level], - ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]), - g_log->log_component[comp].name, - ( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '), - ( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""), - format, - log_level_highlight_end[level]); + return snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s%s", + log_level_highlight_end[level], + ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]), + g_log->log_component[comp].name, + ( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '), + ( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""), + format, + log_level_highlight_end[level]); } -void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char* format, ... ) - { +void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, ... ) { char log_buffer[MAX_LOG_TOTAL]; va_list args; - va_start(args, format); - - - - log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format); g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args); va_end(args); - - } -void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... ) { -va_list args; -char *wbuf; +void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) { + va_list args; + char *wbuf; + switch(datatype) { + case LOG_DUMP_DOUBLE: + wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL); + break; - switch(datatype) { - case LOG_DUMP_DOUBLE: - wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL); - break; - case LOG_DUMP_CHAR: - default: - wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL); - break; + case LOG_DUMP_CHAR: + default: + wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL); + break; + } + + if (wbuf != NULL) { + va_start(args, format); + int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,""); + int pos2=vsprintf(wbuf+pos,format, args); + pos=pos+pos2; + va_end(args); + + for (int i=0; ilog_component[component].print(g_log->log_component[component].stream,wbuf); free(wbuf); - } + } } -int set_log(int component, int level) -{ +int set_log(int component, int level) { /* Checking parameters */ DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS), component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS); @@ -530,38 +507,34 @@ int set_log(int component, int level) OAILOG_ERR); if ( g_log->log_component[component].level != OAILOG_DISABLE ) - g_log->log_component[component].savedlevel = g_log->log_component[component].level; - g_log->log_component[component].level = level; + g_log->log_component[component].savedlevel = g_log->log_component[component].level; + g_log->log_component[component].level = level; return 0; } -void set_glog(int level) -{ +void set_glog(int level) { for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) { - set_log(c, level); + set_log(c, level); } - } -void set_glog_onlinelog(int enable) -{ +void set_glog_onlinelog(int enable) { for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) { - if ( enable ) { - g_log->log_component[c].level = g_log->log_component[c].savedlevel; - g_log->log_component[c].vprint = vfprintf; - g_log->log_component[c].print = fprintf; - g_log->log_component[c].stream = stdout; - } else { - g_log->log_component[c].level = OAILOG_DISABLE; - } - } + if ( enable ) { + g_log->log_component[c].level = g_log->log_component[c].savedlevel; + g_log->log_component[c].vprint = vfprintf; + g_log->log_component[c].print = fprintf; + g_log->log_component[c].stream = stdout; + } else { + g_log->log_component[c].level = OAILOG_DISABLE; + } + } } -void set_glog_filelog(int enable) -{ -static FILE *fptr; +void set_glog_filelog(int enable) { + static FILE *fptr; if ( enable ) { fptr = fopen(g_log->filelog_name,"w"); @@ -574,33 +547,35 @@ static FILE *fptr; } else { for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) { g_log->log_component[c].filelog = 0; + if (fptr != NULL) { fclose(fptr); } + g_log->log_component[c].stream = stdout; - } - } + } + } } -void set_component_filelog(int comp) -{ - if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) { - g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w"); - } - g_log->log_component[comp].vprint = vfprintf; - g_log->log_component[comp].print = fprintf; - g_log->log_component[comp].filelog = 1; +void set_component_filelog(int comp) { + if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) { + g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w"); + } + + g_log->log_component[comp].vprint = vfprintf; + g_log->log_component[comp].print = fprintf; + g_log->log_component[comp].filelog = 1; } -void close_component_filelog(int comp) -{ - g_log->log_component[comp].filelog = 0; - if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) { - fclose(g_log->log_component[comp].stream); - g_log->log_component[comp].stream = stdout; - } - g_log->log_component[comp].vprint = vfprintf; - g_log->log_component[comp].print = fprintf; - +void close_component_filelog(int comp) { + g_log->log_component[comp].filelog = 0; + + if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) { + fclose(g_log->log_component[comp].stream); + g_log->log_component[comp].stream = stdout; + } + + g_log->log_component[comp].vprint = vfprintf; + g_log->log_component[comp].print = fprintf; } /* @@ -608,8 +583,7 @@ void close_component_filelog(int comp) * with string value NULL */ /* map a string to an int. Takes a mapping array and a string as arg */ -int map_str_to_int(mapping *map, const char *str) -{ +int map_str_to_int(mapping *map, const char *str) { while (1) { if (map->name == NULL) { return(-1); @@ -624,8 +598,7 @@ int map_str_to_int(mapping *map, const char *str) } /* map an int to a string. Takes a mapping array and a value */ -char *map_int_to_str(mapping *map, int val) -{ +char *map_int_to_str(mapping *map, int val) { while (1) { if (map->name == NULL) { return NULL; @@ -639,8 +612,7 @@ char *map_int_to_str(mapping *map, int val) } } -int is_newline( char *str, int size) -{ +int is_newline( char *str, int size) { int i; for ( i = 0; i < size; i++ ) { @@ -653,85 +625,65 @@ int is_newline( char *str, int size) return 0; } -void logClean (void) -{ +void logClean (void) { int i; - LOG_UI(PHY,"\n"); + if(isLogInitDone()) { + LOG_UI(PHY,"\n"); - - - for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { - close_component_filelog(i); + for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { + close_component_filelog(i); + } } } - + #ifdef LOG_TEST -int main(int argc, char *argv[]) -{ - +int main(int argc, char *argv[]) { logInit(); - - test_log(); - return 1; } -int test_log(void) -{ +int test_log(void) { LOG_ENTER(MAC); // because the default level is DEBUG LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); LOG_D(MAC, "1 debug MAC \n"); LOG_W(MAC, "1 warning MAC \n"); - set_log(EMU, OAILOG_INFO); set_log(MAC, OAILOG_WARNING); - LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); LOG_E(MAC, "2 error MAC\n"); LOG_D(MAC, "2 debug MAC \n"); LOG_W(MAC, "2 warning MAC \n"); LOG_I(MAC, "2 info MAC \n"); - - set_log(MAC, OAILOG_NOTICE); - LOG_ENTER(MAC); LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); LOG_D(MAC, "3 debug MAC \n"); LOG_W(MAC, "3 warning MAC \n"); LOG_I(MAC, "3 info MAC \n"); - set_log(MAC, LOG_DEBUG); set_log(EMU, LOG_DEBUG); - LOG_ENTER(MAC); LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); LOG_D(MAC, "4 debug MAC \n"); LOG_W(MAC, "4 warning MAC \n"); LOG_I(MAC, "4 info MAC \n"); - - set_log(MAC, LOG_DEBUG); set_log(EMU, LOG_DEBUG); - LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); LOG_D(MAC, "5 debug MAC \n"); LOG_W(MAC, "5 warning MAC \n"); LOG_I(MAC, "5 info MAC \n"); - - set_log(MAC, LOG_TRACE); set_log(EMU, LOG_TRACE); - LOG_ENTER(MAC); LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n", BUILD_VERSION, BUILD_DATE, BUILD_HOST); @@ -739,7 +691,6 @@ int test_log(void) LOG_W(MAC, "6 warning MAC \n"); LOG_I(MAC, "6 info MAC \n"); LOG_EXIT(MAC); - return 0; } #endif diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 767c1dbb35..d0aa4a47c8 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -45,11 +45,11 @@ #include #include #ifndef __STDC_FORMAT_MACROS -#define __STDC_FORMAT_MACROS + #define __STDC_FORMAT_MACROS #endif #include #ifndef _GNU_SOURCE -#define _GNU_SOURCE + #define _GNU_SOURCE #endif #include #include "T.h" @@ -115,23 +115,22 @@ extern "C" { * @{*/ -#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */ -#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */ -#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */ -#define FLAG_FUNCT 0x0020 -#define FLAG_FILE_LINE 0x0040 -#define FLAG_TIME 0x0100 +#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */ +#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */ +#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */ +#define FLAG_TIME 0x0100 +#define FLAG_INITIALIZED 0x8000 #define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O) #define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O)) /** @defgroup macros to identify a debug entity * @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged - * it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro + * it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro * is used to map a character string name to each debug bit, it allows to set or clear * the corresponding bit via the defined name, from the configuration or from the telnet * server. - * @brief + * @brief * @{*/ #define DEBUG_PRACH (1<<0) #define DEBUG_RU (1<<1) @@ -150,22 +149,22 @@ extern "C" { #define LOG_MASKMAP_INIT {\ - {"PRACH", DEBUG_PRACH},\ - {"RU", DEBUG_RU},\ - {"UE_PHYPROC", DEBUG_UE_PHYPROC},\ - {"LTEESTIM", DEBUG_LTEESTIM},\ - {"DLCELLSPEC", DEBUG_DLCELLSPEC},\ - {"ULSCH", DEBUG_ULSCH},\ - {"RRC", DEBUG_RRC},\ - {"PDCP", DEBUG_PDCP},\ - {"DFT", DEBUG_DFT},\ - {"ASN1", DEBUG_ASN1},\ - {"CTRLSOCKET", DEBUG_CTRLSOCKET},\ - {"SECURITY", DEBUG_SECURITY},\ - {"NAS", DEBUG_NAS},\ - {"UE_TIMING", UE_TIMING},\ - {NULL,-1}\ -} + {"PRACH", DEBUG_PRACH},\ + {"RU", DEBUG_RU},\ + {"UE_PHYPROC", DEBUG_UE_PHYPROC},\ + {"LTEESTIM", DEBUG_LTEESTIM},\ + {"DLCELLSPEC", DEBUG_DLCELLSPEC},\ + {"ULSCH", DEBUG_ULSCH},\ + {"RRC", DEBUG_RRC},\ + {"PDCP", DEBUG_PDCP},\ + {"DFT", DEBUG_DFT},\ + {"ASN1", DEBUG_ASN1},\ + {"CTRLSOCKET", DEBUG_CTRLSOCKET},\ + {"SECURITY", DEBUG_SECURITY},\ + {"NAS", DEBUG_NAS},\ + {"UE_TIMING", UE_TIMING},\ + {NULL,-1}\ + } @@ -178,46 +177,46 @@ extern "C" { typedef enum { - MIN_LOG_COMPONENTS = 0, - PHY = MIN_LOG_COMPONENTS, - MAC, - SIM, - OCG, - OMG, - OPT, - OTG, - OTG_LATENCY, - OTG_LATENCY_BG, - OTG_GP, - OTG_GP_BG, - OTG_JITTER, - RLC, - PDCP, - RRC, - NAS, - PERF, - OIP, - CLI, - MSC, - OCM, - UDP_, - GTPU, - SPGW, - S1AP, - SCTP, - HW, - OSA, - RAL_ENB, - RAL_UE, - ENB_APP, - FLEXRAN_AGENT, - TMR, - USIM, - LOCALIZE, - X2AP, - LOADER, - ASN, - MAX_LOG_PREDEF_COMPONENTS, + MIN_LOG_COMPONENTS = 0, + PHY = MIN_LOG_COMPONENTS, + MAC, + SIM, + OCG, + OMG, + OPT, + OTG, + OTG_LATENCY, + OTG_LATENCY_BG, + OTG_GP, + OTG_GP_BG, + OTG_JITTER, + RLC, + PDCP, + RRC, + NAS, + PERF, + OIP, + CLI, + MSC, + OCM, + UDP_, + GTPU, + SPGW, + S1AP, + SCTP, + HW, + OSA, + RAL_ENB, + RAL_UE, + ENB_APP, + FLEXRAN_AGENT, + TMR, + USIM, + LOCALIZE, + X2AP, + LOADER, + ASN, + MAX_LOG_PREDEF_COMPONENTS, } comp_name_t; @@ -226,42 +225,42 @@ comp_name_t; typedef struct { - char *name; /*!< \brief string name of item */ - int value; /*!< \brief integer value of mapping */ + char *name; /*!< \brief string name of item */ + int value; /*!< \brief integer value of mapping */ } mapping; typedef int(*log_vprint_func_t)(FILE *stream, const char *format, va_list ap ); typedef int(*log_print_func_t)(FILE *stream, const char *format, ... ); typedef struct { - const char *name; - int level; - int savedlevel; - int flag; - int filelog; - char *filelog_name; - FILE *stream; - log_vprint_func_t vprint; - log_print_func_t print; - /* SR: make the log buffer component relative */ - char log_buffer[MAX_LOG_TOTAL]; + const char *name; + int level; + int savedlevel; + int flag; + int filelog; + char *filelog_name; + FILE *stream; + log_vprint_func_t vprint; + log_print_func_t print; + /* SR: make the log buffer component relative */ + char log_buffer[MAX_LOG_TOTAL]; } log_component_t; typedef struct { - log_component_t log_component[MAX_LOG_COMPONENTS]; - char level2string[NUM_LOG_LEVEL]; - int flag; - char* filelog_name; - uint64_t debug_mask; - uint64_t dump_mask; + log_component_t log_component[MAX_LOG_COMPONENTS]; + char level2string[NUM_LOG_LEVEL]; + int flag; + char *filelog_name; + uint64_t debug_mask; + uint64_t dump_mask; } log_t; #if defined(ENABLE_ITTI) typedef enum log_instance_type_e { - LOG_INSTANCE_UNKNOWN, - LOG_INSTANCE_ENB, - LOG_INSTANCE_UE, + LOG_INSTANCE_UNKNOWN, + LOG_INSTANCE_ENB, + LOG_INSTANCE_UE, } log_instance_type_t; void log_set_instance_type (log_instance_type_t instance); @@ -272,9 +271,9 @@ void log_set_instance_type (log_instance_type_t instance); log_t *g_log; #else #ifdef __cplusplus - extern "C" { +extern "C" { #endif -extern log_t *g_log; + extern log_t *g_log; #ifdef __cplusplus } #endif @@ -283,8 +282,9 @@ extern log_t *g_log; # include "log_if.h" /*----------------------------------------------------------------------------*/ int logInit (void); +int isLogInitDone (void); void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7))); -void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... ); +void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ); int set_log(int component, int level); void set_glog(int level); @@ -327,22 +327,22 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int #define LOG_CONFIG_DUMP_FORMAT "%s_dump" #define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\ - " nocolor: disable color usage in log messages\n"\ - " level: add log level indication in log messages\n"\ - " thread: add threads names in log messages\n" - + " nocolor: disable color usage in log messages\n"\ + " level: add log level indication in log messages\n"\ + " thread: add threads names in log messages\n" + + - /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* LOG globalconfiguration parameters */ -/* optname help paramflags XXXptr defXXXval type numelt */ +/* LOG globalconfiguration parameters */ +/* optname help paramflags XXXptr defXXXval type numelt */ /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define LOG_GLOBALPARAMS_DESC { \ -{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \ -{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \ -{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \ -} + {LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \ + {LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \ + {LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \ + } #define LOG_OPTIONS_IDX 2 /*----------------------------------------------------------------------------------*/ @@ -354,23 +354,23 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int #define LOG_DUMP_DOUBLE 1 // debugging macros #define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */ -# if T_TRACER - /* per component, level dependant macros */ -# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) -# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) -# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) -# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) -# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) - /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ +# if T_TRACER +/* per component, level dependant macros */ +# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) +# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) +# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) +# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) +# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) +/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ # define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */ - /* bitmask dependant macros, to isolate debugging code */ +/* bitmask dependant macros, to isolate debugging code */ # define LOG_DEBUGFLAG(D) (g_log->debug_mask & D) - /* bitmask dependant macros, to generate debug file such as matlab file or message dump */ +/* bitmask dependant macros, to generate debug file such as matlab file or message dump */ # define LOG_DUMPFLAG(D) (g_log->dump_mask & D) # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */ - /* define variable only used in LOG macro's */ +/* define variable only used in LOG macro's */ # define LOG_VAR(A,B) A B # else /* T_TRACER: remove all debugging and tracing messages, except errors */ # define LOG_I(c, x...) /* */ @@ -380,15 +380,15 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_T(c, x...) /* */ # define LOG_DUMPMSG(c, b, s, x...) /* */ -# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...) +# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...) # define LOG_DEBUGFLAG(D) ( 0 ) -# define LOG_DUMPFLAG(D) ( 0 ) -# define LOG_M(file, vector, data, len, dec, format) +# define LOG_DUMPFLAG(D) ( 0 ) +# define LOG_M(file, vector, data, len, dec, format) # define LOG_VAR(A,B) # endif /* T_TRACER */ /* avoid warnings for variables only used in LOG macro's but set outside debug section */ -#define GCC_NOTUSED __attribute__((unused)) -#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B +#define GCC_NOTUSED __attribute__((unused)) +#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B /* unfiltered macros, usefull for simulators or messages at init time, before log is configured */ #define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) @@ -420,78 +420,82 @@ static __inline__ uint64_t rdtsc(void) { extern double cpuf; -static inline uint64_t checkTCPU(int timeout, char * file, int line) { - static uint64_t __thread lastCPUTime=0; - static uint64_t __thread last=0; - uint64_t cur=rdtsc(); - struct timespec CPUt; - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt); - uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000; - double microCycles=(double)(cpuf*1000); - int duration=(int)((cur-last)/microCycles); - if ( last!=0 && duration > timeout ) { - //struct timespec ts; - //clock_gettime(CLOCK_MONOTONIC, &ts); - printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line, - duration, timeout, (long long)CPUTime-lastCPUTime ); - } - last=cur; - lastCPUTime=CPUTime; - return cur; +static inline uint64_t checkTCPU(int timeout, char *file, int line) { + static uint64_t __thread lastCPUTime=0; + static uint64_t __thread last=0; + uint64_t cur=rdtsc(); + struct timespec CPUt; + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt); + uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000; + double microCycles=(double)(cpuf*1000); + int duration=(int)((cur-last)/microCycles); + + if ( last!=0 && duration > timeout ) { + //struct timespec ts; + //clock_gettime(CLOCK_MONOTONIC, &ts); + printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line, + duration, timeout, (long long)CPUTime-lastCPUTime ); + } + + last=cur; + lastCPUTime=CPUTime; + return cur; } -static inline unsigned long long checkT(int timeout, char * file, int line) { - static unsigned long long __thread last=0; - unsigned long long cur=rdtsc(); - int microCycles=(int)(cpuf*1000); - int duration=(int)((cur-last)/microCycles); - if ( last!=0 && duration > timeout ) - printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line, - duration, timeout); - last=cur; - return cur; +static inline unsigned long long checkT(int timeout, char *file, int line) { + static unsigned long long __thread last=0; + unsigned long long cur=rdtsc(); + int microCycles=(int)(cpuf*1000); + int duration=(int)((cur-last)/microCycles); + + if ( last!=0 && duration > timeout ) + printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line, + duration, timeout); + + last=cur; + return cur; } typedef struct m { - uint64_t iterations; - uint64_t sum; - uint64_t maxArray[11]; + uint64_t iterations; + uint64_t sum; + uint64_t maxArray[11]; } Meas; -static inline void printMeas(char * txt, Meas *M, int period) { - if (M->iterations%period == 0 ) { - char txt2[512]; - sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%" - PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n", - txt, - M->sum/M->iterations, - M->iterations, - M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5], - M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]); +static inline void printMeas(char *txt, Meas *M, int period) { + if (M->iterations%period == 0 ) { + char txt2[512]; + sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%" + PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n", + txt, + M->sum/M->iterations, + M->iterations, + M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5], + M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]); #if DISABLE_LOG_X - printf("%s",txt2); + printf("%s",txt2); #else - LOG_W(PHY, "%s",txt2); + LOG_W(PHY, "%s",txt2); #endif - } + } } -static inline int cmpint(const void* a, const void* b) { - uint64_t* aa=(uint64_t*)a; - uint64_t* bb=(uint64_t*)b; - return (int)(*aa-*bb); +static inline int cmpint(const void *a, const void *b) { + uint64_t *aa=(uint64_t *)a; + uint64_t *bb=(uint64_t *)b; + return (int)(*aa-*bb); } -static inline void updateTimes(uint64_t start, Meas *M, int period, char * txt) { - if (start!=0) { - uint64_t end=rdtsc(); - long long diff=(end-start)/(cpuf*1000); - M->maxArray[0]=diff; - M->sum+=diff; - M->iterations++; - qsort(M->maxArray, 11, sizeof(uint64_t), cmpint); - printMeas(txt,M,period); - } +static inline void updateTimes(uint64_t start, Meas *M, int period, char *txt) { + if (start!=0) { + uint64_t end=rdtsc(); + long long diff=(end-start)/(cpuf*1000); + M->maxArray[0]=diff; + M->sum+=diff; + M->iterations++; + qsort(M->maxArray, 11, sizeof(uint64_t), cmpint); + printMeas(txt,M,period); + } } #define check(a) do { checkT(a,__FILE__,__LINE__); } while (0) diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index 87a6e34c5d..0588c88a45 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -19,7 +19,7 @@ T_IDs.h: $(GENIDS) T_messages.txt ./$(GENIDS) T_messages.txt T_IDs.h check_vcd: - gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread + gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread ./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false) rm -f ./_check_vcd diff --git a/common/utils/T/T.c b/common/utils/T/T.c index fbd3f75a0c..140da30688 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -19,7 +19,7 @@ /* array used to activate/disactivate a log */ static int T_IDs[T_NUMBER_OF_IDS]; int *T_active = T_IDs; -int T_stdout; +int T_stdout = 1; static int T_socket; diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index e1846d90d6..77a8616182 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -75,8 +75,12 @@ ID = ENB_PHY_MSG3_ALLOCATION FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe ID = ENB_PHY_INITIATE_RA_PROCEDURE DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles - GROUP = ALL:PHY:ENB + GROUP = ALL:PHY:ENB:WIRESHARK FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay +ID = ENB_PHY_MIB + DESC = MIB data + GROUP = ALL:PHY:ENB:WIRESHARK + FORMAT = int,eNB_ID : int,frame : int,subframe : buffer,data #MAC logs ID = ENB_MAC_UE_DL_SDU @@ -97,7 +101,7 @@ ID = ENB_MAC_UE_UL_PDU FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu ID = ENB_MAC_UE_UL_PDU_WITH_DATA DESC = MAC uplink UE received PDU - GROUP = ALL:MAC:ENB + GROUP = ALL:MAC:ENB:WIRESHARK FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data ID = ENB_MAC_UE_UL_SDU DESC = MAC uplink UE received SDU @@ -113,12 +117,16 @@ ID = ENB_MAC_UE_UL_CE FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce ID = ENB_MAC_UE_DL_PDU_WITH_DATA DESC = MAC downlink PDU for an UE - GROUP = ALL:MAC:ENB + GROUP = ALL:MAC:ENB:WIRESHARK FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data ID = ENB_MAC_SCHEDULING_REQUEST DESC = MAC scheduling request detected for an UE GROUP = ALL:MAC:ENB FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti +ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA + DESC = MAC downlink PDU for an UE + GROUP = ALL:MAC:ENB:WIRESHARK + FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data #RLC logs ID = ENB_RLC_DL diff --git a/common/utils/T/genids.c b/common/utils/T/genids.c index 8e5adbf587..a130988262 100644 --- a/common/utils/T/genids.c +++ b/common/utils/T/genids.c @@ -8,27 +8,35 @@ char **unique_ids; int unique_ids_size; int unique_ids_maxsize; -int cmp(const void *p1, const void *p2) -{ - return strcmp(*(char * const *)p1, *(char * const *)p2); +int cmp(const void *p1, const void *p2) { + return strcmp(*(char *const *)p1, *(char *const *)p2); } /* return 1 if s was not already known, 0 if it was */ -int new_unique_id(char *s, char *input_file) -{ +int new_unique_id(char *s, char *input_file) { if (unique_ids_size) - if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) { - printf("error: ID %s is not unique in %s\n", s, input_file); - return 0; - } + if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) { + printf("error: ID %s is not unique in %s\n", s, input_file); + return 0; + } + if (unique_ids_size == unique_ids_maxsize) { unique_ids_maxsize += 256; unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *)); - if (unique_ids == NULL) { printf("erorr: out of memory\n"); abort(); } + + if (unique_ids == NULL) { + printf("error: out of memory\n"); + abort(); + } } + unique_ids[unique_ids_size] = strdup(s); - if (unique_ids[unique_ids_size] == NULL) - { printf("erorr: out of memory\n"); abort(); } + + if (unique_ids[unique_ids_size] == NULL) { + printf("error: out of memory\n"); + abort(); + } + unique_ids_size++; qsort(unique_ids, unique_ids_size, sizeof(char *), cmp); return 1; @@ -38,14 +46,17 @@ char *bufname; int bufname_size; int bufname_maxsize; -void putname(int c) -{ +void putname(int c) { if (bufname_size == bufname_maxsize) { bufname_maxsize += 256; bufname = realloc(bufname, bufname_maxsize); - if (bufname == NULL) - { printf("erorr: memory allocation error\n"); exit(1); } + + if (bufname == NULL) { + printf("error: memory allocation error\n"); + exit(1); + } } + bufname[bufname_size] = c; bufname_size++; } @@ -54,42 +65,54 @@ char *bufvalue; int bufvalue_size; int bufvalue_maxsize; -void putvalue(int c) -{ +void putvalue(int c) { if (bufvalue_size == bufvalue_maxsize) { bufvalue_maxsize += 256; bufvalue = realloc(bufvalue, bufvalue_maxsize); - if (bufvalue == NULL) - { printf("error: memory allocation error\n"); exit(1); } + + if (bufvalue == NULL) { + printf("error: memory allocation error\n"); + exit(1); + } } + bufvalue[bufvalue_size] = c; bufvalue_size++; } -void smash_spaces(FILE *f) -{ +void smash_spaces(FILE *f) { int c; + while (1) { c = fgetc(f); + if (isspace(c)) continue; + if (c == ' ') continue; + if (c == '\t') continue; + if (c == '\n') continue; + if (c == 10 || c == 13) continue; + if (c == '#') { while (1) { c = fgetc(f); + if (c == '\n' || c == EOF) break; } + continue; } + break; } + if (c != EOF) ungetc(c, f); } -void get_line(FILE *f, char **name, char **value) -{ +void get_line(FILE *f, char **name, char **value) { int c; bufname_size = 0; bufvalue_size = 0; @@ -97,23 +120,39 @@ void get_line(FILE *f, char **name, char **value) *value = NULL; smash_spaces(f); c = fgetc(f); - while (!(c == '=' || isspace(c) || c == EOF)) { putname(c); c = fgetc(f); } + + while (!(c == '=' || isspace(c) || c == EOF)) { + putname(c); + c = fgetc(f); + } + if (c == EOF) return; + putname(0); + while (!(c == EOF || c == '=')) c = fgetc(f); + if (c == EOF) return; + smash_spaces(f); c = fgetc(f); - while (!(c == 10 || c == 13 || c == EOF)) { putvalue(c); c = fgetc(f); } + + while (!(c == 10 || c == 13 || c == EOF)) { + putvalue(c); + c = fgetc(f); + } + putvalue(0); + if (bufname_size <= 1) return; + if (bufvalue_size <= 1) return; + *name = bufname; *value = bufvalue; } -int main(int n, char **v) -{ +int main(int n, char **v) { FILE *in; FILE *out; char *name; @@ -121,36 +160,54 @@ int main(int n, char **v) char *in_name; char *out_name; - if (n != 3) { printf("error: gimme \n"); exit(1); } + if (n != 3) { + printf("error: gimme \n"); + exit(1); + } n = 0; - in_name = v[1]; out_name = v[2]; + in = fopen(in_name, "r"); - in = fopen(in_name, "r"); if (in == NULL) { perror(in_name); exit(1); } - out = fopen(out_name, "w"); if (out == NULL) { perror(out_name); exit(1); } + if (in == NULL) { + perror(in_name); + exit(1); + } + + out = fopen(out_name, "w"); + + if (out == NULL) { + perror(out_name); + exit(1); + } fprintf(out, "/* generated file, do not edit by hand */\n\n"); while (1) { get_line(in, &name, &value); + if (name == NULL) break; + if (isspace(value[strlen(value)-1])) { printf("error: bad value '%s' (no space at the end please!)\n", value); unlink(out_name); exit(1); } + if (!strcmp(name, "ID")) { - if (!new_unique_id(value, in_name)) { unlink(out_name); exit(1); } + if (!new_unique_id(value, in_name)) { + unlink(out_name); + exit(1); + } + fprintf(out, "#define T_%s T_ID(%d)\n", value, n); n++; } } - fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n); + fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n); fclose(in); fclose(out); - return 0; } diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile index 3da4aa13a1..792c2a407c 100644 --- a/common/utils/T/tracer/Makefile +++ b/common/utils/T/tracer/Makefile @@ -60,6 +60,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \ multi: multi.o utils.o database.o config.o $(CC) $(CFLAGS) -o multi $^ $(LIBS) +multi.o: ../T_IDs.h + +../T_IDs.h: + cd .. && $(MAKE) + .PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a gui/gui.a: diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c index 2aec38831f..d66e8a3bb8 100644 --- a/common/utils/T/tracer/extract.c +++ b/common/utils/T/tracer/extract.c @@ -16,6 +16,8 @@ void usage(void) " -f field 'name' of 'event' has to match 'value'\n" " type of 'name' must be int\n" " (you can use several -f options)\n" +" -after 'event' time has to be greater than this\n" +" -count dump 'n' matching events (less if EOF reached)\n" ); exit(1); } @@ -51,6 +53,10 @@ int main(int n, char **v) int filter_count = 0; int buffer_arg; int found; + int count = 1; + int check_time = 0; + time_t sec; + long nsec; for (i = 1; i < n; i++) { if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); @@ -63,6 +69,14 @@ int main(int n, char **v) filter_value[filter_count++] = atoi(v[++i]); continue; } + if (!strcmp(v[i], "-after")) { if (i>n-3) usage(); + check_time = 1; + sec = atoll(v[++i]); + nsec = atol(v[++i]); + continue; + } + if (!strcmp(v[i], "-count")) + { if (i > n-2) usage(); count = atoi(v[++i]); continue; } if (file == NULL) { file = v[i]; continue; } if (event_name == NULL) { event_name = v[i]; continue; } if (buffer_name == NULL) { buffer_name = v[i]; continue; } @@ -111,13 +125,20 @@ int main(int n, char **v) break; if (i != filter_count) continue; + if (check_time && + !(e.sending_time.tv_sec > sec || + (e.sending_time.tv_sec == sec && e.sending_time.tv_nsec >= nsec))) + continue; if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1) { perror(output_file); exit(1); } - found = 1; - break; + found++; + if (found == count) + break; } if (found == 0) printf("ERROR: event not found\n"); + if (found != count) + printf("WARNING: dumped %d events (wanted %d)\n", found, count); fclose(out); diff --git a/common/utils/T/tracer/gui/x.c b/common/utils/T/tracer/gui/x.c index ef5334767c..71bd805455 100644 --- a/common/utils/T/tracer/gui/x.c +++ b/common/utils/T/tracer/gui/x.c @@ -7,21 +7,19 @@ #include #include -int x_connection_fd(x_connection *_x) -{ +int x_connection_fd(x_connection *_x) { struct x_connection *x = _x; return ConnectionNumber(x->d); } -static GC create_gc(Display *d, char *color) -{ +static GC create_gc(Display *d, char *color) { GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL); XGCValues gcv; XColor rcol, scol; - XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret); + if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)), - color, &scol, &rcol)) { + color, &scol, &rcol)) { gcv.foreground = scol.pixel; XChangeGC(d, ret, GCForeground, &gcv); } else ERR("X: could not allocate color '%s'\n", color); @@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color) return ret; } -int x_new_color(x_connection *_x, char *color) -{ +int x_new_color(x_connection *_x, char *color) { struct x_connection *x = _x; x->ncolors++; - x->colors = realloc(x->colors, x->ncolors * sizeof(GC)); - if (x->colors == NULL) OOM; - x->colors[x->ncolors-1] = create_gc(x->d, color); + if (x->colors == NULL) OOM; + + x->colors[x->ncolors-1] = create_gc(x->d, color); x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor)); + if (x->xft_colors == NULL) OOM; + if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)), - DefaultColormap(x->d, DefaultScreen(x->d)), - color, &x->xft_colors[x->ncolors-1]) == False) + DefaultColormap(x->d, DefaultScreen(x->d)), + color, &x->xft_colors[x->ncolors-1]) == False) ERR("could not allocate color '%s'\n", color); return x->ncolors - 1; } -int x_new_font(x_connection *_x, char *font) -{ +int x_new_font(x_connection *_x, char *font) { struct x_connection *x = _x; /* TODO: allocate fonts only once */ x->nfonts++; x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *)); + if (x->fonts == NULL) OOM; + x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font); + if (x->fonts[x->nfonts-1] == NULL) ERR("failed allocating font '%s'\n", font); + return x->nfonts - 1; } -x_connection *x_open(void) -{ +x_connection *x_open(void) { struct x_connection *ret; - ret = calloc(1, sizeof(struct x_connection)); + if (ret == NULL) OOM; ret->d = XOpenDisplay(0); LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret); + if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n"); x_new_color(ret, "white"); /* background color */ x_new_color(ret, "black"); /* foreground color */ - x_new_font(ret, "sans-8"); - return ret; } x_window *x_create_window(x_connection *_x, int width, int height, - char *title) -{ + char *title) { struct x_connection *x = _x; struct x_window *ret; - ret = calloc(1, sizeof(struct x_window)); + if (ret == NULL) OOM; ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0, - width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)), - WhitePixel(x->d, DefaultScreen(x->d))); + width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)), + WhitePixel(x->d, DefaultScreen(x->d))); ret->width = width; ret->height = height; - XStoreName(x->d, ret->w, title); - ret->p = XCreatePixmap(x->d, ret->w, width, height, - DefaultDepth(x->d, DefaultScreen(x->d))); + DefaultDepth(x->d, DefaultScreen(x->d))); XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR], - 0, 0, width, height); - + 0, 0, width, height); ret->xft = XftDrawCreate(x->d, ret->p, - DefaultVisual(x->d, DefaultScreen(x->d)), - DefaultColormap(x->d, DefaultScreen(x->d))); + DefaultVisual(x->d, DefaultScreen(x->d)), + DefaultColormap(x->d, DefaultScreen(x->d))); + if (ret->xft == NULL) ERR("XftDrawCreate failed\n"); /* enable backing store */ @@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height, att.backing_store = Always; XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att); } - XSelectInput(x->d, ret->w, - KeyPressMask | - ButtonPressMask | - ButtonReleaseMask | - PointerMotionMask | - ExposureMask | - StructureNotifyMask); - + KeyPressMask | + ButtonPressMask | + ButtonReleaseMask | + PointerMotionMask | + ExposureMask | + StructureNotifyMask); XMapWindow(x->d, ret->w); - return ret; } x_image *x_create_image(x_connection *_x, unsigned char *data, - int width, int height) -{ + int width, int height) { struct x_connection *x = _x; struct x_image *ret; XImage *ximage; @@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data, XVisualInfo template; int nvs; Visual *v; + ret = calloc(1, sizeof(struct x_image)); - ret = calloc(1, sizeof(struct x_image)); if (ret == NULL) OOM; + if (ret == NULL) OOM; template.class = TrueColor; template.depth = 24; @@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data, template.green_mask = 0x00ff00; template.blue_mask = 0x0000ff; template.bits_per_rgb = 8; - vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask | - VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | - VisualBitsPerRGBMask, &template, &nvs); + VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | + VisualBitsPerRGBMask, &template, &nvs); if (vs == NULL) { /* try again with 32 bpp */ template.depth = 32; vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask | - VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | - VisualBitsPerRGBMask, &template, &nvs); + VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask | + VisualBitsPerRGBMask, &template, &nvs); } if (vs == NULL) ERR("no good visual found\n"); v = vs[0].visual; XFree(vs); - ximage = XCreateImage(x->d, v, 24, ZPixmap, 0, - (char*)data, width, height, 32, 0); + (char *)data, width, height, 32, 0); + if (ximage == NULL) ERR("image creation failed\n"); ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24); - XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)), - ximage, 0, 0, 0, 0, width, height); - + ximage, 0, 0, 0, 0, width, height); /* TODO: be sure it's fine to set data to NULL */ ximage->data = NULL; XDestroyImage(ximage); - ret->width = width; ret->height = height; - return ret; } -static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) -{ +static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) { struct widget_list *cur; struct toplevel_window_widget *w; struct x_window *xw; cur = g->toplevel; + while (cur) { w = (struct toplevel_window_widget *)cur->item; xw = w->x; + if (xw->w == id) return w; + cur = cur->next; } + return NULL; } -void x_events(gui *_gui) -{ +void x_events(gui *_gui) { struct gui *g = _gui; struct widget_list *cur; struct x_connection *x = g->x; struct toplevel_window_widget *w; - LOGD("x_events START\n"); /* preprocessing (to "compress" events) */ cur = g->toplevel; + while (cur) { struct x_window *xw; w = (struct toplevel_window_widget *)cur->item; @@ -222,58 +213,84 @@ void x_events(gui *_gui) XEvent ev; XNextEvent(x->d, &ev); LOGD("XEV %d\n", ev.type); + switch (ev.type) { - case MapNotify: - case Expose: - if ((w = find_x_window(g, ev.xexpose.window)) != NULL) { - struct x_window *xw = w->x; - xw->redraw = 1; - } - break; - case ConfigureNotify: - if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) { - struct x_window *xw = w->x; - xw->resize = 1; - xw->new_width = ev.xconfigure.width; - xw->new_height = ev.xconfigure.height; - if (xw->new_width < 10) xw->new_width = 10; - if (xw->new_height < 10) xw->new_height = 10; - LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height); - } - break; - case ButtonPress: - if ((w = find_x_window(g, ev.xbutton.window)) != NULL) { - int key_modifiers = 0; - if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; - if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT; - if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; - w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers, - ev.xbutton.button, 0); - } - break; - case ButtonRelease: - if ((w = find_x_window(g, ev.xbutton.window)) != NULL) { - int key_modifiers = 0; - if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; - if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT; - if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; - w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers, - ev.xbutton.button, 1); - } - break; - default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break; + case MapNotify: + case Expose: + if ((w = find_x_window(g, ev.xexpose.window)) != NULL) { + struct x_window *xw = w->x; + xw->redraw = 1; + } + + break; + + case ConfigureNotify: + if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) { + struct x_window *xw = w->x; + xw->resize = 1; + xw->new_width = ev.xconfigure.width; + xw->new_height = ev.xconfigure.height; + + if (xw->new_width < 10) xw->new_width = 10; + + if (xw->new_height < 10) xw->new_height = 10; + + LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height); + } + + break; + + case ButtonPress: + if ((w = find_x_window(g, ev.xbutton.window)) != NULL) { + int key_modifiers = 0; + + if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; + + if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT; + + if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; + + w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers, + ev.xbutton.button, 0); + } + + break; + + case ButtonRelease: + if ((w = find_x_window(g, ev.xbutton.window)) != NULL) { + int key_modifiers = 0; + + if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT; + + if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT; + + if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL; + + w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers, + ev.xbutton.button, 1); + } + + break; + + default: + if (gui_logd) WARN("TODO: X event type %d\n", ev.type); + + break; } } /* postprocessing */ LOGD("post processing\n"); cur = g->toplevel; + while (cur) { struct toplevel_window_widget *w = - (struct toplevel_window_widget *)cur->item; + (struct toplevel_window_widget *)cur->item; struct x_window *xw = w->x; + if (xw->resize) { LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height); + if (xw->width != xw->new_width || xw->height != xw->new_height) { w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height); xw->width = xw->new_width; @@ -281,46 +298,47 @@ void x_events(gui *_gui) XftDrawDestroy(xw->xft); XFreePixmap(x->d, xw->p); xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height, - DefaultDepth(x->d, DefaultScreen(x->d))); + DefaultDepth(x->d, DefaultScreen(x->d))); XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR], - 0, 0, xw->width, xw->height); + 0, 0, xw->width, xw->height); xw->xft = XftDrawCreate(x->d, xw->p, - DefaultVisual(x->d, DefaultScreen(x->d)), - DefaultColormap(x->d, DefaultScreen(x->d))); + DefaultVisual(x->d, DefaultScreen(x->d)), + DefaultColormap(x->d, DefaultScreen(x->d))); + if (xw->xft == NULL) ERR("XftDrawCreate failed\n"); //xw->repaint = 1; } } + if (xw->repaint) { w->common.paint(g, w); xw->redraw = 1; } + if (xw->redraw) { struct x_connection *x = g->x; LOGD("XCopyArea w h %d %d\n", xw->width, xw->height); XCopyArea(x->d, xw->p, xw->w, x->colors[1], - 0, 0, xw->width, xw->height, 0, 0); + 0, 0, xw->width, xw->height, 0, 0); } + cur = cur->next; } + LOGD("x_events DONE\n"); } -void x_flush(x_connection *_x) -{ +void x_flush(x_connection *_x) { struct x_connection *x = _x; XFlush(x->d); } void x_text_get_dimensions(x_connection *_c, int font, const char *t, - int *width, int *height, int *baseline) -{ + int *width, int *height, int *baseline) { struct x_connection *c = _c; XGlyphInfo ext; - XftTextExtentsUtf8(c->d, c->fonts[font], (FcChar8 *)t, strlen(t), &ext); - *width = ext.width; *height = c->fonts[font]->height; *baseline = c->fonts[font]->ascent; @@ -331,63 +349,57 @@ void x_text_get_dimensions(x_connection *_c, int font, const char *t, /***********************************************************************/ void x_draw_line(x_connection *_c, x_window *_w, int color, - int x1, int y1, int x2, int y2) -{ + int x1, int y1, int x2, int y2) { struct x_connection *c = _c; struct x_window *w = _w; XDrawLine(c->d, w->p, c->colors[color], x1, y1, x2, y2); } void x_draw_rectangle(x_connection *_c, x_window *_w, int color, - int x, int y, int width, int height) -{ + int x, int y, int width, int height) { struct x_connection *c = _c; struct x_window *w = _w; XDrawRectangle(c->d, w->p, c->colors[color], x, y, width, height); } void x_fill_rectangle(x_connection *_c, x_window *_w, int color, - int x, int y, int width, int height) -{ + int x, int y, int width, int height) { struct x_connection *c = _c; struct x_window *w = _w; XFillRectangle(c->d, w->p, c->colors[color], x, y, width, height); } void x_draw_string(x_connection *_c, x_window *_w, int font, int color, - int x, int y, const char *t) -{ + int x, int y, const char *t) { struct x_connection *c = _c; struct x_window *w = _w; int tlen = strlen(t); XftDrawStringUtf8(w->xft, &c->xft_colors[color], c->fonts[font], - x, y, (const unsigned char *)t, tlen); + x, y, (const unsigned char *)t, tlen); } void x_draw_clipped_string(x_connection *_c, x_window *_w, int font, - int color, int x, int y, const char *t, - int clipx, int clipy, int clipwidth, int clipheight) -{ + int color, int x, int y, const char *t, + int clipx, int clipy, int clipwidth, int clipheight) { struct x_window *w = _w; - XRectangle clip = { clipx, clipy, clipwidth, clipheight }; + if (XftDrawSetClipRectangles(w->xft, 0, 0, &clip, 1) == False) abort(); + x_draw_string(_c, _w, font, color, x, y, t); + if (XftDrawSetClip(w->xft, NULL) == False) abort(); } -void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y) -{ +void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y) { struct x_connection *c = _c; struct x_window *w = _w; struct x_image *img = _img; - XCopyArea(c->d, img->p, w->p, DefaultGC(c->d, DefaultScreen(c->d)), - 0, 0, img->width, img->height, x, y); + 0, 0, img->width, img->height, x, y); } -void x_draw(x_connection *_c, x_window *_w) -{ +void x_draw(x_connection *_c, x_window *_w) { struct x_connection *c = _c; struct x_window *w = _w; LOGD("x_draw XCopyArea w h %d %d display %p window %d pixmap %d\n", w->width, w->height, c->d, (int)w->w, (int)w->p); @@ -397,13 +409,13 @@ void x_draw(x_connection *_c, x_window *_w) /* those two special functions are to plot many points * first call x_add_point many times then x_plot_points once */ -void x_add_point(x_connection *_c, int x, int y) -{ +void x_add_point(x_connection *_c, int x, int y) { struct x_connection *c = _c; if (c->pts_size == c->pts_maxsize) { c->pts_maxsize += 65536; c->pts = realloc(c->pts, c->pts_maxsize * sizeof(XPoint)); + if (c->pts == NULL) OOM; } @@ -412,12 +424,11 @@ void x_add_point(x_connection *_c, int x, int y) c->pts_size++; } -void x_plot_points(x_connection *_c, x_window *_w, int color) -{ +void x_plot_points(x_connection *_c, x_window *_w, int color) { struct x_connection *c = _c; LOGD("x_plot_points %d points\n", c->pts_size); struct x_window *w = _w; XDrawPoints(c->d, w->p, c->colors[color], c->pts, c->pts_size, - CoordModeOrigin); + CoordModeOrigin); c->pts_size = 0; } diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h index 434cf5a90f..7c019b4797 100644 --- a/common/utils/T/tracer/logger/logger.h +++ b/common/utils/T/tracer/logger/logger.h @@ -30,6 +30,7 @@ void framelog_set_skip(logger *_this, int skip_delay); void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9); void textlog_dump_buffer(logger *_this, int dump_buffer); +void textlog_raw_time(logger *_this, int raw_time); #include "view/view.h" diff --git a/common/utils/T/tracer/logger/textlog.c b/common/utils/T/tracer/logger/textlog.c index 9eb6fd02d8..76f920e1e2 100644 --- a/common/utils/T/tracer/logger/textlog.c +++ b/common/utils/T/tracer/logger/textlog.c @@ -33,6 +33,7 @@ struct textlog { /* local output buffer */ OBUF o; int dump_buffer; + int raw_time; }; static void _event(void *p, event e) @@ -51,9 +52,13 @@ static void _event(void *p, event e) #ifdef T_SEND_TIME t = localtime(&e.sending_time.tv_sec); - /* round tv_nsec to nearest millisecond */ - sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec, - e.sending_time.tv_nsec); + if (l->raw_time) + sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld [%ld]: ", + t->tm_hour, t->tm_min, t->tm_sec, + e.sending_time.tv_nsec, e.sending_time.tv_sec); + else + sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec, + e.sending_time.tv_nsec); PUTS(&l->o, tt); #endif @@ -215,3 +220,9 @@ void textlog_dump_buffer(logger *_this, int dump_buffer) struct textlog *l = _this; l->dump_buffer = dump_buffer; } + +void textlog_raw_time(logger *_this, int raw_time) +{ + struct textlog *l = _this; + l->raw_time = raw_time; +} diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index 954f668aa4..d9bcb8b7f5 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -14,6 +14,11 @@ #define DEFAULT_IP "127.0.0.1" #define DEFAULT_PORT 9999 +#define DEFAULT_LIVE_IP "127.0.0.1" +#define DEFAULT_LIVE_PORT 2021 + +#define NO_PREAMBLE -1 + typedef struct { int socket; struct sockaddr_in to; @@ -28,11 +33,33 @@ typedef struct { int dl_frame; int dl_subframe; int dl_data; + /* mib */ + int mib_frame; + int mib_subframe; + int mib_data; + /* RA preamble */ + int preamble_frame; + int preamble_subframe; + int preamble_preamble; + /* RAR */ + int rar_rnti; + int rar_frame; + int rar_subframe; + int rar_data; + /* config */ + int no_mib; + int no_sib; + int max_mib; + int max_sib; + int live; + /* runtime vars */ + int cur_mib; + int cur_sib; } ev_data; -void ul(void *_d, event e) +void trace(ev_data *d, int direction, int rnti_type, int rnti, + int frame, int subframe, void *buf, int bufsize, int preamble) { - ev_data *d = _d; ssize_t ret; int fsf; int i; @@ -41,79 +68,124 @@ void ul(void *_d, event e) PUTS(&d->buf, MAC_LTE_START_STRING); PUTC(&d->buf, FDD_RADIO); - PUTC(&d->buf, DIRECTION_UPLINK); - PUTC(&d->buf, C_RNTI); + PUTC(&d->buf, direction); + PUTC(&d->buf, rnti_type); - PUTC(&d->buf, MAC_LTE_RNTI_TAG); - PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255); - PUTC(&d->buf, e.e[d->ul_rnti].i & 255); + if (rnti_type == C_RNTI || rnti_type == RA_RNTI) { + PUTC(&d->buf, MAC_LTE_RNTI_TAG); + PUTC(&d->buf, (rnti>>8) & 255); + PUTC(&d->buf, rnti & 255); + } /* for newer version of wireshark? */ - fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i; + fsf = (frame << 4) + subframe; /* for older version? */ - fsf = e.e[d->ul_subframe].i; + //fsf = subframe; PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG); PUTC(&d->buf, (fsf>>8) & 255); PUTC(&d->buf, fsf & 255); + if (preamble != NO_PREAMBLE) { + PUTC(&d->buf, MAC_LTE_SEND_PREAMBLE_TAG); + PUTC(&d->buf, preamble); + PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */ + } + PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); - for (i = 0; i < e.e[d->ul_data].bsize; i++) - PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]); + for (i = 0; i < bufsize; i++) + PUTC(&d->buf, ((char*)buf)[i]); ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)); if (ret != d->buf.osize) abort(); } +void ul(void *_d, event e) +{ + ev_data *d = _d; + trace(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i, + e.e[d->ul_frame].i, e.e[d->ul_subframe].i, + e.e[d->ul_data].b, e.e[d->ul_data].bsize, + NO_PREAMBLE); +} + void dl(void *_d, event e) { ev_data *d = _d; - ssize_t ret; - int fsf; - int i; - d->buf.osize = 0; + if (e.e[d->dl_rnti].i == 0xffff) { + if (d->no_sib) return; + if (d->max_sib && d->cur_sib == d->max_sib) return; + d->cur_sib++; + } - PUTS(&d->buf, MAC_LTE_START_STRING); - PUTC(&d->buf, FDD_RADIO); - PUTC(&d->buf, DIRECTION_DOWNLINK); - PUTC(&d->buf, C_RNTI); - - PUTC(&d->buf, MAC_LTE_RNTI_TAG); - PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255); - PUTC(&d->buf, e.e[d->dl_rnti].i & 255); - - /* for newer version of wireshark? */ - fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i; - /* for older version? */ - fsf = e.e[d->dl_subframe].i; - PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG); - PUTC(&d->buf, (fsf>>8) & 255); - PUTC(&d->buf, fsf & 255); - - PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); - for (i = 0; i < e.e[d->dl_data].bsize; i++) - PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]); - - ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0, - (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)); - if (ret != d->buf.osize) abort(); + trace(d, DIRECTION_DOWNLINK, + e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i, + e.e[d->dl_frame].i, e.e[d->dl_subframe].i, + e.e[d->dl_data].b, e.e[d->dl_data].bsize, + NO_PREAMBLE); } -void setup_data(ev_data *d, void *database, int ul_id, int dl_id) +void mib(void *_d, event e) +{ + ev_data *d = _d; + + if (d->no_mib) return; + if (d->max_mib && d->cur_mib == d->max_mib) return; + d->cur_mib++; + + trace(d, DIRECTION_DOWNLINK, NO_RNTI, 0, + e.e[d->mib_frame].i, e.e[d->mib_subframe].i, + e.e[d->mib_data].b, e.e[d->mib_data].bsize, + NO_PREAMBLE); +} + +void preamble(void *_d, event e) +{ + ev_data *d = _d; + trace(d, DIRECTION_UPLINK, NO_RNTI, 0, + e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i, + NULL, 0, + e.e[d->preamble_preamble].i); +} + +void rar(void *_d, event e) +{ + ev_data *d = _d; + trace(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i, + e.e[d->rar_frame].i, e.e[d->rar_subframe].i, + e.e[d->rar_data].b, e.e[d->rar_data].bsize, + NO_PREAMBLE); +} + +void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, + int preamble_id, int rar_id) { database_event_format f; int i; - d->ul_rnti = -1; - d->ul_frame = -1; - d->ul_subframe = -1; - d->ul_data = -1; + d->ul_rnti = -1; + d->ul_frame = -1; + d->ul_subframe = -1; + d->ul_data = -1; - d->dl_rnti = -1; - d->dl_frame = -1; - d->dl_subframe = -1; - d->dl_data = -1; + d->dl_rnti = -1; + d->dl_frame = -1; + d->dl_subframe = -1; + d->dl_data = -1; + + d->mib_frame = -1; + d->mib_subframe = -1; + d->mib_data = -1; + + d->preamble_frame = -1; + d->preamble_subframe = -1; + d->preamble_preamble = -1; + + d->rar_rnti = -1; + d->rar_frame = -1; + d->rar_subframe = -1; + d->rar_data = -1; #define G(var_name, var_type, var) \ if (!strcmp(f.name[i], var_name)) { \ @@ -144,6 +216,37 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id) if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 || d->dl_data == -1) goto error; + /* MIB: frame, subframe, data */ + f = get_format(database, mib_id); + for (i = 0; i < f.count; i++) { + G("frame", "int", d->mib_frame); + G("subframe", "int", d->mib_subframe); + G("data", "buffer", d->mib_data); + } + if (d->mib_frame == -1 || d->mib_subframe == -1 || d->mib_data == -1) + goto error; + + /* preamble: frame, subframe, preamble */ + f = get_format(database, preamble_id); + for (i = 0; i < f.count; i++) { + G("frame", "int", d->preamble_frame); + G("subframe", "int", d->preamble_subframe); + G("preamble", "int", d->preamble_preamble); + } + if (d->preamble_frame == -1 || d->preamble_subframe == -1 || + d->preamble_preamble == -1) goto error; + + /* rar: rnti, frame, subframe, data */ + f = get_format(database, rar_id); + for (i = 0; i < f.count; i++) { + G("rnti", "int", d->rar_rnti); + G("frame", "int", d->rar_frame); + G("subframe", "int", d->rar_subframe); + G("data", "buffer", d->rar_data); + } + if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 || + d->rar_data == -1) goto error; + #undef G return; @@ -179,9 +282,20 @@ void usage(void) " -d this option is mandatory\n" " -i read events from this dump file\n" " -ip send packets to this IP address (default %s)\n" -" -p send packets to this port (default %d)\n", +" -p send packets to this port (default %d)\n" +" -no-mib do not report MIB\n" +" -no-sib do not report SIBs\n" +" -max-mib report at maximum n MIB\n" +" -max-sib report at maximum n SIBs\n" +" -live run live\n" +" -live-ip tracee's IP address (default %p)\n" +" -live-port tracee's port (default %d)\n" +"-i and -live are mutually exclusive options. One of them must be provided\n" +"but not both.\n", DEFAULT_IP, - DEFAULT_PORT + DEFAULT_PORT, + DEFAULT_LIVE_IP, + DEFAULT_LIVE_PORT ); exit(1); } @@ -194,10 +308,13 @@ int main(int n, char **v) event_handler *h; int in; int i; - int ul_id, dl_id; + int ul_id, dl_id, mib_id = -1, preamble_id, rar_id; ev_data d; char *ip = DEFAULT_IP; int port = DEFAULT_PORT; + char *live_ip = DEFAULT_LIVE_IP; + int live_port = DEFAULT_LIVE_PORT; + int live = 0; memset(&d, 0, sizeof(ev_data)); @@ -209,6 +326,17 @@ int main(int n, char **v) { if (i > n-2) usage(); input_filename = v[++i]; continue; } if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; } if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; } + if (!strcmp(v[i], "-no-mib")) { d.no_mib = 1; continue; } + if (!strcmp(v[i], "-no-sib")) { d.no_sib = 1; continue; } + if (!strcmp(v[i], "-max-mib")) + { if (i > n-2) usage(); d.max_mib = atoi(v[++i]); continue; } + if (!strcmp(v[i], "-max-sib")) + { if (i > n-2) usage(); d.max_sib = atoi(v[++i]); continue; } + if (!strcmp(v[i], "-live")) { live = 1; continue; } + if (!strcmp(v[i], "-live-ip")) + { if (i > n-2) usage(); live_ip = v[++i]; continue; } + if (!strcmp(v[i], "-live-port")) + { if (i > n-2) usage(); live_port = atoi(v[++i]); continue; } usage(); } @@ -217,25 +345,59 @@ int main(int n, char **v) exit(1); } - if (input_filename == NULL) { - printf("ERROR: provide an input file (-i)\n"); + if (input_filename == NULL && live == 0) { + printf("ERROR: provide an input file (-i) or run live (-live)\n"); exit(1); } - in = open(input_filename, O_RDONLY); - if (in == -1) { perror(input_filename); return 1; } + if (input_filename != NULL && live != 0) { + printf("ERROR: cannot use both -i and -live\n"); + exit(1); + } + + if (live == 0) { + in = open(input_filename, O_RDONLY); + if (in == -1) { perror(input_filename); return 1; } + } else + in = connect_to(live_ip, live_port); database = parse_database(database_filename); load_config_file(database_filename); h = new_handler(database); + if (live) { + char mt = 1; + int number_of_events = number_of_ids(database); + int *is_on = calloc(number_of_events, sizeof(int)); + if (is_on == NULL) { printf("ERROR: out of memory\n"); exit(1); } + on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 1); + on_off(database, "ENB_MAC_UE_DL_PDU_WITH_DATA", is_on, 1); + on_off(database, "ENB_PHY_MIB", is_on, 1); + on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1); + on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1); + /* activate selected traces */ + if (socket_send(in, &mt, 1) == -1 || + socket_send(in, &number_of_events, sizeof(int)) == -1 || + socket_send(in, is_on, number_of_events * sizeof(int)) == -1) { + printf("ERROR: socket_send failed\n"); + exit(1); + } + free(is_on); + } + ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA"); dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA"); - setup_data(&d, database, ul_id, dl_id); + mib_id = event_id_from_name(database, "ENB_PHY_MIB"); + preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE"); + rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA"); + setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id); register_handler_function(h, ul_id, ul, &d); register_handler_function(h, dl_id, dl, &d); + register_handler_function(h, mib_id, mib, &d); + register_handler_function(h, preamble_id, preamble, &d); + register_handler_function(h, rar_id, rar, &d); d.socket = socket(AF_INET, SOCK_DGRAM, 0); if (d.socket == -1) { perror("socket"); exit(1); } @@ -253,7 +415,8 @@ int main(int n, char **v) event e; e = get_event(in, &ebuf, database); if (e.type == -1) break; - if (!(e.type == ul_id || e.type == dl_id)) continue; + if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id || + e.type == preamble_id || e.type == rar_id)) continue; handle_event(h, e); } diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c index bb773b4215..a123bf9bf5 100644 --- a/common/utils/T/tracer/textlog.c +++ b/common/utils/T/tracer/textlog.c @@ -52,6 +52,7 @@ void usage(void) " they will be processed in order\n" " by default, all is off\n" " -full also dump buffers' content\n" +" -raw-time also prints 'raw time'\n" " -ip connect to given IP address (default %s)\n" " -p connect to given port (default %d)\n" " -x GUI output\n" @@ -91,6 +92,7 @@ int main(int n, char **v) int gui_active = 1; textlog_data textlog_data; int full = 0; + int raw_time = 0; /* write on a socket fails if the other end is closed and we get SIGPIPE */ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort(); @@ -117,6 +119,7 @@ int main(int n, char **v) if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; } if (!strcmp(v[i], "-no-gui")) { gui_active = 0; continue; } if (!strcmp(v[i], "-full")) { full = 1; continue; } + if (!strcmp(v[i], "-raw-time")) { raw_time = 1; continue; } usage(); } @@ -162,6 +165,7 @@ int main(int n, char **v) // "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]"); logger_add_view(textlog, out); if (full) textlog_dump_buffer(textlog, 1); + if (raw_time) textlog_raw_time(textlog, 1); free(name); free(desc); } @@ -187,7 +191,7 @@ int main(int n, char **v) while (1) { event e; e = get_event(textlog_data.socket, &ebuf, database); - if (e.type == -1) abort(); + if (e.type == -1) break; handle_event(h, e); } diff --git a/common/utils/assertions.h b/common/utils/assertions.h index b872b009e2..77e939affe 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -22,9 +22,7 @@ #include #include #include -#ifdef CMAKER #include -#endif #if defined(ENB_MODE) # define display_backtrace() diff --git a/common/utils/telnetsrv/DOC/telnetaddcmd.md b/common/utils/telnetsrv/DOC/telnetaddcmd.md new file mode 100644 index 0000000000..ef5af3fb7e --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetaddcmd.md @@ -0,0 +1,116 @@ +# code example of adding a command to the telnet server + +The following example is extracted from [the oai `openair1/PHY/CODING/coding_load.c` file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c). + +```c +/* +include the telnet server data structures and API definitions +*/ +#include "common/utils/telnetsrv/telnetsrv.h" + + +/* +define the null terminated array of telnetshell_cmddef_t structures +which map each sub-command string to a function implementing it. +you may also provide a help string which will be printed when +the global help command is used. The prototype for the function +implementing sub commands must match the `cmdfunc_t` type defined +in `telnetsrv.h` +*/ +static int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt); +static telnetshell_cmddef_t coding_cmdarray[] = { + {"mode","[sse,avx2,stdc,none]",coding_setmod_cmd}, + {"","",NULL}, +}; + +/* +define the null terminated list of telnetshell_vardef_t structures defining the +variables that can be set and get using the pre-defined get and set command +of the telnet server +*/ +telnetshell_vardef_t coding_vardef[] = { +{"maxiter",TELNET_VARTYPE_INT32,&max_turbo_iterations}, +{"",0,NULL} +}; +................. +/* + look for telnet server, if it is loaded, add the coding commands to it + we use the shared library loader API to check the telnet server availibility +The telnet server TELNET_ADDCMD_FNAME function takes three arguments: +1. The name of the telnet command to be added, here "coding" +1. The `coding_cmdarray` list of "coding" sub-commands we defined earlier +1. The `coding_varde f`list of variables we defined earlier +*/ + add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); + if (addcmd != NULL) { + addcmd("coding",coding_vardef,coding_cmdarray); +....... +/* + functions implementing the "coding mode" sub command, as defined in + the `coding_cmdarray` passed earlier to the TELNET_ADDCMD_FNAME function. + This function will be called by the telnet server, when the `coding_cmdarray` + command is received from the telnet client +*/ +int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt) +{ + /* + 1. buff argument is an input argument, pointer to the string received + from the telnet client, the command and sub-command parts are removed + In this case it points after "coding setmod" and is of no use as + we don't have second level sub-commands. + 1. debug argument is an input argument set by the telnet server + 1. prnt arguments is also an input argument, a function pointer, to be used + in place of printf to print messages on the telnet client interface. As this function + is called by the telnet server stdout points to the main executable console, + */ + if (debug > 0) + prnt( "coding_setmod_cmd received %s\n",buff); + + if (strcasestr(buff,"sse") != NULL) { + decoding_setmode(MODE_DECODE_SSE); + } else if (strcasestr(buff,"avx2") != NULL) { + decoding_setmode(MODE_DECODE_AVX2); + } else if (strcasestr(buff,"stdc") != NULL) { + decoding_setmode(MODE_DECODE_C); + } else if (strcasestr(buff,"none") != NULL) { + decoding_setmode(MODE_DECODE_NONE); + } else { + prnt("%s: wrong setmod parameter...\n",buff); + } + prnt("Coding and decoding current mode: %s\n",modedesc[curmode]); + return 0; +} + +.............. + +``` +# telnet server API + +```c +int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd) +``` +Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings. +Also adds the list of variables described in the `var` array to the list of variable which can be set and read. +The function returns -1 if one argument is NULL. +The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server). + +# telnet server public data types +## `telnetshell_vardef_t`structure + This structure is used by developers to describe the variables that can be set or read using the get,set and getall sub-commands. + +| Fields | type |Description | +|:-----------|:------:|:-----------------------| +| `varname` | `char[TELNET_CMD_MAXSIZE]` | variable name, as specified when using the get and set commands. | +| `vartype` | `char` | Defines the type of the variable pointed by the `varvalptr`field. Supported values: TELNET_VARTYPE_INT32 TELNET_VARTYPE_INT16 TELNET_VARTYPE_INT64 TELNET_VARTYPE_STRING TELNET_VARTYPE_DOUBLE | +| `varvalptr` | `void*` | Defines the type of the variable pointed by the `varvalptr`field | + +## `telnetshell_cmddef_t`structure + This structure is used by developers to describe the first level sub-commands to be added to the telnet server. + +| Fields | type |Description | +|:-----------|:------:|:-----------------------| +| `cmdname` | `char[TELNET_CMD_MAXSIZE]` | command name, as tested by the telnet server to check it should call the `cmdfunc` function | +| `helpstr` | `char[TELNET_HELPSTR_SIZE]` | character string to print when the elp`command is received from the telnet client | +| `cmdfunc` | `cmdfunc_t` | pointer to the function implementing the `cmdname` sub command. | + +[oai telnet server home](telnetsrv.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetarch.md b/common/utils/telnetsrv/DOC/telnetarch.md new file mode 100644 index 0000000000..f31a51b352 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetarch.md @@ -0,0 +1,21 @@ +# telnet server principles + +The oai telnet server is implemented in a shared library to be loaded by the [oai shared library loader](loader). The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader). + +Currently the telnet server only supports one user connection. The same dedicated thread is used to wait for a user connection and process the input received from this connection. + +The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables. + + + +# telnet server source files + +telnet server source files are located in [common/utils/telnetsrv](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv) + +1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command. +1. [telnetsrv.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.h) is the telnet server include file containing both private and public data type definitions. It also contains API prototypes for functions that are used to register a new command in the server. +1. `telnetsrv\_\.c`: implementation of \ CLI command which are delivered with the telnet server. +1. `telnetsrv\_\.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file +1. [telnetsrv_CMakeLists.txt](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv_CMakeLists.txt): CMakelists file containing the cmake instructions to build the telnet server. this file is included in the [global oai CMakelists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt). + +[oai telnet server home](telnetsrv.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetgetset.md b/common/utils/telnetsrv/DOC/telnetgetset.md new file mode 100644 index 0000000000..e0b2c90d79 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetgetset.md @@ -0,0 +1,21 @@ +getall command can be used to get the list of variables that can bet set or get from the telnet shell. Knowing the names of the variables they can then be set or read. Setting a variable is not always relevant, the telnet server doesn't provide a mechanism to restrict the set command. + +```bash +softmodem> telnet getall +telnet, debug = 0 +telnet, prio = 0 +telnet, loopc = 10 +telnet, loopd = 5000 +telnet, phypb = 65000 +telnet, hsize = 50 +telnet, hfile = "oaitelnet.history" +softmodem> telnet set loopc 100 +telnet, loopc set to +100 +softmodem> telnet get loopc +telnet, loopc = 100 +softmodem> + +``` +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnethelp.md b/common/utils/telnetsrv/DOC/telnethelp.md new file mode 100644 index 0000000000..63183fb611 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnethelp.md @@ -0,0 +1,57 @@ +# oai telnet server global help + +``` bash +alblf@at8020-a:~$ telnet 10.133.10.77 9090 +Trying 10.133.10.77... +Connected to 10.133.10.77. +Escape character is '^]'. + +softmodem> help + module 0 = telnet: + telnet [get set] debug + telnet [get set] prio + telnet [get set] loopc + telnet [get set] loopd + telnet [get set] phypb + telnet [get set] hsize + telnet [get set] hfile + telnet redirlog [here,file,off] + telnet param [prio] + telnet history [list,reset] + module 1 = softmodem: + softmodem show loglvl|thread|config + softmodem log (enter help for details) + softmodem thread (enter help for details) + softmodem exit + module 2 = phy: + phy disp [phycnt,uedump,uestat UE] + module 3 = loader: + loader [get set] mainversion + loader [get set] defpath + loader [get set] maxshlibs + loader [get set] numshlibs + loader show [params,modules] + module 4 = coding: + coding [get set] maxiter + coding mode [sse,avx2,stdc,none] +softmodem> +``` + +# oai telnet server, specific commands help + +``` bash +softmodem> softmodem log help + log sub commands: + show: display current log configuration + online, noonline: enable or disable console logs + enable, disable id1-id2: enable or disable logs for components index id1 to id2 + level_ id1-id2: set log level to for components index id1 to id2 + level_ id1-id2: set log verbosity to for components index id1 to id2 +use the show command to get the values for , and the list of component indexes that can be used for id1 and id2 +softmodem> + + +``` + +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnethist.md b/common/utils/telnetsrv/DOC/telnethist.md new file mode 100644 index 0000000000..d938435a24 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnethist.md @@ -0,0 +1,44 @@ +The telnet server implements a simple history system +```bash +softmodem> telnet history list +1: telnet history list +2: telnet history list +3: help +4: loader show modules +5: softmodem show loglvl +6: help +7: telnet history +8: help +9: telnet history list +10: help +11: loader show modules +12: softmodem show loglvl +13: softmodem log help +14: softmodem log disable 0-35 +15: softmodem log show +16: help +17: telnet history list +18: loader show modules +19: softmodem thread show +20: help +21: softmodem thread help +22: softmodem log show +23: softmodem log help +24: softmodem log level_error 0-4 +25: loader show modules +26: loader show config +27: help +28: loader show params +29: loader show modules +softmodem> !28 +softmodem> loader show params +loader parameters: + Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100" + Default shared lib path: "" + Max number of shared lib : 10 +softmodem> + +``` + +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetloader.md b/common/utils/telnetsrv/DOC/telnetloader.md new file mode 100644 index 0000000000..9250524989 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetloader.md @@ -0,0 +1,47 @@ +loader command can be used to check loader configuration parameters and the list of loaded shared libraries and for each library the list of available functions. + +```bash +softmodem> loader show params +loader parameters: + Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100" + Default shared lib path: "" + Max number of shared lib : 10 +softmodem> loader show modules +4 shared lib have been dynamicaly loaded by the oai loader + Module 0: telnetsrv + Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100" + Shared library path: "libtelnetsrv.so" + 1 function pointers registered: + function 0 add_telnetcmd at 0x7ff8b772a2b0 + Module 1: NB_IoT + Shared library build version: "" + Shared library path: "libNB_IoT.so" + 1 function pointers registered: + function 0 RCConfig_NbIoT at 0x7ff8b6b1b390 + Module 2: coding + Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100" + Shared library path: "libcoding.so" + 13 function pointers registered: + function 0 init_td8 at 0x7ff8adde63a0 + function 1 init_td16 at 0x7ff8adde9760 + function 2 init_td16avx2 at 0x7ff8addec050 + function 3 phy_threegpplte_turbo_decoder8 at 0x7ff8adde6780 + function 4 phy_threegpplte_turbo_decoder16 at 0x7ff8adde9a90 + function 5 phy_threegpplte_turbo_decoder_scalar at 0x7ff8addef4a0 + function 6 phy_threegpplte_turbo_decoder16avx2 at 0x7ff8addec530 + function 7 free_td8 at 0x7ff8adde61d0 + function 8 free_td16 at 0x7ff8adde9590 + function 9 free_td16avx2 at 0x7ff8addebe80 + function 10 threegpplte_turbo_encoder_sse at 0x7ff8adde45b0 + function 11 threegpplte_turbo_encoder at 0x7ff8adde4a30 + function 12 init_encoder_sse at 0x7ff8adde49d0 + Module 3: oai_device + Shared library build version: "" + Shared library path: "liboai_device_usrp.so" + 1 function pointers registered: + function 0 device_init at 0x7ff8ac16a7a0 +softmodem> +``` + +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md new file mode 100644 index 0000000000..0faaf9c02e --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetlog.md @@ -0,0 +1,96 @@ +The log command can be used to get the status of the log parameters and to dynamically modify these parameters. The log command has its own [help](telnethelp.md#oai-telnet-server-specific-commands-help) +```bash +softmodem> softmodem log disable 0-35 +log level/verbosity comp 0 PHY set to info / medium (disabled) +log level/verbosity comp 1 MAC set to info / medium (disabled) +log level/verbosity comp 2 EMU set to info / medium (disabled) +log level/verbosity comp 3 OCG set to info / medium (disabled) +log level/verbosity comp 4 OMG set to info / medium (disabled) +log level/verbosity comp 5 OPT set to info / medium (disabled) +log level/verbosity comp 6 OTG set to info / medium (disabled) +log level/verbosity comp 7 OTG_LATENCY set to info / medium (disabled) +log level/verbosity comp 8 OTG_LATENCY_BG set to info / medium (disabled) +log level/verbosity comp 9 OTG_GP set to info / medium (disabled) +log level/verbosity comp 10 OTG_GP_BG set to info / medium (disabled) +log level/verbosity comp 11 OTG_JITTER set to info / medium (disabled) +log level/verbosity comp 12 RLC set to info / medium (disabled) +log level/verbosity comp 13 PDCP set to info / medium (disabled) +log level/verbosity comp 14 RRC set to info / medium (disabled) +log level/verbosity comp 15 NAS set to info / medium (disabled) +log level/verbosity comp 16 PERF set to info / medium (disabled) +log level/verbosity comp 17 OIP set to info / medium (disabled) +log level/verbosity comp 18 CLI set to info / medium (disabled) +log level/verbosity comp 19 MSC set to info / medium (disabled) +log level/verbosity comp 20 OCM set to info / medium (disabled) +log level/verbosity comp 21 UDP set to info / medium (disabled) +log level/verbosity comp 22 GTPV1U set to info / medium (disabled) +log level/verbosity comp 23 comp23? set to info / medium (disabled) +log level/verbosity comp 24 S1AP set to info / medium (disabled) +log level/verbosity comp 25 SCTP set to info / medium (disabled) +log level/verbosity comp 26 HW set to info / medium (disabled) +log level/verbosity comp 27 OSA set to info / medium (disabled) +log level/verbosity comp 28 eRAL set to info / medium (disabled) +log level/verbosity comp 29 mRAL set to info / medium (disabled) +log level/verbosity comp 30 ENB_APP set to info / medium (disabled) +log level/verbosity comp 31 FLEXRAN_AGENT set to info / medium (disabled) +log level/verbosity comp 32 TMR set to info / medium (disabled) +log level/verbosity comp 33 USIM set to info / medium (disabled) +log level/verbosity comp 34 LOCALIZE set to info / medium (disabled) +log level/verbosity comp 35 RRH set to info / medium (disabled) +softmodem> softmodem log show +Available log levels: + emerg alert crit error warn notice info debug file trace +Available verbosity: + none low medium high full +component verbosity level enabled +00 PHY: medium info N +01 MAC: medium info N +02 EMU: medium info N +03 OCG: medium info N +04 OMG: medium info N +05 OPT: medium info N +06 OTG: medium info N +07 OTG_LATENCY: medium info N +08 OTG_LATENCY_BG: medium info N +09 OTG_GP: medium info N +10 OTG_GP_BG: medium info N +11 OTG_JITTER: medium info N +12 RLC: medium info N +13 PDCP: medium info N +14 RRC: medium info N +15 NAS: medium info N +16 PERF: medium info N +17 OIP: medium info N +18 CLI: medium info N +19 MSC: medium info N +20 OCM: medium info N +21 UDP: medium info N +22 GTPV1U: medium info N +23 comp23?: medium info N +24 S1AP: medium info N +25 SCTP: medium info N +26 HW: medium info N +27 OSA: medium info N +28 eRAL: medium info N +29 mRAL: medium info N +30 ENB_APP: medium info N +31 FLEXRAN_AGENT: medium info N +32 TMR: medium info N +33 USIM: medium info N +34 LOCALIZE: medium info N +35 RRH: medium info N +36 comp36?: medium info Y +37 LOADER: medium alert Y +softmodem> softmodem log level_error 0-4 +log level/verbosity comp 0 PHY set to error / medium (enabled) +log level/verbosity comp 1 MAC set to error / medium (enabled) +log level/verbosity comp 2 EMU set to error / medium (enabled) +log level/verbosity comp 3 OCG set to error / medium (enabled) +log level/verbosity comp 4 OMG set to error / medium (enabled) +softmodem> exit +Connection closed by foreign host. +``` + +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetloop.md b/common/utils/telnetsrv/DOC/telnetloop.md new file mode 100644 index 0000000000..f045e8a716 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetloop.md @@ -0,0 +1,40 @@ +The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example: + +```bash +softmodem> telnet get loopc +telnet, loopc = 10 +softmodem> telnet get loopd +telnet, loopd = 2000 +softmodem> telnet set loopd 1000 +telnet, loopd set to +1000 +softmodem> loop softmodem show thread + 2018-03-27 17:58:49.000 2/10 + id name state USRmod KRNmod prio nice vsize proc pol + + 3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other + + 3946 lte-softmodem S 7 95 20 0 236560384 2 0 other + 3948 telnet R 0 0 20 0 236560384 2 0 other + 3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other + 3951 ITTI 12 S 2 2 20 0 236560384 7 0 other + 3952 ITTI 11 S 0 0 20 0 236560384 0 0 other + 3953 ITTI 9 S 0 0 20 0 236560384 1 0 other + 3954 ITTI 7 S 0 0 20 0 236560384 7 0 other + 3955 ITTI 8 S 0 0 20 0 236560384 7 0 other + 3956 ITTI 4 S 35 0 20 0 236560384 2 0 other + 3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr + 3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo + 3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo + 3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo + 3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr + 3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr + 3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr + 3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo + 3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo + +``` +A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt. + +[oai telnetserver home](telnetsrv.md) +[oai telnetserver usage home](telnetusage.md) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetsrv.md b/common/utils/telnetsrv/DOC/telnetsrv.md new file mode 100644 index 0000000000..e8909595d9 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetsrv.md @@ -0,0 +1,7 @@ +The oai embedded telnet server is an optional monitoring and debugging tool. It provides a simple Command Line Interface to the oai softmem. New commands can easily be added by developers to the telnet server. + +* [Using the telnet server](telnetusage.md) +* [Adding commands to the oai telnet server](telnetaddcmd.md) +* [telnet server architecture ](telnetarch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/telnetsrv/DOC/telnetusage.md b/common/utils/telnetsrv/DOC/telnetusage.md new file mode 100644 index 0000000000..f8319d5ef2 --- /dev/null +++ b/common/utils/telnetsrv/DOC/telnetusage.md @@ -0,0 +1,39 @@ +# starting the softmodem with the telnet server +By default the embedded telnet server, which is implemented in a shared library, is not built. It can be built after compiling the softmodem executable using the `build_oai` script: + +```bash + cd \/openairinterface5g + source oaienv + cd cmake_targets + ./build_oai --build-telnetsrv +``` + +This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/lte_build_oai/build` sub directories of the oai repository. + +When starting the softmodem, you must specify the **_\-\-telnetsrv_** option to load and start the telnet server. The telnet server is loaded via the [oai shared library loader](loader). + +# using the Command Line Interface +By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters. +The telnet server includes a basic help, listing available commands and some commands also provide a specific detailed help sub-command. +Below are examples of telnet sessions: + +* [getting help](telnethelp.md) +* [using the history](telnethist.md) +* [using the get and set commands](telnetgetset.md) +* [using the loop command](telnetloop.md) +* [loader command](telnetloader.md) +* [log command](telnetlog.md) + +# telnet server parameters +The telnet server is using the [oai configuration module](Config/Rtusage). Telnet parameters must be specified in the `telnetsrv` section. Some parameters can be modified via the telnet telnet server command, as specified in the last column of the following table. + +| name | type | default | description | dynamic | +|:---:|:---:|:---:|:----|:----:| +| `listenaddr` | `ipV4 address, ascii format` | "0.0.0.0" | local address the server is listening on| N | +| `listenport` | `integer` | 9090 | port number the server is listening on | N | +| `loopcount` | `integer` | 10 | number of iterations for the loop command | Y | +| `loopdelay` | `integer` | 5000 | delay (in ms) between 2 loop command iterations | Y | +| `histfile` | `character string` | "oaitelnet.history" | file used for command history persistency | Y | +| `histfsize` | `integer` | 50 | maximum number of commands saved in the history | Y | + +[oai telnet server home](telnetsrv.md) \ No newline at end of file diff --git a/common/utils/time_utils.h b/common/utils/time_utils.h deleted file mode 100644 index ee82c8cf95..0000000000 --- a/common/utils/time_utils.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _TIME_UTILS_H_ -#define _TIME_UTILS_H_ - -#include -#include - -static inline int64_t clock_difftime_ns(struct timespec start, struct timespec end) -{ - struct timespec temp; - int64_t temp_ns; - - if ((end.tv_nsec-start.tv_nsec)<0) { - temp.tv_sec = end.tv_sec-start.tv_sec-1; - temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec; - } else { - temp.tv_sec = end.tv_sec-start.tv_sec; - temp.tv_nsec = end.tv_nsec-start.tv_nsec; - } - temp_ns = (int64_t)(temp.tv_sec) * (int64_t)1000000000 + (temp.tv_nsec); - return temp_ns; -} - -#endif /* _TIME_UTILS_H_ */ diff --git a/configuration/bladeRF/enb-band7-5mhz.conf b/configuration/bladeRF/enb-band7-5mhz.conf new file mode 100644 index 0000000000..6e07b8d949 --- /dev/null +++ b/configuration/bladeRF/enb-band7-5mhz.conf @@ -0,0 +1,274 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + # real_time choice in {hard, rt-preempt, no} + real_time = "no"; + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( + { mcc = 208; mnc = 92; mnc_length = 2; } + ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + nb_antenna_ports = 1; + ue_TransmissionMode = 1; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + prach_root = 0; + tx_gain = 90; + rx_gain = 115; + pbch_repetition = "FALSE"; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -29; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; +/* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; +*/ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.148"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.196/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.196/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.196/24"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="high"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="debug"; + rlc_log_verbosity ="high"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="high"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 210; + puCch10xSnr = 210; + } +); + +THREAD_STRUCT = ( + { + parallel_config = "PARALLEL_RU_L1_TRX_SPLITaaaaaa"; + worker_config = "ENABLE"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 73 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -28; + max_rxgain = 96; + eNB_instances = [0]; + + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="high"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="high"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="high"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md new file mode 100644 index 0000000000..103f132728 --- /dev/null +++ b/doc/FEATURE_SET.md @@ -0,0 +1,171 @@ +**Table of Contents** + +1. [OpenAirInterface eNB Feature Set](#openairinterface-enb-feature-set) + 1. [eNB PHY Layer](#enb-phy-layer) + 2. [eNB MAC Layer](#enb-mac-layer) + 3. [eNB RLC Layer](#enb-rlc-layer) + 4. [eNB PDCP Layer](#enb-pdcp-layer) + 5. [eNB RRC Layer](#enb-rrc-layer) + 6. [eNB X2AP](#enb-x2ap) + 7. [eNB Advanced Features](#enb-advanced-features) +2. [OpenAirInterface UE Feature Set](#openairinterface-ue-feature-set) + 1. [LTE UE PHY Layer](#lte-ue-phy-layer) + 2. [LTE UE MAC Layer](#lte-ue-mac-layer) + 3. [LTE UE RLC Layer](#lte-ue-rlc-layer) + 4. [LTE UE PDCP Layer](#lte-ue-pdcp-layer) + 5. [LTE UE RRC Layer](#lte-ue-rrc-layer) + +# OpenAirInterface Block diagram # + +![Block Diagram](./oai_enb_block_diagram.png) + +# OpenAirInterface eNB Feature Set # + +## eNB PHY Layer ## + +The Physical layer implements **3GPP 36.211**, **36.212**, **36.213** and provides the following features: + +- LTE release 8.6 compliant, and implements a subset of release 10 +- FDD and TDD configurations: 1 (experimental) and 3 +- Bandwidth: 5, 10, and 20 MHz +- Transmission modes: 1, 2 (stable), 3, 4, 5, 6, 7 (experimental) +- Max number of antennas: 2 +- CQI/PMI reporting: aperiodic, feedback mode 3 - 0 and 3 - 1 +- PRACH preamble format 0 +- All downlink (DL) channels are supported: PSS, SSS, PBCH, PCFICH, PHICH, PDCCH, PDSCH, PMCH +- All uplink (UL) channels are supported: PRACH, PUSCH, PUCCH (format 1/1a/1b), SRS, DRS +- HARQ support (UL and DL) +- Highly optimized base band processing (including turbo decoder) + +### Performances ### + +**Transmission Mode, Bandwidth** | **Expected Throughput** | **Measured Throughput** | **Measurement Conditions** +-------------------------------- | ----------------------- | ------------------------| ----------------: +FDD DL: 5 MHz, 25 PRBS/ MCS 28 | 16 - 17 Mbit/s | TM1: 17.0 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +FDD DL: 10 MHz, 50 PRBS/ MCS 28 | 34 - 35 Mbit/s | TM1: 32.8 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +FDD DL: 20 MHz, 100 PRBS/ MCS 28 | 70 Mbit/s | TM1: 69.9 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) + | | | +FDD UL: 5 MHz, 25 PRBS/ MCS 20 | 9 Mbit/s | TM1: 8.28 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +FDD UL: 10 MHz, 50 PRBS/ MCS 20 | 17 Mbit/s | TM1: 15.2 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +FDD UL: 20 MHz, 100 PRBS/ MCS 20 | 35 Mbit/s | TM1: 18.6 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) + | | +TDD DL: 5 MHz, 25 PRBS/ MCS **XX** | **TBC** Mbit/s | 3.33 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +TDD DL: 10 MHz, 50 PRBS/ MCS **XX** | **TBC** Mbit/s | 8.90 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +TDD DL: 20 MHz, 100 PRBS/ MCS **XX** | **TBC** Mbit/s | N/A | COTS-UE Cat 4 (150/50 Mbps) + | | | +TDD UL: 5 MHz, 25 PRBS/ MCS **XX** | **TBC** Mbit/s | 1.66 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +TDD UL: 10 MHz, 50 PRBS/ MCS **XX** | **TBC** Mbit/s | 1.89 Mbits/s | COTS-UE Cat 4 (150/50 Mbps) +TDD UL: 20 MHz, 100 PRBS/ MCS **XX** | **TBC** Mbit/s | N/A | COTS-UE Cat 4 (150/50 Mbps) + +- Number of supported UEs: **To Be Completed** + +## eNB MAC Layer ## + +The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support of BCH, DLSCH, RACH, and ULSCH channels. + +- RRC interface for CCCH, DCCH, and DTCH +- Proportional fair scheduler (round robin scheduler soon) +- DCI generation +- HARQ Support +- RA procedures and RNTI management +- RLC interface (AM, UM) +- UL power control +- Link adaptation + +## eNB RLC Layer ## + +The RLC layer implements a full specification of the 3GPP 36.322 release v9.3. + +- RLC TM (mainly used for BCCH and CCCH) + * Neither segment nor concatenate RLC SDUs + * Do not include a RLC header in the RLC PDU + * Delivery of received RLC PDUs to upper layers +- RLC UM (mainly used for DTCH) + * Segment or concatenate RLC SDUs according to the TB size selected by MAC + * Include a RLC header in the RLC PDU + * Duplication detection + * PDU reordering and reassembly +- RLC AM, compatible with 9.3 + * Segmentation, re-segmentation, concatenation, and reassembly + * Padding + * Data transfer to the user + * RLC PDU retransmission in support of error control and correction + * Generation of data/control PDUs + +## eNB PDCP Layer ## + +The current PDCP layer is header compliant with **3GPP 36.323** Rel 10.1.0 and implements the following functions: + +- User and control data transfer +- Sequence number management +- RB association with PDCP entity +- PDCP entity association with one or two RLC entities +- Integrity check and encryption using the AES and Snow3G algorithms + +## eNB RRC Layer ## + +The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following functions: + +- System Information broadcast (SIB 1, 2, 3, and 13) + * SIB1: Up to 6 PLMN IDs broadcast +- RRC connection establishment +- RRC connection reconfiguration (addition and removal of radio bearers, connection release) +- RRC connection release +- RRC connection re-establishment +- Inter-frequency measurement collection and reporting (experimental) +- eMBMS for multicast and broadcast (experimental) +- Handover (experimental) +- Paging (soon) + +## eNB X2AP ## + +The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following functions: + + - X2 Setup Request + - X2 Setup Response + +## eNB Advanced Features ## + +**To be completed** + +# OpenAirInterface UE Feature Set # + +## LTE UE PHY Layer ## + +The Physical layer implements **3GPP 36.211**, **36.212**, **36.213** and provides the following features: + +- LTE release 8.6 compliant, and implements a subset of release 10 +- FDD and TDD configurations: 1 (experimental) and 3 +- Bandwidth: 5, 10, and 20 MHz +- Transmission modes: 1, 2 (stable) +- Max number of antennas: 2 +- CQI/PMI reporting: aperiodic, feedback mode 3 - 0 and 3 - 1 +- PRACH preamble format 0 +- All downlink (DL) channels are supported: PSS, SSS, PBCH, PCFICH, PHICH, PDCCH, PDSCH, PMCH +- All uplink (UL) channels are supported: PRACH, PUSCH, PUCCH (format 1/1a/1b), SRS, DRS + +## LTE UE MAC Layer ## + +The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support of BCH, DLSCH, RACH, and ULSCH channels. + +- RRC interface for CCCH, DCCH, and DTCH +- HARQ Support +- RA procedures and RNTI management +- RLC interface (AM, UM) +- UL power control +- Link adaptation + +## LTE UE RLC Layer ## + +The RLC layer implements a full specification of the 3GPP 36.322 release v9.3. + +## LTE UE PDCP Layer ## + +The current PDCP layer is header compliant with **3GPP 36.323** Rel 10.1.0. + +## LTE UE RRC Layer ## + +The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following functions: + +- System Information decoding +- RRC connection establishment diff --git a/doc/oai_enb_block_diagram.png b/doc/oai_enb_block_diagram.png new file mode 100644 index 0000000000..58c8eb9e95 Binary files /dev/null and b/doc/oai_enb_block_diagram.png differ diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 51ff501666..25463a3289 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -196,14 +196,12 @@ void oai_create_enb(void) { int bodge_counter=0; PHY_VARS_eNB *eNB = RC.eNB[0][0]; - printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d td:%p te:%p if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->td, eNB->te, eNB->if_inst); + printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->if_inst); eNB->Mod_id = bodge_counter; eNB->CC_id = bodge_counter; eNB->abstraction_flag = 0; eNB->single_thread_flag = 0;//single_thread_flag; - eNB->td = ulsch_decoding_data_all;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data; - eNB->te = dlsch_encoding_all;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding; RC.nb_CC[bodge_counter] = 1; @@ -1112,7 +1110,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST; int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req); dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1; @@ -1131,7 +1129,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + tx_req->header.message_id = NFAPI_TX_REQUEST; //LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus); int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req); @@ -1149,7 +1147,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; //LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi); int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req); @@ -1168,7 +1166,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id); //LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index d0a7fa6fd1..eec9ff80c3 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -1237,11 +1237,11 @@ int pnf_connect(pnf_t* pnf) } struct addrinfo *p = servinfo; - int i = 0; int connected = 0; while(p != NULL && connected == 0) { +#ifdef NFAPI_TRACE_ENABLED char* family = "Unknown"; char* address = "Unknown"; char _addr[128]; @@ -1261,6 +1261,7 @@ int pnf_connect(pnf_t* pnf) } NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); +#endif if (pnf->sctp) { diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index 8d94c23476..81abed81a9 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) { if(now_hr < sf_start_hr) { - NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); + //NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); return 0; } else diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index cea259c35b..4b7acabec3 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) if(phy->in_sync == 0) { - NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", + /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->zero_count, - phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); + phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/ phy->sfn_sf = new_sfn_sf; } diff --git a/openair1/PHY/CODING/scrambler.h b/openair1/PHY/CODING/scrambler.h deleted file mode 100644 index 3c1b1de0a7..0000000000 --- a/openair1/PHY/CODING/scrambler.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -unsigned char scrambling_sequence[1024] = { - 208, - 127, - 52, - 95, - 204, - 135, - 48, - 31, - 248, - 32, - 208, - 135, - 192, - 232, - 63, - 175, - 4, - 212, - 119, - 24, - 169, - 162, - 101, - 144, - 75, - 109, - 75, - 29, - 91, - 191, - 165, - 246, - 177, - 71, - 16, - 92, - 68, - 80, - 132, - 4, - 248, - 251, - 32, - 65, - 125, - 56, - 94, - 86, - 152, - 11, - 201, - 134, - 39, - 250, - 19, - 162, - 25, - 190, - 62, - 3, - 190, - 18, - 188, - 215, - 97, - 239, - 72, - 11, - 0, - 26, - 57, - 211, - 146, - 37, - 205, - 121, - 204, - 83, - 13, - 206, - 53, - 27, - 214, - 32, - 54, - 214, - 82, - 125, - 226, - 108, - 169, - 102, - 247, - 255, - 32, - 171, - 201, - 112, - 20, - 253, - 65, - 192, - 38, - 78, - 114, - 40, - 95, - 32, - 70, - 194, - 242, - 153, - 207, - 63, - 61, - 117, - 122, - 32, - 73, - 60, - 160, - 140, - 99, - 235, - 118, - 176, - 75, - 102, - 254, - 5, - 67, - 194, - 122, - 62, - 226, - 56, - 69, - 123, - 213, - 179, - 119, - 221, - 23, - 63, - 26, - 160, - 233, - 166, - 179, - 243, - 169, - 190, - 183, - 146, - 169, - 185, - 216, - 214, - 158, - 86, - 139, - 214, - 143, - 181, - 0, - 9, - 147, - 254, - 105, - 138, - 213, - 118, - 14, - 74, - 153, - 110, - 41, - 47, - 172, - 91, - 216, - 117, - 156, - 62, - 56, - 75, - 113, - 6, - 123, - 178, - 118, - 97, - 82, - 75, - 96, - 21, - 148, - 170, - 120, - 227, - 0, - 245, - 25, - 147, - 243, - 185, - 203, - 135, - 48, - 104, - 89, - 38, - 71, - 30, - 74, - 219, - 130, - 107, - 75, - 244, - 138, - 8, - 8, - 248, - 175, - 65, - 234, - 35, - 125, - 138, - 0, - 95, - 23, - 171, - 177, - 166, - 196, - 173, - 235, - 244, - 124, - 20, - 22, - 78, - 32, - 207, - 173, - 103, - 232, - 84, - 18, - 227, - 246, - 127, - 136, - 28, - 188, - 39, - 132, - 79, - 14, - 62, - 80, - 248, - 171, - 21, - 160, - 188, - 110, - 125, - 55, - 198, - 139, - 185, - 28, - 127, - 239, - 246, - 223, - 47, - 55, - 63, - 63, - 129, - 253, - 175, - 122, - 182, - 139, - 52, - 163, - 164, - 177, - 6, - 187, - 220, - 159, - 76, - 36, - 164, - 108, - 218, - 189, - 250, - 148, - 201, - 45, - 207, - 174, - 81, - 195, - 108, - 96, - 203, - 132, - 210, - 34, - 142, - 247, - 238, - 139, - 84, - 84, - 194, - 168, - 46, - 9, - 238, - 29, - 135, - 115, - 95, - 12, - 218, - 18, - 134, - 110, - 83, - 110, - 44, - 80, - 80, - 216, - 126, - 160, - 65, - 142, - 142, - 209, - 69, - 234, - 200, - 184, - 171, - 248, - 185, - 148, - 203, - 90, - 143, - 231, - 29, - 47, - 214, - 151, - 154, - 137, - 152, - 228, - 192, - 182, - 108, - 200, - 226, - 204, - 82, - 170, - 110, - 197, - 143, - 169, - 230, - 75, - 204, - 177, - 222, - 142, - 1, - 104, - 130, - 224, - 201, - 29, - 223, - 246, - 132, - 173, - 42, - 33, - 165, - 147, - 208, - 124, - 208, - 198, - 51, - 78, - 76, - 216, - 164, - 250, - 186, - 214, - 57, - 52, - 52, - 199, - 37, - 3, - 242, - 120, - 179, - 26, - 233, - 51, - 42, - 11, - 108, - 26, - 41, - 192, - 41, - 221, - 71, - 16, - 67, - 131, - 90, - 226, - 181, - 0, - 244, - 183, - 31, - 78, - 241, - 221, - 173, - 248, - 146, - 23, - 244, - 102, - 194, - 201, - 16, - 25, - 155, - 110, - 146, - 54, - 246, - 40, - 5, - 78, - 94, - 47, - 135, - 60, - 103, - 29, - 175, - 142, - 9, - 213, - 70, - 159, - 168, - 176, - 217, - 91, - 13, - 1, - 254, - 104, - 135, - 20, - 135, - 147, - 23, - 141, - 8, - 115, - 180, - 201, - 50, - 246, - 4, - 12, - 72, - 59, - 166, - 22, - 61, - 77, - 140, - 183, - 150, - 255, - 55, - 31, - 71, - 215, - 83, - 75, - 169, - 137, - 104, - 237, - 88, - 118, - 146, - 247, - 95, - 182, - 241, - 29, - 98, - 243, - 152, - 52, - 230, - 114, - 27, - 247, - 116, - 78, - 152, - 202, - 96, - 15, - 112, - 196, - 245, - 148, - 9, - 228, - 111, - 131, - 179, - 198, - 243, - 35, - 140, - 234, - 248, - 8, - 197, - 218, - 35, - 246, - 172, - 207, - 93, - 62, - 157, - 196, - 149, - 199, - 136, - 30, - 70, - 13, - 116, - 63, - 171, - 207, - 254, - 51, - 18, - 126, - 246, - 195, - 218, - 222, - 204, - 105, - 132, - 150, - 123, - 136, - 24, - 23, - 143, - 162, - 175, - 185, - 148, - 104, - 135, - 118, - 44, - 126, - 59, - 67, - 114, - 157, - 194, - 201, - 231, - 40, - 80, - 42, - 195, - 50, - 133, - 186, - 43, - 134, - 234, - 170, - 96, - 177, - 67, - 61, - 121, - 31, - 171, - 120, - 208, - 74, - 84, - 33, - 148, - 199, - 59, - 171, - 244, - 243, - 114, - 92, - 90, - 99, - 89, - 181, - 25, - 224, - 39, - 149, - 209, - 40, - 151, - 1, - 171, - 106, - 75, - 126, - 134, - 35, - 187, - 12, - 31, - 114, - 240, - 229, - 182, - 48, - 86, - 192, - 247, - 109, - 78, - 111, - 74, - 207, - 72, - 232, - 177, - 126, - 167, - 213, - 139, - 124, - 122, - 18, - 108, - 35, - 213, - 86, - 218, - 226, - 143, - 169, - 11, - 165, - 137, - 241, - 146, - 115, - 208, - 178, - 197, - 0, - 119, - 147, - 29, - 144, - 167, - 236, - 133, - 233, - 23, - 140, - 30, - 186, - 159, - 76, - 6, - 150, - 13, - 72, - 34, - 240, - 114, - 192, - 238, - 72, - 42, - 177, - 15, - 33, - 162, - 170, - 167, - 64, - 169, - 78, - 162, - 226, - 229, - 191, - 209, - 140, - 213, - 161, - 23, - 147, - 249, - 103, - 56, - 153, - 108, - 105, - 148, - 177, - 245, - 168, - 201, - 101, - 103, - 5, - 104, - 90, - 171, - 155, - 153, - 121, - 130, - 35, - 112, - 242, - 140, - 206, - 125, - 225, - 79, - 154, - 161, - 143, - 71, - 45, - 145, - 15, - 95, - 105, - 202, - 158, - 11, - 119, - 124, - 66, - 60, - 86, - 118, - 120, - 101, - 209, - 58, - 211, - 184, - 42, - 142, - 66, - 201, - 147, - 149, - 26, - 213, - 168, - 108, - 93, - 237, - 168, - 152, - 128, - 44, - 87, - 140, - 248, - 218, - 189, - 93, - 25, - 76, - 249, - 103, - 187, - 167, - 31, - 194, - 133, - 247, - 148, - 20, - 169, - 141, - 166, - 118, - 102, - 208, - 187, - 177, - 71, - 70, - 182, - 55, - 205, - 174, - 20, - 234, - 146, - 78, - 115, - 199, - 104, - 89, - 254, - 232, - 246, - 208, - 127, - 242, - 221, - 200, - 198, - 66, - 153, - 12, - 25, - 184, - 78, - 203, - 45, - 233, - 51, - 253, - 169, - 30, - 5, - 65, - 188, - 226, - 167, - 236, - 17, - 173, - 193, - 123, - 249, - 117, - 107, - 140, - 56, - 91, - 180, - 19, - 79, - 5, - 204, - 185, - 109, - 37, - 187, - 147, - 197, - 58, - 100, - 40, - 11, - 22, - 248, - 236, - 189, - 218, - 3, - 109, - 243, - 153, - 247, - 142, - 35, - 59, - 228, - 102, - 130, - 141, - 200, - 201, - 101, - 139, - 129, - 21, - 246, - 111, - 143, - 95, - 249, - 7, - 196, - 85, - 133, - 175, - 59, - 130, - 214, - 255, - 36, - 49, - 209, - 144, - 168, - 20, - 126, - 19, - 198, - 119, - 221, - 229, - 245, - 173, - 218, - 244, - 14, - 53, - 221, - 252, - 107, - 213, - 65, - 129, - 23, - 187, - 196, - 118, - 77, - 205, - 9, - 75, - 179, - 23, - 176, - 49, - 41, - 84, - 163, - 182, - 156, - 167, - 247, - 95, - 212, - 43, - 183, - 152, - 63, - 252, - 67, - 21, - 224, - 128, - 201, - 251, - 136, - 117, - 214, - 96, - 226, - 157, - 79, - 154, - 98, - 120, - 65, - 134, - 130, - 138, - 197, - 64, - 171, - 85, - 144, - 120, - 179, - 180 -}; diff --git a/openair1/PHY/INIT/defs_NB_IoT.h b/openair1/PHY/INIT/defs_NB_IoT.h index b49936770f..d115a57f10 100644 --- a/openair1/PHY/INIT/defs_NB_IoT.h +++ b/openair1/PHY/INIT/defs_NB_IoT.h @@ -33,7 +33,7 @@ //#include "TDD-Config.h" //#include "MBSFN-SubframeConfigList.h" //#include "MobilityControlInfo.h" -//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +//#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //#include "SCellToAddMod-r10.h" //#endif diff --git a/openair1/PHY/INIT/init_extern.h b/openair1/PHY/INIT/init_extern.h deleted file mode 100644 index 4690bba42e..0000000000 --- a/openair1/PHY/INIT/init_extern.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c index 1bb36bd2e5..698f34833d 100644 --- a/openair1/PHY/INIT/init_top.c +++ b/openair1/PHY/INIT/init_top.c @@ -59,14 +59,11 @@ void generate_qpsk_table(void) { } } -void init_7_5KHz(void); void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) { ccodelte_init(); ccodelte_init_inv(); - init_dfts(); phy_generate_viterbi_tables_lte(); load_codinglib(); - lte_sync_time_init(frame_parms); generate_ul_ref_sigs(); generate_ul_ref_sigs_rx(); generate_64qam_table(); @@ -76,13 +73,11 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) { init_unscrambling_lut(); init_scrambling_lut(); //set_taus_seed(1328); -// init_7_5KHz(); init_sss(); } void free_lte_top(void) { free_codinglib(); - lte_sync_time_free(); /* free_ul_ref_sigs() is called in phy_free_lte_eNB() */ } diff --git a/openair1/PHY/INIT/init_vars.h b/openair1/PHY/INIT/init_vars.h deleted file mode 100644 index 4690bba42e..0000000000 --- a/openair1/PHY/INIT/init_vars.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 6734ab973d..ceab283ac6 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -27,10 +27,10 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #include "PHY/LTE_REFSIG/lte_refsig.h" #include "SIMULATION/TOOLS/sim.h" -#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "TDD-Config.h" -#include "MBSFN-SubframeConfigList.h" +#include "LTE_RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_TDD-Config.h" +#include "LTE_MBSFN-SubframeConfigList.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" #include @@ -182,7 +182,7 @@ void phy_config_request(PHY_Config_t *phy_config) { fp->frame_type, RC.eNB[Mod_id][CC_id]->X_u); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) fp->prach_emtc_config_common.prach_Config_enabled=1; fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value; @@ -487,7 +487,7 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx, void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) { uint16_t UE_id; - struct PhysicalConfigDedicated *physicalConfigDedicated; + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; for (UE_id=0; UE_idpucch_ConfigDedicated) { - if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release) + if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release) eNB->pucch_config_dedicated[UE_id].ackNackRepetition=0; else { eNB->pucch_config_dedicated[UE_id].ackNackRepetition=1; @@ -563,7 +563,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) } if (physicalConfigDedicated->schedulingRequestConfig) { - if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) { + if (physicalConfigDedicated->schedulingRequestConfig->present == LTE_SchedulingRequestConfig_PR_setup) { eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex; eNB->scheduling_request_config[UE_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex; eNB->scheduling_request_config[UE_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax; @@ -578,7 +578,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) } if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { - if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) { eNB->soundingrs_ul_config_dedicated[UE_id].srsConfigDedicatedSetup = 1; eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; @@ -729,7 +729,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars; LTE_eNB_SRS* const srs_vars = eNB->srs_vars; LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br; #endif int i, UE_id; @@ -825,7 +825,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, prach_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*)); // PRACH BR -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) ); // assume maximum of 64 RX antennas for PRACH receiver @@ -893,7 +893,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars; LTE_eNB_SRS* const srs_vars = eNB->srs_vars; LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br; #endif int i, UE_id; @@ -926,7 +926,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]); free_and_zero(prach_vars->prach_ifft[0]); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) for (int ce_level = 0; ce_level < 4; ce_level++) { for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]); free_and_zero(prach_vars_br->prach_ifft[ce_level]); diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c index 17435c1af2..703bfadbf7 100644 --- a/openair1/PHY/INIT/lte_init_ru.c +++ b/openair1/PHY/INIT/lte_init_ru.c @@ -23,10 +23,10 @@ #include "SCHED/sched_eNB.h" #include "PHY/phy_extern.h" #include "SIMULATION/TOOLS/sim.h" -#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "TDD-Config.h" -#include "MBSFN-SubframeConfigList.h" +#include "LTE_RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_TDD-Config.h" +#include "LTE_MBSFN-SubframeConfigList.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" #include @@ -67,6 +67,7 @@ int phy_init_RU(RU_t *ru) { } if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing + init_dfts(); init_7_5KHz(); LOG_I(PHY,"nb_tx %d\n",ru->nb_tx); ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); @@ -101,7 +102,7 @@ int phy_init_RU(RU_t *ru) { for (i=0; inb_rx; i++) { ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) ); LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) for (j=0;j<4;j++) { ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) ); LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]); @@ -186,7 +187,7 @@ void phy_free_RU(RU_t *ru) for (i = 0; i < ru->nb_rx; i++) { free_and_zero(ru->prach_rxsigF[i]); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]); #endif } diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c index bcdd782073..1361c41087 100644 --- a/openair1/PHY/INIT/lte_init_ue.c +++ b/openair1/PHY/INIT/lte_init_ue.c @@ -23,13 +23,14 @@ #include "SCHED_UE/sched_UE.h" #include "PHY/phy_extern_ue.h" #include "SIMULATION/TOOLS/sim.h" -#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "TDD-Config.h" -#include "MBSFN-SubframeConfigList.h" +#include "LTE_RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_TDD-Config.h" +#include "LTE_MBSFN-SubframeConfigList.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" #include +#include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #include "PHY/LTE_REFSIG/lte_refsig.h" @@ -41,7 +42,7 @@ extern uint8_t nfapi_mode; void phy_config_sib1_ue(module_id_t Mod_id,int CC_id, uint8_t eNB_id, - TDD_Config_t *tdd_Config, + LTE_TDD_Config_t *tdd_Config, uint8_t SIwindowsize, uint16_t SIperiod) { @@ -59,11 +60,11 @@ void phy_config_sib1_ue(module_id_t Mod_id,int CC_id, void phy_config_sib2_ue(module_id_t Mod_id,int CC_id, uint8_t eNB_id, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - ARFCN_ValueEUTRA_t *ul_CarrierFreq, + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + LTE_ARFCN_ValueEUTRA_t *ul_CarrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t *additionalSpectrumEmission, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList) + LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission, + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList) { PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id]; @@ -114,7 +115,7 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id, init_ul_hopping(fp); fp->soundingrs_ul_config_common.enabled_flag = 0; - if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) { + if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present == LTE_SoundingRS_UL_ConfigCommon_PR_setup) { fp->soundingrs_ul_config_common.enabled_flag = 1; fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig; fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig; @@ -159,19 +160,19 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id, fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod; fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset; - if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { + if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { fp->MBSFN_config[i].fourFrames_flag = 0; fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration - LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i, + LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is %d\n", i, fp->MBSFN_config[i].mbsfn_SubframeConfig); - } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration + } else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration fp->MBSFN_config[i].fourFrames_flag = 1; fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]| (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)| (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]<<16); - LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", i, + LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is %x\n", i, fp->MBSFN_config[i].mbsfn_SubframeConfig); } } @@ -203,11 +204,11 @@ void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_A /* * Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover */ -void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed) +void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed) { if(mobilityControlInfo!=NULL) { - RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon; + LTE_RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon; LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon); memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho, (void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms, @@ -264,7 +265,7 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobi init_ul_hopping(fp); fp->soundingrs_ul_config_common.enabled_flag = 0; - if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) { + if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present == LTE_SoundingRS_UL_ConfigCommon_PR_setup) { fp->soundingrs_ul_config_common.enabled_flag = 1; fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig; fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig; @@ -344,10 +345,10 @@ void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8 } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) void phy_config_dedicated_scell_ue(uint8_t Mod_id, uint8_t eNB_index, - SCellToAddMod_r10_t *sCellToAddMod_r10, + LTE_SCellToAddMod_r10_t *sCellToAddMod_r10, int CC_id) { @@ -366,7 +367,7 @@ void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, extern uint16_t beta_cqi[16]; void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, - struct PhysicalConfigDedicated *physicalConfigDedicated ) + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated ) { static uint8_t first_dedicated_configuration = 0; @@ -396,7 +397,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, } if (physicalConfigDedicated->pucch_ConfigDedicated) { - if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release) + if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present == LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release) phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=0; else { phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=1; @@ -448,25 +449,25 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]); switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) { - case AntennaInfoDedicated__transmissionMode_tm1: + case LTE_AntennaInfoDedicated__transmissionMode_tm1: phy_vars_ue->transmission_mode[eNB_id] = 1; break; - case AntennaInfoDedicated__transmissionMode_tm2: + case LTE_AntennaInfoDedicated__transmissionMode_tm2: phy_vars_ue->transmission_mode[eNB_id] = 2; break; - case AntennaInfoDedicated__transmissionMode_tm3: + case LTE_AntennaInfoDedicated__transmissionMode_tm3: phy_vars_ue->transmission_mode[eNB_id] = 3; break; - case AntennaInfoDedicated__transmissionMode_tm4: + case LTE_AntennaInfoDedicated__transmissionMode_tm4: phy_vars_ue->transmission_mode[eNB_id] = 4; break; - case AntennaInfoDedicated__transmissionMode_tm5: + case LTE_AntennaInfoDedicated__transmissionMode_tm5: phy_vars_ue->transmission_mode[eNB_id] = 5; break; - case AntennaInfoDedicated__transmissionMode_tm6: + case LTE_AntennaInfoDedicated__transmissionMode_tm6: phy_vars_ue->transmission_mode[eNB_id] = 6; break; - case AntennaInfoDedicated__transmissionMode_tm7: + case LTE_AntennaInfoDedicated__transmissionMode_tm7: lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti); phy_vars_ue->transmission_mode[eNB_id] = 7; break; @@ -479,7 +480,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, } if (physicalConfigDedicated->schedulingRequestConfig) { - if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) { + if (physicalConfigDedicated->schedulingRequestConfig->present == LTE_SchedulingRequestConfig_PR_setup) { phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex; phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex; phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax; @@ -496,7 +497,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0; - if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) { phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; @@ -525,14 +526,14 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic); } if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) { - if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) { + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_setup) { // configure PUCCH CQI reporting phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex; phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex; if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex) phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex; } - else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) { + else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_release) { // handle release phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; @@ -661,8 +662,9 @@ int init_lte_ue_signal(PHY_VARS_UE *ue, - + init_dfts(); init_frame_parms(&ue->frame_parms,1); + lte_sync_time_init(&ue->frame_parms); init_lte_top(&ue->frame_parms); init_7_5KHz(); init_ul_hopping(&ue->frame_parms); diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index da4050c848..9e08dabba2 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -25,15 +25,15 @@ #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "TDD-Config.h" -#include "PHICH-Config.h" -#include "MBSFN-SubframeConfigList.h" -#include "MobilityControlInfo.h" -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "SCellToAddMod-r10.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_TDD-Config.h" +#include "LTE_PHICH-Config.h" +#include "LTE_MBSFN-SubframeConfigList.h" +#include "LTE_MobilityControlInfo.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#include "LTE_SCellToAddMod-r10.h" #endif /** @addtogroup _PHY_STRUCTURES_ * @{ @@ -110,7 +110,7 @@ void phy_config_mib_eNB(int Mod_id, int CC_id, int eutra_band, int N_RB_DL, - PHICH_Config_t *phich_config, + LTE_PHICH_Config_t *phich_config, int Nid_cell, int Ncp, int p_eNB, @@ -128,7 +128,7 @@ void phy_config_mib_eNB(int Mod_id, @param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/ void phy_config_sib1_eNB(module_id_t Mod_id, int CC_id, - TDD_Config_t *tdd_Config, + LTE_TDD_Config_t *tdd_Config, uint8_t SIwindowsize, uint16_t SIperiod); @@ -143,7 +143,7 @@ void phy_config_sib1_eNB(module_id_t Mod_id, void phy_config_sib1_ue(module_id_t Mod_id, int CC_id, uint8_t CH_index, - TDD_Config_t *tdd_Config, + LTE_TDD_Config_t *tdd_Config, uint8_t SIwindowsize, uint16_t SIperiod); @@ -166,14 +166,14 @@ void phy_config_sib1_ue(module_id_t Mod_id, @param additionalSpectrumEmission UL parameter (see 36.101) @param mbsfn_SubframeConfigList MBSFN subframe configuration */ -void phy_config_sib2_ue(module_id_t Mod_id, - int CC_id, - uint8_t CH_index, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - ARFCN_ValueEUTRA_t *ul_CArrierFreq, - long *ul_Bandwidth, - AdditionalSpectrumEmission_t *additionalSpectrumEmission, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); +void phy_config_sib2_ue(module_id_t Mod_id, + int CC_id, + uint8_t CH_index, + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreq, + long *ul_Bandwidth, + LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission, + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); /*! @@ -188,7 +188,7 @@ void phy_config_sib2_ue(module_id_t Mod_id, void phy_config_afterHO_ue(module_id_t Mod_id, uint8_t CC_id, uint8_t eNB_index, - MobilityControlInfo_t *mobilityControlInfo, + LTE_MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed); /*! \fn void phy_config_sib2_eNB(module_id_t Mod_id, @@ -206,13 +206,13 @@ void phy_config_afterHO_ue(module_id_t Mod_id, @param additionalSpectrumEmission UL parameter (see 36.101) @param mbsfn_SubframeConfigList MBSFN subframe configuration */ -void phy_config_sib2_eNB(module_id_t Mod_id, - int CC_id, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - ARFCN_ValueEUTRA_t *ul_CArrierFreq, +void phy_config_sib2_eNB(module_id_t Mod_id, + int CC_id, + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t *additionalSpectrumEmission, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); + LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission, + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); /*! @@ -229,7 +229,7 @@ void phy_config_sib2_eNB(module_id_t Mod_id, void phy_config_dedicated_ue(module_id_t Mod_id, int CC_id, uint8_t CH_index, - struct PhysicalConfigDedicated *physicalConfigDedicated); + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated); /*! \fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index, @@ -308,7 +308,7 @@ void phy_config_meas_ue(module_id_t Mod_id, void phy_config_dedicated_eNB(module_id_t Mod_id, int CC_id, rnti_t rnti, - struct PhysicalConfigDedicated *physicalConfigDedicated); + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated); /*! \fn void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB) @@ -349,15 +349,15 @@ void lte_param_init(PHY_VARS_eNB **eNBp, uint32_t perfect_ce); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) void phy_config_dedicated_scell_ue(uint8_t Mod_id, uint8_t eNB_index, - SCellToAddMod_r10_t *sCellToAddMod_r10, + LTE_SCellToAddMod_r10_t *sCellToAddMod_r10, int CC_id); void phy_config_dedicated_scell_eNB(uint8_t Mod_id, uint16_t rnti, - SCellToAddMod_r10_t *sCellToAddMod_r10, + LTE_SCellToAddMod_r10_t *sCellToAddMod_r10, int CC_id); #endif diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c deleted file mode 100644 index 516cb32999..0000000000 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "PHY/types.h" -#include "PHY/defs_UE.h" -#include "PHY/phy_extern_ue.h" - -#include "UTIL/LOG/vcd_signal_dumper.h" -#include "openair2/LAYER2/MAC/mac_proto.h" - -#define DEBUG_PHY - -// Adjust location synchronization point to account for drift -// The adjustment is performed once per frame based on the -// last channel estimate of the receiver - -void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, - PHY_VARS_UE *ue, - module_id_t eNB_id, - uint8_t subframe, - unsigned char clear, - short coef) -{ - - static int max_pos_fil = 0; - static int count_max_pos_ok = 0; - static int first_time = 1; - int temp = 0, i, aa, max_val = 0, max_pos = 0; - int diff; - short Re,Im,ncoef; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN); - - ncoef = 32767 - coef; - -#ifdef DEBUG_PHY - LOG_D(PHY,"AbsSubframe %d.%d: rx_offset (before) = %d\n",ue->proc.proc_rxtx[0].frame_rx%1024,subframe,ue->rx_offset); -#endif //DEBUG_PHY - - - // we only use channel estimates from tx antenna 0 here - for (i = 0; i < frame_parms->nb_prefix_samples; i++) { - temp = 0; - - for (aa=0; aanb_antennas_rx; aa++) { - Re = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[(i<<1)]; - Im = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[1+(i<<1)]; - temp += (Re*Re/2) + (Im*Im/2); - } - - if (temp > max_val) { - max_pos = i; - max_val = temp; - } - } - - // filter position to reduce jitter - if (clear == 1) - max_pos_fil = max_pos; - else - max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15; - - // do not filter to have proactive timing adjustment - max_pos_fil = max_pos; - - if(subframe == 5) - { - diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3); - -#if BASIC_SIMULATOR - /* a hack without which the UE does not connect (to be fixed somehow) */ - diff = 0; -#endif - - if ( abs(diff) < SYNCH_HYST ) - ue->rx_offset = 0; - else - ue->rx_offset = diff; - - if(abs(diff)<5) - count_max_pos_ok ++; - else - count_max_pos_ok = 0; - - if(count_max_pos_ok > 10 && first_time == 1) - { - first_time = 0; - ue->time_sync_cell = 1; - if (ue->mac_enabled==1) { - LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); - //mac_resynch(); - dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id); - ue->UE_mode[0] = PRACH; - } - else { - ue->UE_mode[0] = PUSCH; - } - } - - if ( ue->rx_offset < 0 ) - ue->rx_offset += FRAME_LENGTH_COMPLEX_SAMPLES; - - if ( ue->rx_offset >= FRAME_LENGTH_COMPLEX_SAMPLES ) - ue->rx_offset -= FRAME_LENGTH_COMPLEX_SAMPLES; - - - - #ifdef DEBUG_PHY - LOG_D(PHY,"AbsSubframe %d.%d: ThreadId %d diff =%i rx_offset (final) = %i : clear %d,max_pos = %d,max_pos_fil = %d (peak %d) max_val %d target_pos %d \n", - ue->proc.proc_rxtx[ue->current_thread_id[subframe]].frame_rx, - subframe, - ue->current_thread_id[subframe], - diff, - ue->rx_offset, - clear, - max_pos, - max_pos_fil, - temp,max_val, - (frame_parms->nb_prefix_samples>>3)); - #endif //DEBUG_PHY - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT); - } -} diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c index c912c88934..e8a0913e73 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c @@ -36,7 +36,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, PHY_VARS_UE *ue, module_id_t eNB_id, - uint8_t subframe, + uint8_t subframe, unsigned char clear, short coef) { @@ -96,6 +96,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, else count_max_pos_ok = 0; + if(count_max_pos_ok > 10 && first_time == 1) { first_time = 0; @@ -103,7 +104,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, if (ue->mac_enabled==1) { LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); //mac_resynch(); - dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id); + //dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id); ue->UE_mode[0] = PRACH; } else { diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h deleted file mode 100644 index 4690bba42e..0000000000 --- a/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 520488664d..a7131ad1fb 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -121,7 +121,7 @@ uint8_t *generate_dci0(uint8_t *dci, (aggregation_level==2) || (aggregation_level==4) || (aggregation_level==8) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH || (aggregation_level==16) || (aggregation_level==24) || diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index 9aacdd079d..20ab151f50 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -60,7 +60,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Rule for accumulation of subframes for BL/CE UEs uint8_t Nacc=4; uint16_t j0,j,idelta; @@ -97,7 +97,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, // reset = 1; // x1 is set in lte_gold_generic if (mbsfn_flag == 0) { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #ifdef PHY_TX_THREAD if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) { #else @@ -115,7 +115,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, } #ifdef DEBUG_SCRAMBLING -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2); #else printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2); @@ -169,7 +169,6 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - s = lte_gold_generic(&x1, &x2, 0); e += 32; } diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c index fc82fd0137..06bd5aecd5 100755 --- a/openair1/PHY/LTE_TRANSPORT/edci.c +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -47,7 +47,7 @@ //#define DEBUG_DCI_DECODING 1 //#define DEBUG_PHY -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) { } diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index 4037c51e43..180d6d5e16 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -47,7 +47,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { int32_t **txdataF = ru->common.txdataF_BF; int32_t **rxdataF = ru->common.rxdataF; int16_t **prach_rxsigF = ru->prach_rxsigF; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br; #endif void *tx_buffer = ru->ifbuffer.tx[subframe&1]; @@ -230,12 +230,10 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) { int16_t *rxF; - - for (int antenna_id=0;antenna_idnb_rx;antenna_id++) { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - if (packet_type > IF4p5_PRACH) - rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0]; - else +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + if (packet_type > IF4p5_PRACH) + rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0]; + else #endif rxF = &prach_rxsigF[antenna_id][0]; @@ -275,7 +273,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint int32_t **txdataF = ru->common.txdataF_BF; int32_t **rxdataF = ru->common.rxdataF; int16_t **prach_rxsigF = ru->prach_rxsigF; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br; #endif void *rx_buffer = ru->ifbuffer.rx; @@ -386,7 +384,6 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint *packet_type <= IF4p5_PRACH + 4) { int16_t *rxF; - for (int antenna_id=0;antenna_idnb_rx;antenna_id++) { #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (*packet_type > IF4p5_PRACH) diff --git a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h b/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h deleted file mode 100644 index 59959a90fd..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#define modOrder(I_MCS,I_TBS) ((I_MCS-I_TBS)*2+2) // Find modulation order from I_TBS and I_MCS - -/** \fn unsigned char I_TBS2I_MCS(unsigned char I_TBS); -\brief This function maps I_tbs to I_mcs according to Table 7.1.7.1-1 in 3GPP TS 36.213 V8.6.0. Where there is two supported modulation orders for the same I_TBS then either high or low modulation is chosen by changing the equality of the two first comparisons in the if-else statement. -\param I_TBS Index of Transport Block Size -\return I_MCS given I_TBS -*/ -unsigned char I_TBS2I_MCS(unsigned char I_TBS); - -/** \fn unsigned char SE2I_TBS(float SE, - unsigned char N_PRB, - unsigned char symbPerRB); -\brief This function maps a requested throughput in number of bits to I_tbs. The throughput is calculated as a function of modulation order, RB allocation and number of symbols per RB. The mapping orginates in the "Transport block size table" (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0) -\param SE Spectral Efficiency (before casting to integer, multiply by 1024, remember to divide result by 1024!) -\param N_PRB Number of PhysicalResourceBlocks allocated \sa lte_frame_parms->N_RB_DL -\param symbPerRB Number of symbols per resource block allocated to this channel -\return I_TBS given an SE and an N_PRB -*/ -unsigned char SE2I_TBS(float SE, - unsigned char N_PRB, - unsigned char symbPerRB); diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 2bdc497e1f..5a52d58b4c 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -38,8 +38,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "prach_extern.h" - -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0)) #define rx_prach0 rx_prach #endif @@ -50,7 +49,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint16_t *max_preamble_delay, uint16_t Nf, uint8_t tdd_mapindex -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,uint8_t br_flag, uint8_t ce_level #endif @@ -96,7 +95,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32))); int32_t *prach_ifft=(int32_t*)NULL; int32_t **prach_ifftp=(int32_t **)NULL; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int prach_ifft_cnt=0; #endif if (ru) { @@ -111,7 +110,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, frame_type = fp->frame_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag == 1) { AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1, "emtc prach_Config is not enabled\n"); @@ -150,7 +149,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, #endif if (eNB) { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag == 1) { prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level]; subframe = eNB->proc.subframe_prach_br; @@ -177,7 +176,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, } } else { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag == 1) { subframe = ru->proc.subframe_prach_br; rxsigF = ru->prach_rxsigF_br[ce_level]; @@ -428,7 +427,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) { /// **** send_IF4 of rxsigF to RAU **** /// -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level); else @@ -573,7 +572,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, if (new_dft == 1) { new_dft = 0; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag == 1) { Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx]; prach_ifft = prach_ifftp[prach_ifft_cnt++]; @@ -630,7 +629,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, } // new dft // check energy in nth time shift, for -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if ((br_flag==0) || (eNB->prach_vars_br.repetition_number[ce_level]== eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) @@ -697,7 +696,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void rx_prach(PHY_VARS_eNB *eNB, RU_t *ru, @@ -740,5 +739,5 @@ void rx_prach(PHY_VARS_eNB *eNB, } -#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ +#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index 475a97ca0c..4962f6a7f9 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -570,7 +570,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int i; for (i=0;i<4;i++) { diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h index 130c973774..c1104cd290 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h @@ -105,7 +105,7 @@ typedef enum { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) typedef enum { CEmodeA = 0, CEmodeB = 1 @@ -138,7 +138,7 @@ typedef enum { HARQ_SR_CQI } UCI_type_t; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) typedef enum { NOCE, CEMODEA, @@ -183,7 +183,7 @@ typedef struct { PRACH_TDD_PREAMBLE_MAP_elem map[6]; } PRACH_TDD_PREAMBLE_MAP; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) typedef struct { uint16_t slss_id; diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h index d1dd595d35..7df39e038c 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h @@ -126,7 +126,7 @@ typedef struct { /// codeword this transport block is mapped to uint8_t codeword; #ifdef PHY_TX_THREAD -#ifdef Rel14 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling uint8_t sib1_br_flag; /// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling @@ -183,7 +183,7 @@ typedef struct { /// amplitude of PDSCH (compared to RS) in symbols containing pilots int16_t sqrt_rho_b; #ifndef PHY_TX_THREAD -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling uint8_t sib1_br_flag; /// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling @@ -348,7 +348,7 @@ typedef struct { uint8_t tdd_bundling; /// Received Energy uint32_t stat; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// non BL/CE, CEmodeA, CEmodeB UE_type_t ue_type; /// Indicates the symbols that are left empty due to eMTC retuning. diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h index c51ce5e1d0..0c0d2c962d 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h @@ -457,14 +457,6 @@ void generate_pcfich(uint8_t num_pdcch_symbols, int32_t **txdataF, uint8_t subframe); - - - - -void init_transport_channels(uint8_t); - - - void rx_ulsch(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, uint8_t UE_id); @@ -578,7 +570,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru, uint16_t *max_preamble_energy, uint16_t *max_preamble_delay, uint16_t Nf, uint8_t tdd_mapindex -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint8_t br_flag #endif diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 3264b76a1a..7c6fc9bdcf 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -1505,7 +1505,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, // Do ULSCH Decoding for data portion - ret = eNB->td(eNB,UE_id,harq_pid,llr8_flag); + ret = ulsch_decoding_data_all(eNB,UE_id,harq_pid,llr8_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,0); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index e0ea796a82..89f0016c23 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -51,7 +51,14 @@ #include "transport_proto_ue.h" #include "../LTE_TRANSPORT/transport_common_proto.h" #include "SCHED/sched_common.h" - + +/* +#undef LOG_D +#define LOG_D(A,B...) printf(B) +#undef LOG_I +#define LOG_I(A,B...) printf(B) +*/ + extern uint16_t beta_cqi[16]; extern uint16_t beta_ri[16]; extern uint16_t beta_ack[16]; @@ -1274,7 +1281,7 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms, symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; if((symbol_mod == 0) || symbol_mod == (4-frame_parms->Ncp)) { - if (frame_parms->nb_antennas_tx == 2) + if (frame_parms->nb_antenna_ports_eNB == 2) crs_re = 4; else crs_re = 2; @@ -3593,7 +3600,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, if (cqi_req == 1) { - if( (AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) ) + if( (LTE_AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (LTE_AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) ) { ulsch->O_RI = 1; } @@ -4222,7 +4229,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, /* int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, - eNB_rxtx_proc_t *proc, + L1_rxtx_proc_t *proc, void *dci_pdu, uint16_t rnti, DCI_format_t dci_format, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c index afbd19329d..1b4ca3ed2f 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c @@ -38,8 +38,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" //#define DEBUG_DLSCH_DECODING -#define UE_DEBUG_TRACE 1 - +//#define UE_DEBUG_TRACE 1 void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) { @@ -626,7 +625,7 @@ decoder_if_t *tc; if (err_flag == 1) { #if UE_DEBUG_TRACE - LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", + LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); #endif dlsch->harq_ack[subframe].ack = 0; @@ -650,7 +649,7 @@ decoder_if_t *tc; return((1+dlsch->max_turbo_iterations)); } else { #if UE_DEBUG_TRACE - LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n", + LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n", phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb); #endif diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 92239beadb..2123561def 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -1298,7 +1298,7 @@ void dlsch_channel_compensation(int **rxdataF_ext, unsigned short rb; unsigned char aatx,aarx,symbol_mod,pilots=0; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; @@ -1311,9 +1311,9 @@ void dlsch_channel_compensation(int **rxdataF_ext, } for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + __m128i QAM_amp128b = _mm_setzero_si128(); if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) - QAM_amp128b = _mm_setzero_si128(); } else if (mod_order == 6) { QAM_amp128 = _mm_set1_epi16(QAM64_n1); // QAM_amp128b = _mm_set1_epi16(QAM64_n2); @@ -1766,11 +1766,11 @@ void dlsch_channel_compensation_core(int **rxdataF_ext, int length_mod8 = 0; int length2; __m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b, *dl_ch128_2, *rxdataF128,*rxdataF_comp128,*rho128; - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128; int aatx = 0, aarx = 0; for (aatx=0; aatx=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; @@ -2167,10 +2167,9 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, //printf("comp prec: symbol %d, pilots %d\n",symbol, pilots); - + __m128i QAM_amp128b = _mm_setzero_si128(); if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); - QAM_amp128b = _mm_setzero_si128(); } else if (mod_order == 6) { QAM_amp128 = _mm_set1_epi16(QAM64_n1); QAM_amp128b = _mm_set1_epi16(QAM64_n2); @@ -2621,7 +2620,7 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, int **rxdataF_comp0 = pdsch_vars->rxdataF_comp0; int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round]; unsigned char *pmi_ext = pdsch_vars->pmi_ext; - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp0_128,QAM_amp0_128b,QAM_amp1_128,QAM_amp1_128b; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp0_128,QAM_amp1_128; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; @@ -2632,17 +2631,17 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, // printf("comp prec: symbol %d, pilots %d\n",symbol, pilots); + __m128i QAM_amp0_128b = _mm_setzero_si128(); if (mod_order0 == 4) { QAM_amp0_128 = _mm_set1_epi16(QAM16_n1); - QAM_amp0_128b = _mm_setzero_si128(); } else if (mod_order0 == 6) { QAM_amp0_128 = _mm_set1_epi16(QAM64_n1); QAM_amp0_128b = _mm_set1_epi16(QAM64_n2); } + __m128i QAM_amp1_128b = _mm_setzero_si128(); if (mod_order1 == 4) { QAM_amp1_128 = _mm_set1_epi16(QAM16_n1); - QAM_amp1_128b = _mm_setzero_si128(); } else if (mod_order1 == 6) { QAM_amp1_128 = _mm_set1_epi16(QAM64_n1); QAM_amp1_128b = _mm_set1_epi16(QAM64_n2); @@ -4335,7 +4334,7 @@ void dlsch_channel_aver_band(int **dl_ch_estimates_ext, else nre=12; - for (aatx=0; aatxnb_antennas_tx; aatx++){ + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++){ for (aarx=0; aarxnb_antennas_rx; aarx++) { dl_ch128=(__m128i *)&dl_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx + aarx][symbol*frame_parms->N_RB_DL*12]; avg128D = _mm_setzero_si128(); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c index ea3f100504..55407d8e2d 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c @@ -672,15 +672,15 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, len = (nb_rb*12) - pbch_pss_sss_adjust; } - - /* - LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n", - symbol, - first_symbol_flag, - len, - dlsch_llr, - llr32); - */ + + LOG_D(PHY,"[p %d : symb %d / FirstSym %d / Length %d]: @LLR Buff %p, @LLR Buff(symb) %p \n", + frame_parms->nb_antenna_ports_eNB, + symbol, + first_symbol_flag, + len, + dlsch_llr, + llr32); + qpsk_llr((short *)rxF, (short *)llr32, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index c4d576021b..a741dce36e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1440,8 +1440,6 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); -void init_transport_channels(uint8_t); - void generate_RIV_tables(void); /*! diff --git a/openair1/PHY/MODULATION/prach625Hz.h b/openair1/PHY/MODULATION/prach625Hz.h deleted file mode 100644 index 38b63b3b05..0000000000 --- a/openair1/PHY/MODULATION/prach625Hz.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -int16_t sig625_1_25MHz[2850*2]; -int16_t sig625_2_5MHz[5700*2]; -int16_t sig625_5MHz[11400*2]; -int16_t sig625_10MHz[22800*2]; -int16_t sig625_15MHz[34200*2]; -int16_t sig625_20MHz[45600*2]; diff --git a/openair1/PHY/Makefile.inc b/openair1/PHY/Makefile.inc deleted file mode 100644 index 90094b31f8..0000000000 --- a/openair1/PHY/Makefile.inc +++ /dev/null @@ -1,91 +0,0 @@ -PHY_OBJS = $(TOP_DIR)/PHY/LTE_TRANSPORT/pss.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/sss.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_ue_spec.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_mbsfn.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_coding.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_modulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_demodulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_llr_computation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/power_control.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_decoding.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_scrambling.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dci_tools.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/uci_tools.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/lte_mcs.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pbch.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dci.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/phich.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pcfich.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pucch.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/prach.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pmch.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/group_hopping.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/srs_modulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/drs_modulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_modulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_demodulation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_coding.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_decoding.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/rar_tools.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/print_stats.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/initial_sync.o -#PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/lte_transport_init.o -PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/ofdm_mod.o -PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep.o -PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep_mbsfn.o -PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep_ul.o -PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/ul_7_5_kHz.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/freq_equalization.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_time.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_timefreq.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_adjust_sync.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_est_freq_offset.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ue_measurements.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_eNB_measurements.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/adjust_gain.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_cell_spec.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_ue_spec.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold_mbsfn.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_mbsfn.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_ul_ref.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/lte_segmentation.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/ccoding_byte.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/ccoding_byte_lte.o -#PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_sse.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/crc_byte.o -#PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/lte_rate_matching.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/rate_matching.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/viterbi.o -PHY_OBJS += $(TOP_DIR)/PHY/CODING/viterbi_lte.o -PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_init.o -PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_parms.o -PHY_OBJS += $(TOP_DIR)/PHY/INIT/init_top.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/file_output.o -#PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/fft.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/lte_dfts.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/log2_approx.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cmult_sv.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cmult_vv.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cadd_vv.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cdot_prod.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/signal_energy.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/dB_routines.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/sqrt.o -ifdef SMBV -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/smbv.o -endif -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/time_meas.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/lut.o -#PHY_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o - diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index 8a7c853df5..0a34d9f12b 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -425,7 +425,7 @@ typedef struct eNB_proc_NB_IoT_t_s { int RU_mask; /// mask for RUs serving nbiot (PRACH) int RU_mask_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// mask for RUs serving eNB (PRACH) int RU_mask_prach_br; #endif diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 55f8c9639a..5beb6e3ba0 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -204,6 +204,12 @@ typedef struct { /// condition variable for timer_thread; pthread_cond_t cond_ticking; //time_stats_t timer_stats; + + // below 3 members is used for waiting each UE threads(multiple UEs test) in L2 FAPI simulator. + // This used in UE_phy_stub_single_thread_rxn_txnp4 + pthread_mutex_t mutex_single_thread; + pthread_cond_t cond_single_thread; + int num_single_thread[NUMBER_OF_UE_MAX]; } SF_ticking; typedef struct { @@ -847,6 +853,7 @@ typedef struct { time_stats_t pdsch_procedures_stat[RX_NB_TH]; time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; time_stats_t dlsch_procedures_stat[RX_NB_TH]; + time_stats_t crnti_procedures_stats; time_stats_t ofdm_demod_stats; time_stats_t dlsch_rx_pdcch_stats; @@ -889,6 +896,7 @@ typedef struct { struct rx_tx_thread_data { PHY_VARS_UE *UE; UE_rxtx_proc_t *proc; + uint16_t ue_thread_id; }; diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 9a735b038f..9f4a196a9b 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -58,6 +58,7 @@ #include #include "common_lib.h" #include "msc.h" +#include //#include @@ -159,7 +160,7 @@ typedef struct { PRACH_CONFIG_INFO prach_ConfigInfo; } PRACH_CONFIG_COMMON; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// PRACH-eMTC-Config from 36.331 RRC spec typedef struct { @@ -192,7 +193,7 @@ typedef struct { /// prach_Config_enabled=1 means enabled. \vr{[0..1]} uint8_t prach_Config_enabled; /// PRACH Configuration Information -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) PRACH_eMTC_CONFIG_INFO prach_ConfigInfo; #endif } PRACH_eMTC_CONFIG_COMMON; @@ -644,7 +645,7 @@ typedef struct { uint8_t nb_antenna_ports_eNB; /// PRACH_CONFIG PRACH_CONFIG_COMMON prach_config_common; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// PRACH_eMTC_CONFIG PRACH_eMTC_CONFIG_COMMON prach_emtc_config_common; #endif @@ -862,22 +863,60 @@ typedef enum { RESYNCH=4 } UE_MODE_t; -/// Threading Parameter -typedef enum { - PARALLEL_SINGLE_THREAD =0, - PARALLEL_RU_L1_SPLIT =1, - PARALLEL_RU_L1_TRX_SPLIT =2 -}PARALLEL_CONF_t; +#define FOREACH_PARALLEL(GEN) \ + GEN(PARALLEL_SINGLE_THREAD) \ + GEN(PARALLEL_RU_L1_SPLIT) \ + GEN(PARALLEL_RU_L1_TRX_SPLIT) + +#define GENERATE_ENUM(N) N, +#define GENERATE_ENUMTXT(N) {(char*)#N, N}, typedef enum { - WORKER_DISABLE =0, - WORKER_ENABLE =1 + FOREACH_PARALLEL(GENERATE_ENUM) +} PARALLEL_CONF_t; + +#define FOREACH_WORKER(GEN) GEN(WORKER_DISABLE) GEN(WORKER_ENABLE) +typedef enum { + FOREACH_WORKER(GENERATE_ENUM) }WORKER_CONF_t; typedef struct THREAD_STRUCT_s { PARALLEL_CONF_t parallel_conf; WORKER_CONF_t worker_conf; } THREAD_STRUCT; +extern THREAD_STRUCT thread_struct; + +static inline void set_parallel_conf(char *parallel_conf) { + mapping config[]= { + FOREACH_PARALLEL(GENERATE_ENUMTXT) + {NULL,-1} + }; + thread_struct.parallel_conf = (PARALLEL_CONF_t)map_str_to_int(config, parallel_conf); + if (thread_struct.parallel_conf == -1 ) { + LOG_E(ENB_APP,"Impossible value: %s\n", parallel_conf); + thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD; + } +} + +static inline void set_worker_conf(char *worker_conf) { + mapping config[]={ + FOREACH_WORKER(GENERATE_ENUMTXT) + {NULL, -1} + }; + thread_struct.worker_conf = (WORKER_CONF_t)map_str_to_int(config, worker_conf); + if (thread_struct.worker_conf == -1 ) { + LOG_E(ENB_APP,"Impossible value: %s\n", worker_conf); + thread_struct.worker_conf = WORKER_DISABLE ; + } +} + +static inline PARALLEL_CONF_t get_thread_parallel_conf(void) { + return thread_struct.parallel_conf; +} + +static inline WORKER_CONF_t get_thread_worker_conf(void) { + return thread_struct.worker_conf; +} typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t; diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 5e239123fb..34bccd1e16 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -85,7 +85,7 @@ typedef struct RU_proc_t_s { int subframe_tx; /// subframe to act upon for reception of prach int subframe_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// subframe to act upon for reception of prach BL/CE UEs int subframe_prach_br; #endif @@ -97,7 +97,7 @@ typedef struct RU_proc_t_s { int frame_tx_unwrap; /// frame to act upon for reception of prach int frame_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// frame to act upon for reception of prach int frame_prach_br; #endif @@ -109,7 +109,7 @@ typedef struct RU_proc_t_s { int instance_cnt_FH1; /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach_br; #endif @@ -140,7 +140,7 @@ typedef struct RU_proc_t_s { /// pthread structure for RU prach processing thread pthread_t pthread_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// pthread structure for RU prach processing thread BL/CE UEs pthread_t pthread_prach_br; #endif @@ -168,7 +168,7 @@ typedef struct RU_proc_t_s { /// pthread attributes for RU prach pthread_attr_t attr_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// pthread attributes for RU prach BL/CE UEs pthread_attr_t attr_prach_br; #endif @@ -187,7 +187,7 @@ typedef struct RU_proc_t_s { struct sched_param sched_param_FH1; /// scheduling parameters for RU prach thread struct sched_param sched_param_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// scheduling parameters for RU prach thread BL/CE UEs struct sched_param sched_param_prach_br; #endif @@ -200,7 +200,7 @@ typedef struct RU_proc_t_s { pthread_cond_t cond_FH1; /// condition variable for RU prach thread pthread_cond_t cond_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// condition variable for RU prach thread BL/CE UEs pthread_cond_t cond_prach_br; #endif @@ -223,7 +223,7 @@ typedef struct RU_proc_t_s { pthread_mutex_t mutex_FH1; /// mutex for RU prach pthread_mutex_t mutex_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// mutex for RU prach BL/CE UEs pthread_mutex_t mutex_prach_br; #endif @@ -280,9 +280,6 @@ typedef struct RU_proc_t_s { pthread_mutex_t mutex_pre_scd; int instance_pre_scd; #endif - /// pipeline ready state - int ru_rx_ready; - int ru_tx_ready; int emulate_rf_busy; } RU_proc_t; @@ -413,7 +410,7 @@ typedef struct RU_t_s{ int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru); /// function pointer to wakeup routine in lte-enb. void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// function pointer to wakeup routine in lte-enb. void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); #endif @@ -552,7 +549,7 @@ typedef struct RRU_config_s { int prach_FreqOffset[MAX_BANDS_PER_RRU]; /// prach_ConfigIndex for IF4p5 int prach_ConfigIndex[MAX_BANDS_PER_RRU]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4]; /// emtc_prach_FreqOffset for IF4p5 per CE Level int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4]; @@ -701,7 +698,7 @@ typedef struct { int32_t **prach_ifft[4]; /// repetition number -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// indicator of first frame in a group of PRACH repetitions int first_frame[4]; /// current repetition for each CE level @@ -793,7 +790,7 @@ typedef struct L1_proc_t_s { int subframe_rx; /// subframe to act upon for PRACH int subframe_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// subframe to act upon for reception of prach BL/CE UEs int subframe_prach_br; #endif @@ -803,7 +800,7 @@ typedef struct L1_proc_t_s { int frame_tx; /// frame to act upon for PRACH int frame_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// frame to act upon for PRACH BL/CE UEs int frame_prach_br; #endif @@ -813,7 +810,7 @@ typedef struct L1_proc_t_s { int instance_cnt_te; /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// \internal This variable is protected by \ref mutex_prach for BL/CE UEs. int instance_cnt_prach_br; #endif @@ -837,7 +834,7 @@ typedef struct L1_proc_t_s { pthread_attr_t attr_single; /// pthread attributes for prach processing thread pthread_attr_t attr_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// pthread attributes for prach processing thread BL/CE UEs pthread_attr_t attr_prach_br; #endif @@ -851,7 +848,7 @@ typedef struct L1_proc_t_s { struct sched_param sched_param_single; /// scheduling parameters for prach thread struct sched_param sched_param_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// scheduling parameters for prach thread struct sched_param sched_param_prach_br; #endif @@ -863,7 +860,7 @@ typedef struct L1_proc_t_s { pthread_t pthread_te; /// pthread structure for PRACH thread pthread_t pthread_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// pthread structure for PRACH thread BL/CE UEs pthread_t pthread_prach_br; #endif @@ -873,7 +870,7 @@ typedef struct L1_proc_t_s { pthread_cond_t cond_te; /// condition variable for PRACH processing thread; pthread_cond_t cond_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// condition variable for PRACH processing thread BL/CE UEs; pthread_cond_t cond_prach_br; #endif @@ -886,7 +883,7 @@ typedef struct L1_proc_t_s { pthread_mutex_t mutex_te; /// mutex for PRACH thread pthread_mutex_t mutex_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// mutex for PRACH thread for BL/CE UEs pthread_mutex_t mutex_prach_br; #endif @@ -910,7 +907,7 @@ typedef struct L1_proc_t_s { time_stats_t ru_arrival_time; /// mask for RUs serving eNB (PRACH) int RU_mask_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// mask for RUs serving eNB (PRACH) int RU_mask_prach_br; #endif @@ -993,7 +990,7 @@ typedef struct PHY_VARS_eNB_s { module_id_t Mod_id; uint8_t CC_id; uint8_t configured; - L1_proc_t proc; + L1_proc_t proc; int single_thread_flag; int abstraction_flag; int num_RU; @@ -1003,8 +1000,6 @@ typedef struct PHY_VARS_eNB_s { /// Ethernet parameters for fronthaul interface eth_params_t eth_params; int rx_total_gain_dB; - int (*td)(struct PHY_VARS_eNB_s *eNB,int UE_id,int harq_pid,int llr8_flag); - int (*te)(struct PHY_VARS_eNB_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *); int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB); uint8_t local_flag; LTE_DL_FRAME_PARMS frame_parms; @@ -1026,14 +1021,14 @@ typedef struct PHY_VARS_eNB_s { nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU]; /// NFAPI PRACH information nfapi_preamble_pdu_t preamble_list[MAX_NUM_RX_PRACH_PREAMBLES]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// NFAPI PRACH information BL/CE UEs nfapi_preamble_pdu_t preamble_list_br[MAX_NUM_RX_PRACH_PREAMBLES]; #endif Sched_Rsp_t Sched_INFO; LTE_eNB_PDCCH pdcch_vars[2]; LTE_eNB_PHICH phich_vars[2]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LTE_eNB_EPDCCH epdcch_vars[2]; LTE_eNB_MPDCCH mpdcch_vars[2]; LTE_eNB_PRACH prach_vars_br; @@ -1065,7 +1060,7 @@ typedef struct PHY_VARS_eNB_s { uint32_t lte_gold_mbsfn_table[10][3][42]; uint32_t X_u[64][839]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t X_u_br[4][64][839]; #endif uint8_t pbch_configured; @@ -1136,7 +1131,7 @@ typedef struct PHY_VARS_eNB_s { uint8_t cba_last_reception[4]; // Pointers for active physicalConfigDedicated to be applied in current subframe - struct PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX]; + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX]; uint32_t rb_mask_ul[4]; @@ -1173,12 +1168,13 @@ typedef struct PHY_VARS_eNB_s { int hw_timing_advance; - time_stats_t phy_proc; time_stats_t phy_proc_tx; time_stats_t phy_proc_rx; time_stats_t rx_prach; time_stats_t ofdm_mod_stats; + time_stats_t dlsch_common_and_dci; + time_stats_t dlsch_ue_specific; time_stats_t dlsch_encoding_stats; time_stats_t dlsch_modulation_stats; time_stats_t dlsch_scrambling_stats; diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index 0d29b03f63..33f93fc78d 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -28,9 +28,9 @@ #include "common/ran_context.h" -char* namepointer_chMag ; +char *namepointer_chMag ; char fmageren_name2[512]; -char* namepointer_log2; +char *namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" @@ -45,7 +45,7 @@ int16_t *primary_synch2_time; PHY_VARS_UE ***PHY_vars_UE_g; LTE_DL_FRAME_PARMS *lte_frame_parms_g; #else -PHY_VARS_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]={NULL}; +PHY_VARS_UE *PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]= {NULL}; #endif @@ -62,10 +62,10 @@ char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; #ifndef OPENAIR2 -unsigned char NB_eNB_INST=0; -unsigned char NB_UE_INST=0; -unsigned char NB_RN_INST=0; -unsigned char NB_INST=0; + unsigned char NB_eNB_INST=0; + unsigned char NB_UE_INST=0; + unsigned char NB_RN_INST=0; + unsigned char NB_INST=0; #endif unsigned int ULSCH_max_consecutive_errors = 20; @@ -134,9 +134,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682 #ifdef OCP_FRAMEWORK #include #else -char eNB_functions[6][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5",}; -char eNB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; -char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; +char eNB_functions[6][20]= {"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5",}; +char eNB_timing[2][20]= {"synch_to_ext_device","synch_to_other"}; +char ru_if_types[MAX_RU_IF_TYPES][20]= {"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; #endif /// lookup table for unscrambling in RX diff --git a/openair1/SCHED/Makefile.inc b/openair1/SCHED/Makefile.inc deleted file mode 100644 index 559d3dca32..0000000000 --- a/openair1/SCHED/Makefile.inc +++ /dev/null @@ -1,6 +0,0 @@ -SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o -SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_ue.o -SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_eNb.o -SCHED_OBJS += $(TOP_DIR)/SCHED/pusch_pc.o -SCHED_OBJS += $(TOP_DIR)/SCHED/pucch_pc.o -SCHED_OBJS += $(TOP_DIR)/SCHED/srs_pc.o diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 63f26fb3e7..34ce3d18d6 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -63,7 +63,7 @@ void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populated pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci); } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, @@ -128,7 +128,7 @@ void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, // adjust transmit amplitude here based on NFAPI info } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) extern uint32_t localRIV2alloc_LUT6[32]; extern uint32_t localRIV2alloc_LUT25[512]; extern uint32_t localRIV2alloc_LUT50_0[1600]; @@ -145,10 +145,10 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro uint8_t *sdu) { nfapi_dl_config_dlsch_pdu_rel8_t *rel8 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) nfapi_dl_config_dlsch_pdu_rel10_t *rel10 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10; #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) nfapi_dl_config_dlsch_pdu_rel13_t *rel13 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13; #endif LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; @@ -167,7 +167,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[frame%2][subframe] = 0; #endif @@ -236,7 +236,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro rel8->rnti,UE_id,harq_pid); } -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) #ifdef PHY_TX_THREAD dlsch0_harq->sib1_br_flag=0; #else @@ -307,7 +307,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LOG_D(PHY,"dlsch->i0:%04x dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n", #ifdef PHY_TX_THREAD dlsch0_harq->i0, @@ -821,7 +821,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: // handle_nfapi_epdcch_pdu(eNB,dl_config_pdu); break; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: handle_nfapi_mpdcch_pdu(eNB,proc,dl_config_pdu); eNB->mpdcch_vars[subframe&1].num_dci++; diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c index 664791f7c4..55149f8d2e 100644 --- a/openair1/SCHED/phy_mac_stub.c +++ b/openair1/SCHED/phy_mac_stub.c @@ -40,7 +40,7 @@ uint8_t dci_ndi_toggle_even[8] = {0, 0, 0, 0, 0, 0, 0, 0}; uint8_t dci_ndi_toggle_odd[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) +void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { /* SYRTEM */ uint8_t *dci_ndi_toggle_tmp = NULL; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 6b67855546..24c446f04f 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -136,7 +136,7 @@ lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subfr void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) MCH_PDU *mch_pduP=NULL; // uint8_t sync_area=255; #endif @@ -152,7 +152,7 @@ void pmch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { subframe<<1,1); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // if mcch is active, send regardless of the node type: eNB or RN // when mcch is active, MAC sched does not allow MCCH and MTCH multiplexing /* @@ -254,6 +254,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) { if (eNB->pbch_configured!=1) return; eNB->pbch_configured=0; } + T(T_ENB_PHY_MIB, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), + T_BUFFER(pbch_pdu, 3)); generate_pbch(&eNB->pbch, txdataF, AMP, @@ -398,7 +400,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, start_meas(&eNB->dlsch_encoding_stats); - eNB->te(eNB, + dlsch_encoding_all(eNB, dlsch_harq->pdu, dlsch_harq->pdsch_start, dlsch, @@ -484,6 +486,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),1); if (do_meas==1) start_meas(&eNB->phy_proc_tx); + if (do_meas==1) start_meas(&eNB->dlsch_common_and_dci); // clear the transmit data array for the current subframe for (aa=0; aanb_antenna_ports_eNB; aa++) { @@ -578,6 +581,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, subframe); } + if (do_meas==1) stop_meas(&eNB->dlsch_common_and_dci); + if (do_meas==1) start_meas(&eNB->dlsch_ue_specific); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); @@ -645,6 +650,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),0); + if (do_meas==1) stop_meas(&eNB->dlsch_ue_specific); if (do_meas==1) stop_meas(&eNB->phy_proc_tx); } diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index 46002b01d3..135a2f3943 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -54,7 +54,7 @@ extern uint32_t nfapi_mode; extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void prach_procedures(PHY_VARS_eNB *eNB -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , int br_flag #endif @@ -63,7 +63,7 @@ void prach_procedures(PHY_VARS_eNB *eNB uint16_t i; int frame,subframe; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag==1) { subframe = eNB->proc.subframe_prach_br; frame = eNB->proc.frame_prach_br; @@ -93,7 +93,7 @@ void prach_procedures(PHY_VARS_eNB *eNB ru=eNB->RU_list[i]; for (ru_aa=0,aa=0;ru_aanb_rx;ru_aa++,aa++) { eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int ce_level; if (br_flag==1) @@ -109,7 +109,7 @@ void prach_procedures(PHY_VARS_eNB *eNB &max_preamble_delay[0], frame, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,br_flag #endif ); @@ -121,7 +121,7 @@ void prach_procedures(PHY_VARS_eNB *eNB max_preamble_delay[0], eNB->prach_energy_counter); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (br_flag==1) { eNB->UL_INFO.rach_ind_br.rach_indication_body.preamble_list = eNB->preamble_list_br; diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h index 5a4a5d5275..e9af869b05 100644 --- a/openair1/SCHED/sched_common.h +++ b/openair1/SCHED/sched_common.h @@ -30,7 +30,7 @@ #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" -#include "TDD-Config.h" +#include "LTE_TDD-Config.h" /*! \brief Function to compute subframe Number(DL and S) as a function of Frame type and TDD Configuration @param frame_parms Pointer to DL frame parameter descriptor @returns Subframe Number (DL,S) @@ -346,7 +346,7 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri int ul_ACK_subframe2_dl_frame(LTE_DL_FRAME_PARMS *frame_parms,int frame, unsigned char subframe,unsigned char subframe_tx); -void get_retransmission_timing(TDD_Config_t *tdd_Config, frame_t *frameP, sub_frame_t *subframeP); +void get_retransmission_timing(LTE_TDD_Config_t *tdd_Config, frame_t *frameP, sub_frame_t *subframeP); /*@}*/ diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h index e54e4afd3b..dccfbf7c38 100644 --- a/openair1/SCHED/sched_eNB.h +++ b/openair1/SCHED/sched_eNB.h @@ -127,7 +127,7 @@ void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc); @param phy_vars_eNB Pointer to eNB variables on which to act @param br_flag indicator for eMTC PRACH */ -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void prach_procedures(PHY_VARS_eNB *eNB, int br_flag); #else diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 4a5747a146..f0635cb737 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -45,7 +45,7 @@ #ifndef PUCCH -#define PUCCH + #define PUCCH #endif #include "LAYER2/MAC/mac.h" @@ -55,7 +55,7 @@ #include "UTIL/OPT/opt.h" #if defined(ENABLE_ITTI) -# include "intertask_interface.h" + #include "intertask_interface.h" #endif #include "PHY/defs_UE.h" @@ -77,41 +77,36 @@ void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8 void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) -extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; + extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; #endif void get_dumpparam(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, uint8_t nb_rb, uint32_t *alloc_even, uint8_t subframe,uint32_t Qm, uint32_t Nl, uint32_t tm, uint8_t *nsymb, uint32_t *coded_bits_per_codeword) { - *nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12; - *coded_bits_per_codeword = get_G(&ue->frame_parms, - nb_rb, - alloc_even, - Qm, - Nl, - ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, - proc->frame_rx, - subframe, - tm); + nb_rb, + alloc_even, + Qm, + Nl, + ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, + proc->frame_rx, + subframe, + tm); } -void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid) -{ - if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { +void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid) { + if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { unsigned int coded_bits_per_codeword; uint8_t nsymb ; - - get_dumpparam(ue, proc, eNB_id, - ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb , - ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, - subframe, - ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Qm, - ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], - &nsymb, &coded_bits_per_codeword); - + get_dumpparam(ue, proc, eNB_id, + ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, + ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, + subframe, + ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Qm, + ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], + &nsymb, &coded_bits_per_codeword); LOG_M("rxsigF0.m","rxsF0", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],2*nsymb*ue->frame_parms.ofdm_symbol_size,2,1); LOG_M("rxsigF0_ext.m","rxsF0_ext", ue->pdsch_vars[ue->current_thread_id[subframe]][0]->rxdataF_ext[0],2*nsymb*ue->frame_parms.ofdm_symbol_size,1,1); LOG_M("dlsch00_ch0_ext.m","dl00_ch0_ext", ue->pdsch_vars[ue->current_thread_id[subframe]][0]->dl_ch_estimates_ext[0],300*nsymb,1,1); @@ -123,36 +118,30 @@ void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subf */ LOG_M("dlsch_rxF_comp0.m","dlsch0_rxF_comp0", ue->pdsch_vars[ue->current_thread_id[subframe]][0]->rxdataF_comp0[0],300*12,1,1); LOG_M("dlsch_rxF_llr.m","dlsch_llr", ue->pdsch_vars[ue->current_thread_id[subframe]][0]->llr[0],coded_bits_per_codeword,1,0); - LOG_M("dlsch_mag1.m","dlschmag1",ue->pdsch_vars[ue->current_thread_id[subframe]][0]->dl_ch_mag0,300*12,1,1); LOG_M("dlsch_mag2.m","dlschmag2",ue->pdsch_vars[ue->current_thread_id[subframe]][0]->dl_ch_magb0,300*12,1,1); - } + } } -void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe) -{ - if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)){ +void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe) { + if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { unsigned int coded_bits_per_codeword; uint8_t nsymb; - get_dumpparam(ue, proc, eNB_id, - ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, - ue->dlsch_SI[eNB_id]->harq_processes[0]->rb_alloc_even, - subframe,2,1,0, - &nsymb, &coded_bits_per_codeword); - + ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, + ue->dlsch_SI[eNB_id]->harq_processes[0]->rb_alloc_even, + subframe,2,1,0, + &nsymb, &coded_bits_per_codeword); LOG_D(PHY,"[UE %d] Dumping dlsch_SI : ofdm_symbol_size %d, nsymb %d, nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", - ue->Mod_id, - ue->frame_parms.ofdm_symbol_size, - nsymb, - ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, - ue->dlsch_SI[eNB_id]->harq_processes[0]->mcs, - ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, - ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, - coded_bits_per_codeword); - + ue->Mod_id, + ue->frame_parms.ofdm_symbol_size, + nsymb, + ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, + ue->dlsch_SI[eNB_id]->harq_processes[0]->mcs, + ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, + ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, + coded_bits_per_codeword); LOG_M("rxsig0.m","rxs0", &ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti],ue->frame_parms.samples_per_tti,1,1); - LOG_M("rxsigF0.m","rxsF0", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],nsymb*ue->frame_parms.ofdm_symbol_size,1,1); LOG_M("rxsigF0_ext.m","rxsF0_ext", ue->pdsch_vars_SI[0]->rxdataF_ext[0],2*nsymb*ue->frame_parms.ofdm_symbol_size,1,1); LOG_M("dlsch00_ch0_ext.m","dl00_ch0_ext", ue->pdsch_vars_SI[0]->dl_ch_estimates_ext[0],ue->frame_parms.N_RB_DL*12*nsymb,1,1); @@ -164,7 +153,6 @@ void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t s */ LOG_M("dlsch_rxF_comp0.m","dlsch0_rxF_comp0", ue->pdsch_vars_SI[0]->rxdataF_comp0[0],ue->frame_parms.N_RB_DL*12*nsymb,1,1); LOG_M("dlsch_rxF_llr.m","dlsch_llr", ue->pdsch_vars_SI[0]->llr[0],coded_bits_per_codeword,1,0); - LOG_M("dlsch_mag1.m","dlschmag1",ue->pdsch_vars_SI[0]->dl_ch_mag0,300*nsymb,1,1); LOG_M("dlsch_mag2.m","dlschmag2",ue->pdsch_vars_SI[0]->dl_ch_magb0,300*nsymb,1,1); sleep(1); @@ -214,9 +202,7 @@ void dump_dlsch_SI(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t s } */ -unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb) -{ - +unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb) { int gain_dB; double gain_lin; @@ -232,27 +218,22 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb #endif -void dump_dlsch_ra(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe) -{ - if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)){ +void dump_dlsch_ra(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe) { + if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { unsigned int coded_bits_per_codeword; uint8_t nsymb ; - - get_dumpparam(ue, proc, eNB_id, - ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, - ue->dlsch_SI[eNB_id]->harq_processes[0]->rb_alloc_even, - subframe,2,1,0, - &nsymb, &coded_bits_per_codeword); - + ue->dlsch_SI[eNB_id]->harq_processes[0]->nb_rb, + ue->dlsch_SI[eNB_id]->harq_processes[0]->rb_alloc_even, + subframe,2,1,0, + &nsymb, &coded_bits_per_codeword); LOG_D(PHY,"[UE %d] Dumping dlsch_ra : nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", - ue->Mod_id, - ue->dlsch_ra[eNB_id]->harq_processes[0]->nb_rb, - ue->dlsch_ra[eNB_id]->harq_processes[0]->mcs, - ue->dlsch_ra[eNB_id]->harq_processes[0]->nb_rb, - ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, - coded_bits_per_codeword); - + ue->Mod_id, + ue->dlsch_ra[eNB_id]->harq_processes[0]->nb_rb, + ue->dlsch_ra[eNB_id]->harq_processes[0]->mcs, + ue->dlsch_ra[eNB_id]->harq_processes[0]->nb_rb, + ue->pdcch_vars[0%RX_NB_TH][eNB_id]->num_pdcch_symbols, + coded_bits_per_codeword); LOG_M("rxsigF0.m","rxsF0", ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0],2*12*ue->frame_parms.ofdm_symbol_size,2,1); LOG_M("rxsigF0_ext.m","rxsF0_ext", ue->pdsch_vars_ra[0]->rxdataF_ext[0],2*12*ue->frame_parms.ofdm_symbol_size,1,1); LOG_M("dlsch00_ch0_ext.m","dl00_ch0_ext", ue->pdsch_vars_ra[0]->dl_ch_estimates_ext[0],300*nsymb,1,1); @@ -264,60 +245,53 @@ void dump_dlsch_ra(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t s */ LOG_M("dlsch_rxF_comp0.m","dlsch0_rxF_comp0", ue->pdsch_vars_ra[0]->rxdataF_comp0[0],300*nsymb,1,1); LOG_M("dlsch_rxF_llr.m","dlsch_llr", ue->pdsch_vars_ra[0]->llr[0],coded_bits_per_codeword,1,0); - LOG_M("dlsch_mag1.m","dlschmag1",ue->pdsch_vars_ra[0]->dl_ch_mag0,300*nsymb,1,1); LOG_M("dlsch_mag2.m","dlschmag2",ue->pdsch_vars_ra[0]->dl_ch_magb0,300*nsymb,1,1); } } -void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index) -{ - +void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { // This flushes ALL DLSCH and ULSCH harq buffers of ALL connected eNBs...add the eNB_index later // for more flexibility - uint8_t i,j,k,s; PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id]; //[NUMBER_OF_RX_THREAD=2][NUMBER_OF_CONNECTED_eNB_MAX][2]; for(int l=0; ldlsch[l][i][j]) { - for(k=0; kdlsch[l][i][j]->harq_processes[k]; k++) { - ue->dlsch[l][i][j]->harq_processes[k]->status = SCH_IDLE; - for (s=0; s<10; s++) { - // reset ACK/NACK bit to DTX for all subframes s = 0..9 - ue->dlsch[l][i][j]->harq_ack[s].ack = 2; - ue->dlsch[l][i][j]->harq_ack[s].send_harq_status = 0; - ue->dlsch[l][i][j]->harq_ack[s].vDAI_UL = 0xff; - ue->dlsch[l][i][j]->harq_ack[s].vDAI_DL = 0xff; - } - } - } + for(i=0; idlsch[l][i][j]) { + for(k=0; kdlsch[l][i][j]->harq_processes[k]; k++) { + ue->dlsch[l][i][j]->harq_processes[k]->status = SCH_IDLE; + + for (s=0; s<10; s++) { + // reset ACK/NACK bit to DTX for all subframes s = 0..9 + ue->dlsch[l][i][j]->harq_ack[s].ack = 2; + ue->dlsch[l][i][j]->harq_ack[s].send_harq_status = 0; + ue->dlsch[l][i][j]->harq_ack[s].vDAI_UL = 0xff; + ue->dlsch[l][i][j]->harq_ack[s].vDAI_DL = 0xff; + } } - - //UL HARQ - if(ue->ulsch[i]) { - for(k=0; kulsch[i]->harq_processes[k]; k++) { - ue->ulsch[i]->harq_processes[k]->status = SCH_IDLE; - //Set NDIs for all UL HARQs to 0 - // ue->ulsch[i]->harq_processes[k]->Ndi = 0; - - } - } - - // flush Msg3 buffer - ue->ulsch_Msg3_active[i] = 0; - + } } + + //UL HARQ + if(ue->ulsch[i]) { + for(k=0; kulsch[i]->harq_processes[k]; k++) { + ue->ulsch[i]->harq_processes[k]->status = SCH_IDLE; + //Set NDIs for all UL HARQs to 0 + // ue->ulsch[i]->harq_processes[k]->Ndi = 0; + } + } + + // flush Msg3 buffer + ue->ulsch_Msg3_active[i] = 0; + } } } -void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) -{ - +void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { // if contention resolution fails, go back to PRACH PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; @@ -327,13 +301,9 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) LOG_E(PHY,"[UE %d] Random-access procedure fails, going back to PRACH, setting SIStatus = 0, discard temporary C-RNTI and State RRC_IDLE\n",Mod_id); } -void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) -{ - +void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { int i; - LOG_I(PHY,"[UE %d][RAPROC] Random-access procedure succeeded. Set C-RNTI = Temporary C-RNTI\n",Mod_id); - PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_index]->crnti_is_temporary = 0; PHY_vars_UE_g[Mod_id][CC_id]->ulsch_Msg3_active[eNB_index] = 0; @@ -347,50 +317,31 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->harq_processes[i]->subframe_scheduling_flag=0; } } - - } -UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) -{ - +UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index]); - } void process_timing_advance_rar(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint16_t timing_advance) { - ue->timing_advance = timing_advance*4; - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - /* TODO: fix this log, what is 'HW timing advance'? */ - /*LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance);*/ + /* TODO: fix this log, what is 'HW timing advance'? */ + /*LOG_I(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d, HW timing advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance);*/ LOG_UI(PHY,"[UE %d] AbsoluteSubFrame %d.%d, received (rar) timing_advance %d\n",ue->Mod_id,proc->frame_rx, proc->subframe_rx, ue->timing_advance); } - } -void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance) -{ - +void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance) { // uint32_t frame = PHY_vars_UE_g[Mod_id]->frame; - // timing advance has Q1.5 format timing_advance = timing_advance - 31; - PHY_vars_UE_g[Mod_id][CC_id]->timing_advance = PHY_vars_UE_g[Mod_id][CC_id]->timing_advance+timing_advance*4; //this is for 25RB only!!! - - LOG_D(PHY,"[UE %d] Got timing advance %d from MAC, new value %d\n",Mod_id, timing_advance, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance); - - } -uint8_t is_SR_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) -{ - +uint8_t is_SR_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) { int subframe=proc->subframe_tx; - LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Checking for SR TXOp (sr_ConfigIndex %d)\n", ue->Mod_id,ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti,proc->frame_tx,subframe, ue->scheduling_request_config[eNB_id].sr_ConfigIndex); @@ -415,8 +366,7 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) return(0); } -uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) -{ +uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) { int subframe = proc->subframe_tx; int frame = proc->frame_tx; CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; @@ -433,10 +383,7 @@ uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) else return(0); } -uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) -{ - - +uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) { int subframe = proc->subframe_tx; int frame = proc->frame_tx; CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; @@ -462,22 +409,17 @@ void compute_cqi_ri_resources(PHY_VARS_UE *ue, uint16_t p_rnti, uint16_t cba_rnti, uint8_t cqi_status, - uint8_t ri_status) -{ - //PHY_MEASUREMENTS *meas = &ue->measurements; - //uint8_t transmission_mode = ue->transmission_mode[eNB_id]; + uint8_t ri_status) { + //PHY_MEASUREMENTS *meas = &ue->measurements; + //uint8_t transmission_mode = ue->transmission_mode[eNB_id]; - - //LOG_I(PHY,"compute_cqi_ri_resources O_RI %d O %d uci format %d \n",ulsch->O_RI,ulsch->O,ulsch->uci_format); - if (cqi_status == 1 || ri_status == 1) - { - ulsch->O = 4; - } + //LOG_I(PHY,"compute_cqi_ri_resources O_RI %d O %d uci format %d \n",ulsch->O_RI,ulsch->O,ulsch->uci_format); + if (cqi_status == 1 || ri_status == 1) { + ulsch->O = 4; + } } -void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t isSubframeSRS) -{ - +void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t isSubframeSRS) { LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int frame_tx = proc->frame_tx; int subframe_tx = proc->subframe_tx; @@ -486,91 +428,81 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id uint16_t srsOffset; uint8_t is_pucch2_subframe = 0; uint8_t is_sr_an_subframe = 0; - // check for SRS opportunity pSoundingrs_ul_config_dedicated->srsUeSubframe = 0; pSoundingrs_ul_config_dedicated->srsCellSubframe = isSubframeSRS; if (isSubframeSRS) { LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); - if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) - { - compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); - LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); + if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) { + compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); + LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); + // transmit SRS if the four following constraints are respected: + // - UE is configured to transmit SRS + // - SRS are configured in current subframe + // - UE is configured to send SRS in this subframe + // 36.213 8.2 + // 1- A UE shall not transmit SRS whenever SRS and PUCCH format 2/2a/2b transmissions happen to coincide in the same subframe + // 2- A UE shall not transmit SRS whenever SRS transmit + // on and PUCCH transmission carrying ACK/NACK and/or + // positive SR happen to coincide in the same subframe if the parameter + // Simultaneous-AN-and-SRS is FALSE + // check PUCCH format 2/2a/2b transmissions + is_pucch2_subframe = is_cqi_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0); + is_pucch2_subframe = (is_ri_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0)) || is_pucch2_subframe; - // transmit SRS if the four following constraints are respected: - // - UE is configured to transmit SRS - // - SRS are configured in current subframe - // - UE is configured to send SRS in this subframe + // check ACK/SR transmission + if(frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission == FALSE) { + if(is_SR_TXOp(ue,proc,eNB_id)) { + uint32_t SR_payload = 0; - // 36.213 8.2 - // 1- A UE shall not transmit SRS whenever SRS and PUCCH format 2/2a/2b transmissions happen to coincide in the same subframe - // 2- A UE shall not transmit SRS whenever SRS transmit - // on and PUCCH transmission carrying ACK/NACK and/or - // positive SR happen to coincide in the same subframe if the parameter - // Simultaneous-AN-and-SRS is FALSE + if (ue->mac_enabled==1) { + int Mod_id = ue->Mod_id; + int CC_id = ue->CC_id; + SR_payload = ue_get_SR(Mod_id, + CC_id, + frame_tx, + eNB_id, + ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti, + subframe_tx); // subframe used for meas gap - // check PUCCH format 2/2a/2b transmissions - is_pucch2_subframe = is_cqi_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0); - is_pucch2_subframe = (is_ri_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0)) || is_pucch2_subframe; - - // check ACK/SR transmission - if(frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission == FALSE) - { - if(is_SR_TXOp(ue,proc,eNB_id)) - { - uint32_t SR_payload = 0; - if (ue->mac_enabled==1) - { - int Mod_id = ue->Mod_id; - int CC_id = ue->CC_id; - SR_payload = ue_get_SR(Mod_id, - CC_id, - frame_tx, - eNB_id, - ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti, - subframe_tx); // subframe used for meas gap - - if (SR_payload > 0) - is_sr_an_subframe = 1; - } - } - - uint8_t pucch_ack_payload[2]; - if (get_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, - subframe_tx,proc->subframe_rx,pucch_ack_payload,0) > 0) - { - is_sr_an_subframe = 1; - } + if (SR_payload > 0) + is_sr_an_subframe = 1; } + } - // check SRS UE opportunity - if( isSubframeSRS && - (((10*frame_tx+subframe_tx) % srsPeriodicity) == srsOffset) - ) - { - if ((is_pucch2_subframe == 0) && (is_sr_an_subframe == 0)) - { - pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; - ue->ulsch[eNB_id]->srs_active = 1; - ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; - } - else - { - LOG_I(PHY,"DROP UE-SRS-TX for this subframe %d.%d: collision with PUCCH2 or SR/AN: PUCCH2-occasion: %d, SR-AN-occasion[simSRS-SR-AN %d]: %d \n", frame_tx, subframe_tx, is_pucch2_subframe, frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, is_sr_an_subframe); - } - } + uint8_t pucch_ack_payload[2]; + + if (get_ack(&ue->frame_parms, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, + subframe_tx,proc->subframe_rx,pucch_ack_payload,0) > 0) { + is_sr_an_subframe = 1; + } } - LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, ue->ulsch[eNB_id]->Nsymb_pusch); + + // check SRS UE opportunity + if( isSubframeSRS && + (((10*frame_tx+subframe_tx) % srsPeriodicity) == srsOffset) + ) { + if ((is_pucch2_subframe == 0) && (is_sr_an_subframe == 0)) { + pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; + ue->ulsch[eNB_id]->srs_active = 1; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; + } else { + LOG_I(PHY,"DROP UE-SRS-TX for this subframe %d.%d: collision with PUCCH2 or SR/AN: PUCCH2-occasion: %d, SR-AN-occasion[simSRS-SR-AN %d]: %d \n", frame_tx, subframe_tx, is_pucch2_subframe, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, is_sr_an_subframe); + } + } + } + + LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, + ue->ulsch[eNB_id]->Nsymb_pusch); } } -void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id) -{ - +void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id) { CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; int cqi_PMI_ConfigIndex = cqirep->cqi_PMI_ConfigIndex; @@ -596,46 +528,41 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id) } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period cqirep->Npd = 160; cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-157; - } - else if (cqi_PMI_ConfigIndex > 317) { - + } else if (cqi_PMI_ConfigIndex > 317) { if (cqi_PMI_ConfigIndex <= 349) { // 32 ms CQI_PMI period - cqirep->Npd = 32; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-318; - } - else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period - cqirep->Npd = 64; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-350; - } - else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period - cqirep->Npd = 128; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-414; + cqirep->Npd = 32; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-318; + } else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period + cqirep->Npd = 64; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-350; + } else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period + cqirep->Npd = 128; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-414; } } - } - else { // TDD - if (cqi_PMI_ConfigIndex == 0) { // all UL subframes - cqirep->Npd = 1; - cqirep->N_OFFSET_CQI = 0; - } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period - cqirep->Npd = 5; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-1; - } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period - cqirep->Npd = 10; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-6; - } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period - cqirep->Npd = 20; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-16; - } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period - cqirep->Npd = 40; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-36; - } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period - cqirep->Npd = 80; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-76; - } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period - cqirep->Npd = 160; - cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-156; - } + } else { // TDD + if (cqi_PMI_ConfigIndex == 0) { // all UL subframes + cqirep->Npd = 1; + cqirep->N_OFFSET_CQI = 0; + } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period + cqirep->Npd = 5; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-1; + } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period + cqirep->Npd = 10; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-6; + } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period + cqirep->Npd = 20; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-16; + } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period + cqirep->Npd = 40; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-36; + } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period + cqirep->Npd = 80; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-76; + } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period + cqirep->Npd = 160; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-156; + } } } @@ -645,76 +572,66 @@ PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type, uint8_t nb_cw, uint8_t cqi_status, uint8_t ri_status, - uint8_t bundling_flag) -{ - if((cqi_status == 0) && (ri_status==0)) - { - // PUCCH Format 1 1a 1b - // 1- SR only ==> PUCCH format 1 - // 2- 1bit Ack/Nack with/without SR ==> PUCCH format 1a - // 3- 2bits Ack/Nack with/without SR ==> PUCCH format 1b - if((nb_cw == 1)&&(bundling_flag==bundling)) - { - return pucch_format1a; - } - if((nb_cw == 1)&&(bundling_flag==multiplexing)) - { - return pucch_format1b; - } - if(nb_cw == 2) - { - return pucch_format1b; - } - if(SR_payload == 1) - { + uint8_t bundling_flag) { + if((cqi_status == 0) && (ri_status==0)) { + // PUCCH Format 1 1a 1b + // 1- SR only ==> PUCCH format 1 + // 2- 1bit Ack/Nack with/without SR ==> PUCCH format 1a + // 3- 2bits Ack/Nack with/without SR ==> PUCCH format 1b + if((nb_cw == 1)&&(bundling_flag==bundling)) { + return pucch_format1a; + } + + if((nb_cw == 1)&&(bundling_flag==multiplexing)) { + return pucch_format1b; + } + + if(nb_cw == 2) { + return pucch_format1b; + } + + if(SR_payload == 1) { + return pucch_format1; + /* + if (frame_type == FDD) { return pucch_format1; - /* - if (frame_type == FDD) { - return pucch_format1; - } else if (frame_type == TDD) { - return pucch_format1b; - } else { - AssertFatal(1==0,"Unknown frame_type"); - }*/ - } - } - else - { - // PUCCH Format 2 2a 2b - // 1- CQI only or RI only ==> PUCCH format 2 - // 2- CQI or RI + 1bit Ack/Nack for normal CP ==> PUCCH format 2a - // 3- CQI or RI + 2bits Ack/Nack for normal CP ==> PUCCH format 2b - // 4- CQI or RI + Ack/Nack for extended CP ==> PUCCH format 2 - if(nb_cw == 0) - { - return pucch_format2; - } - if(cyclic_prefix_type == NORMAL) - { - if(nb_cw == 1) - { - return pucch_format2a; - } - if(nb_cw == 2) - { - return pucch_format2b; - } - } - else - { - return pucch_format2; + } else if (frame_type == TDD) { + return pucch_format1b; + } else { + AssertFatal(1==0,"Unknown frame_type"); + }*/ + } + } else { + // PUCCH Format 2 2a 2b + // 1- CQI only or RI only ==> PUCCH format 2 + // 2- CQI or RI + 1bit Ack/Nack for normal CP ==> PUCCH format 2a + // 3- CQI or RI + 2bits Ack/Nack for normal CP ==> PUCCH format 2b + // 4- CQI or RI + Ack/Nack for extended CP ==> PUCCH format 2 + if(nb_cw == 0) { + return pucch_format2; + } + + if(cyclic_prefix_type == NORMAL) { + if(nb_cw == 1) { + return pucch_format2a; } + + if(nb_cw == 2) { + return pucch_format2b; + } + } else { + return pucch_format2; + } } + return pucch_format1a; } uint16_t get_n1_pucch(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, + UE_rxtx_proc_t *proc, harq_status_t *harq_ack, uint8_t eNB_id, uint8_t *b, - uint8_t SR) -{ - + uint8_t SR) { LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; uint8_t nCCE0,nCCE1,nCCE2,nCCE3,harq_ack1,harq_ack0,harq_ack3,harq_ack2; ANFBmode_t bundling_flag; @@ -726,7 +643,6 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, uint8_t ack_counter=0; // clear this, important for case where n1_pucch selection is not used int subframe=proc->subframe_tx; - ue->pucch_sel[subframe] = 0; if (frame_parms->frame_type == FDD ) { // FDD @@ -738,10 +654,9 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, else return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); } else { - bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { if (bundling_flag==bundling) { LOG_D(PHY,"[UE%d] Frame %d subframe %d : get_n1_pucch, bundling, SR %d/%d\n",ue->Mod_id,proc->frame_tx,subframe,SR, ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); @@ -751,179 +666,175 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, } } - switch (frame_parms->tdd_config) { - case 1: // DL:S:UL:UL:DL:DL:S:UL:UL:DL + case 1: // DL:S:UL:UL:DL:DL:S:UL:UL:DL + harq_ack0 = 2; // DTX + M=1; - harq_ack0 = 2; // DTX - M=1; - - // This is the offset for a particular subframe (2,3,4) => (0,2,4) - if (subframe == 2) { // ACK subframes 5,6 - candidate_dl[0] = 6; - candidate_dl[1] = 5; - M=2; - } else if (subframe == 3) { // ACK subframe 9 - candidate_dl[0] = 9; - } else if (subframe == 7) { // ACK subframes 0,1 - candidate_dl[0] = 1; - candidate_dl[1] = 0; - M=2; - } else if (subframe == 8) { // ACK subframes 4 - candidate_dl[0] = 4; - } else { - LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal tx-subframe %d for tdd_config %d\n", - ue->Mod_id,proc->frame_tx,subframe,frame_parms->tdd_config); - return(0); - } - - // checking which downlink candidate is the last downlink with valid DL-DCI - int k; - for (k=0;k0) { - last_dl = candidate_dl[k]; - break; - } - } - if (last_dl >= 10) { - LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal rx-subframe %d (tx-subframe %d) for tdd_config %d\n", - ue->Mod_id,proc->frame_tx,last_dl,subframe,frame_parms->tdd_config); - return (0); - } - - LOG_D(PHY,"SFN/SF %d/%d calculating n1_pucch0 from last_dl=%d\n", - proc->frame_tx%1024, - proc->subframe_tx, - last_dl); - - // i=0 - nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[last_dl]; - n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; - - harq_ack0 = b[0]; - - if (harq_ack0!=2) { // DTX - if (frame_parms->frame_type == FDD ) { - if (SR == 0) { // last paragraph pg 68 from 36.213 (v8.6), m=0 - b[0]=(M==2) ? 1-harq_ack0 : harq_ack0; - b[1]=harq_ack0; // in case we use pucch format 1b (subframes 2,7) - ue->pucch_sel[subframe] = 0; - return(n1_pucch0); - } else { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213) - b[0]=harq_ack0; - return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); - } + // This is the offset for a particular subframe (2,3,4) => (0,2,4) + if (subframe == 2) { // ACK subframes 5,6 + candidate_dl[0] = 6; + candidate_dl[1] = 5; + M=2; + } else if (subframe == 3) { // ACK subframe 9 + candidate_dl[0] = 9; + } else if (subframe == 7) { // ACK subframes 0,1 + candidate_dl[0] = 1; + candidate_dl[1] = 0; + M=2; + } else if (subframe == 8) { // ACK subframes 4 + candidate_dl[0] = 4; } else { - if (SR == 0) { - b[0] = harq_ack0; + LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal tx-subframe %d for tdd_config %d\n", + ue->Mod_id,proc->frame_tx,subframe,frame_parms->tdd_config); + return(0); + } + + // checking which downlink candidate is the last downlink with valid DL-DCI + int k; + + for (k=0; k0) { + last_dl = candidate_dl[k]; + break; + } + } + + if (last_dl >= 10) { + LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal rx-subframe %d (tx-subframe %d) for tdd_config %d\n", + ue->Mod_id,proc->frame_tx,last_dl,subframe,frame_parms->tdd_config); + return (0); + } + + LOG_D(PHY,"SFN/SF %d/%d calculating n1_pucch0 from last_dl=%d\n", + proc->frame_tx%1024, + proc->subframe_tx, + last_dl); + // i=0 + nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[last_dl]; + n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; + harq_ack0 = b[0]; + + if (harq_ack0!=2) { // DTX + if (frame_parms->frame_type == FDD ) { + if (SR == 0) { // last paragraph pg 68 from 36.213 (v8.6), m=0 + b[0]=(M==2) ? 1-harq_ack0 : harq_ack0; + b[1]=harq_ack0; // in case we use pucch format 1b (subframes 2,7) + ue->pucch_sel[subframe] = 0; + return(n1_pucch0); + } else { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213) + b[0]=harq_ack0; + return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); + } + } else { + if (SR == 0) { + b[0] = harq_ack0; + b[1] = harq_ack0; + ue->pucch_sel[subframe] = 0; + return(n1_pucch0); + } else { + b[0] = harq_ack0; + b[1] = harq_ack0; + return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); + } + } + } + + break; + + case 3: // DL:S:UL:UL:UL:DL:DL:DL:DL:DL + // in this configuration we have M=2 from pg 68 of 36.213 (v8.6) + // Note: this doesn't allow using subframe 1 for PDSCH transmission!!! (i.e. SF 1 cannot be acked in SF 2) + // set ACK/NAKs to DTX + harq_ack1 = 2; // DTX + harq_ack0 = 2; // DTX + // This is the offset for a particular subframe (2,3,4) => (0,2,4) + last_dl = (subframe-2)<<1; + // i=0 + nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[5+last_dl]; + n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; + // i=1 + nCCE1 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[(6+last_dl)%10]; + n1_pucch1 = get_Np(frame_parms->N_RB_DL,nCCE1,1) + nCCE1 + frame_parms->pucch_config_common.n1PUCCH_AN; + + // set ACK/NAK to values if not DTX + if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+last_dl)%10].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed + harq_ack1 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+last_dl)%10].ack; + + if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+last_dl].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed + harq_ack0 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+last_dl].ack; + + LOG_D(PHY,"SFN/SF %d/%d calculating n1_pucch cce0=%d n1_pucch0=%d cce1=%d n1_pucch1=%d\n", + proc->frame_tx%1024, + proc->subframe_tx, + nCCE0,n1_pucch0, + nCCE1,n1_pucch1); + + if (harq_ack1!=2) { // n-6 // subframe 6,8,0 and maybe 5,7,9 is to be ACK/NAKed + if ((bundling_flag==bundling)&&(SR == 0)) { // This is for bundling without SR, + // n1_pucch index takes value of smallest element in set {0,1} + // i.e. 0 if harq_ack0 is not DTX, otherwise 1 + b[0] = harq_ack1; + + if (harq_ack0!=2) + b[0]=b[0]&harq_ack0; + + ue->pucch_sel[subframe] = 1; + return(n1_pucch1); + } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 + if (harq_ack0 == 2) + harq_ack0 = 0; + b[1] = harq_ack0; + b[0] = (harq_ack0!=harq_ack1)?0:1; + + if ((harq_ack0 == 1) && (harq_ack1 == 0)) { + ue->pucch_sel[subframe] = 0; + return(n1_pucch0); + } else { + ue->pucch_sel[subframe] = 1; + return(n1_pucch1); + } + } else if (SR==1) { // SR and 0,1,or 2 ACKS, (first 3 entries in Table 7.3-1 of 36.213) + // this should be number of ACKs (including + if (harq_ack0 == 2) + harq_ack0 = 0; + + b[0]= harq_ack1 | harq_ack0; + b[1]= harq_ack1 ^ harq_ack0; + return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); + } + } else if (harq_ack0!=2) { // n-7 // subframe 5,7,9 only is to be ACK/NAKed + if ((bundling_flag==bundling)&&(SR == 0)) { // last paragraph pg 68 from 36.213 (v8.6), m=0 + b[0]=harq_ack0; ue->pucch_sel[subframe] = 0; return(n1_pucch0); - } else { + } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 with i=1 set to DTX b[0] = harq_ack0; - b[1] = harq_ack0; + b[1] = 1-b[0]; + ue->pucch_sel[subframe] = 0; + return(n1_pucch0); + } else if (SR==1) { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213) + b[0]=harq_ack0; + b[1]=b[0]; return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); } } - } + break; - break; + case 4: // DL:S:UL:UL:DL:DL:DL:DL:DL:DL + // in this configuration we have M=4 from pg 68 of 36.213 (v8.6) + // Note: this doesn't allow using subframe 1 for PDSCH transmission!!! (i.e. SF 1 cannot be acked in SF 2) + // set ACK/NAKs to DTX + harq_ack3 = 2; // DTX + harq_ack2 = 2; // DTX + harq_ack1 = 2; // DTX + harq_ack0 = 2; // DTX - case 3: // DL:S:UL:UL:UL:DL:DL:DL:DL:DL - // in this configuration we have M=2 from pg 68 of 36.213 (v8.6) - // Note: this doesn't allow using subframe 1 for PDSCH transmission!!! (i.e. SF 1 cannot be acked in SF 2) - // set ACK/NAKs to DTX - harq_ack1 = 2; // DTX - harq_ack0 = 2; // DTX - // This is the offset for a particular subframe (2,3,4) => (0,2,4) - last_dl = (subframe-2)<<1; - // i=0 - nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[5+last_dl]; - n1_pucch0 = get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; - // i=1 - nCCE1 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[(6+last_dl)%10]; - n1_pucch1 = get_Np(frame_parms->N_RB_DL,nCCE1,1) + nCCE1 + frame_parms->pucch_config_common.n1PUCCH_AN; - - // set ACK/NAK to values if not DTX - if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+last_dl)%10].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed - harq_ack1 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+last_dl)%10].ack; - - if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+last_dl].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed - harq_ack0 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+last_dl].ack; - - LOG_D(PHY,"SFN/SF %d/%d calculating n1_pucch cce0=%d n1_pucch0=%d cce1=%d n1_pucch1=%d\n", - proc->frame_tx%1024, - proc->subframe_tx, - nCCE0,n1_pucch0, - nCCE1,n1_pucch1); - - if (harq_ack1!=2) { // n-6 // subframe 6,8,0 and maybe 5,7,9 is to be ACK/NAKed - - if ((bundling_flag==bundling)&&(SR == 0)) { // This is for bundling without SR, - // n1_pucch index takes value of smallest element in set {0,1} - // i.e. 0 if harq_ack0 is not DTX, otherwise 1 - b[0] = harq_ack1; - - if (harq_ack0!=2) - b[0]=b[0]&harq_ack0; - - ue->pucch_sel[subframe] = 1; - return(n1_pucch1); - - } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 - if (harq_ack0 == 2) - harq_ack0 = 0; - - b[1] = harq_ack0; - b[0] = (harq_ack0!=harq_ack1)?0:1; - - if ((harq_ack0 == 1) && (harq_ack1 == 0)) { - ue->pucch_sel[subframe] = 0; - return(n1_pucch0); - } else { - ue->pucch_sel[subframe] = 1; - return(n1_pucch1); - } - } else if (SR==1) { // SR and 0,1,or 2 ACKS, (first 3 entries in Table 7.3-1 of 36.213) - // this should be number of ACKs (including - if (harq_ack0 == 2) - harq_ack0 = 0; - - b[0]= harq_ack1 | harq_ack0; - b[1]= harq_ack1 ^ harq_ack0; - return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); - } - } else if (harq_ack0!=2) { // n-7 // subframe 5,7,9 only is to be ACK/NAKed - if ((bundling_flag==bundling)&&(SR == 0)) { // last paragraph pg 68 from 36.213 (v8.6), m=0 - b[0]=harq_ack0; - ue->pucch_sel[subframe] = 0; - return(n1_pucch0); - } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 with i=1 set to DTX - b[0] = harq_ack0; - b[1] = 1-b[0]; - ue->pucch_sel[subframe] = 0; - return(n1_pucch0); - } else if (SR==1) { // SR and only 0 or 1 ACKs (first 2 entries in Table 7.3-1 of 36.213) - b[0]=harq_ack0; - b[1]=b[0]; - return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); - } - } - - break; - - case 4: // DL:S:UL:UL:DL:DL:DL:DL:DL:DL - // in this configuration we have M=4 from pg 68 of 36.213 (v8.6) - // Note: this doesn't allow using subframe 1 for PDSCH transmission!!! (i.e. SF 1 cannot be acked in SF 2) - // set ACK/NAKs to DTX - harq_ack3 = 2; // DTX - harq_ack2 = 2; // DTX - harq_ack1 = 2; // DTX - harq_ack0 = 2; // DTX - // This is the offset for a particular subframe (2,3,4) => (0,2,4) - //last_dl = (subframe-2)<<1; - if (subframe == 2) { + // This is the offset for a particular subframe (2,3,4) => (0,2,4) + //last_dl = (subframe-2)<<1; + if (subframe == 2) { // i=0 //nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[2+subframe]; nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[(8+subframe)%10]; @@ -933,8 +844,8 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, n1_pucch1 = get_Np(frame_parms->N_RB_DL,nCCE1,0) + get_Np(frame_parms->N_RB_DL,nCCE1,1) + nCCE1 + frame_parms->pucch_config_common.n1PUCCH_AN; // i=2 nCCE2 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[(8+subframe)%10]; - n1_pucch2 = 2*get_Np(frame_parms->N_RB_DL,nCCE2,1) + nCCE2+ frame_parms->pucch_config_common.n1PUCCH_AN; + // i=3 //nCCE3 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[(9+subframe)%10]; //n1_pucch3 = get_Np(frame_parms->N_RB_DL,nCCE3,1) + nCCE3 + frame_parms->pucch_config_common.n1PUCCH_AN; @@ -950,15 +861,14 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, harq_ack2 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[3+subframe].ack; //if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(9+subframe)%10].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed - //harq_ack3 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(9+subframe)%10].ack; + //harq_ack3 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(9+subframe)%10].ack; //LOG_I(PHY,"SFN/SF %d/%d calculating n1_pucch cce0=%d n1_pucch0=%d cce1=%d n1_pucch1=%d cce2=%d n1_pucch2=%d\n", // proc->frame_tx%1024, // proc->subframe_tx, // nCCE0,n1_pucch0, // nCCE1,n1_pucch1, nCCE2, n1_pucch2); - }else if (subframe == 3) { + } else if (subframe == 3) { // i=0 - nCCE0 = ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->nCCE[4+subframe]; n1_pucch0 = 3*get_Np(frame_parms->N_RB_DL,nCCE0,0) + nCCE0+ frame_parms->pucch_config_common.n1PUCCH_AN; // i=1 @@ -973,236 +883,238 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, // set ACK/NAK to values if not DTX if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[4+subframe].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed - harq_ack0 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[4+subframe].ack; + harq_ack0 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[4+subframe].ack; if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+subframe].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed - harq_ack1 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+subframe].ack; + harq_ack1 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[5+subframe].ack; if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+subframe)].send_harq_status>0) // n-6 // subframe 6 is to be ACK/NAKed - harq_ack2 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+subframe)].ack; + harq_ack2 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(6+subframe)].ack; if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(3+subframe)].send_harq_status>0) // n-6 // subframe 5 is to be ACK/NAKed - harq_ack3 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(3+subframe)].ack; + harq_ack3 = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack[(3+subframe)].ack; + } + + //LOG_I(PHY,"SFN/SF %d/%d calculating n1_pucch cce0=%d n1_pucch0=%d harq_ack0=%d cce1=%d n1_pucch1=%d harq_ack1=%d cce2=%d n1_pucch2=%d harq_ack2=%d cce3=%d n1_pucch3=%d harq_ack3=%d bundling_flag=%d\n", + // proc->frame_tx%1024, + // proc->subframe_tx, + // nCCE0,n1_pucch0,harq_ack0, + // nCCE1,n1_pucch1,harq_ack1, nCCE2, n1_pucch2, harq_ack2, + // nCCE3, n1_pucch3, harq_ack3, bundling_flag); + + if ((bundling_flag==bundling)&&(SR == 0)) { // This is for bundling without SR, + b[0] = 1; + ack_counter = 0; + + if ((harq_ack3!=2) ) { + b[0] = b[0]&harq_ack3; + n1_pucch_inter = n1_pucch3; + ack_counter ++; } - //LOG_I(PHY,"SFN/SF %d/%d calculating n1_pucch cce0=%d n1_pucch0=%d harq_ack0=%d cce1=%d n1_pucch1=%d harq_ack1=%d cce2=%d n1_pucch2=%d harq_ack2=%d cce3=%d n1_pucch3=%d harq_ack3=%d bundling_flag=%d\n", - // proc->frame_tx%1024, - // proc->subframe_tx, - // nCCE0,n1_pucch0,harq_ack0, - // nCCE1,n1_pucch1,harq_ack1, nCCE2, n1_pucch2, harq_ack2, - // nCCE3, n1_pucch3, harq_ack3, bundling_flag); + if ((harq_ack0!=2) ) { + b[0] = b[0]&harq_ack0; + n1_pucch_inter = n1_pucch0; + ack_counter ++; + } - if ((bundling_flag==bundling)&&(SR == 0)) { // This is for bundling without SR, - b[0] = 1; - ack_counter = 0; + if ((harq_ack1!=2) ) { + b[0] = b[0]&harq_ack1; + n1_pucch_inter = n1_pucch1; + ack_counter ++; + } - if ((harq_ack3!=2) ) { - b[0] = b[0]&harq_ack3; - n1_pucch_inter = n1_pucch3; - ack_counter ++; - } - if ((harq_ack0!=2) ) { - b[0] = b[0]&harq_ack0; - n1_pucch_inter = n1_pucch0; - ack_counter ++; - } - if ((harq_ack1!=2) ) { - b[0] = b[0]&harq_ack1; - n1_pucch_inter = n1_pucch1; - ack_counter ++; - } - if ((harq_ack2!=2) ) { - b[0] = b[0]&harq_ack2; - n1_pucch_inter = n1_pucch2; - ack_counter ++; - } + if ((harq_ack2!=2) ) { + b[0] = b[0]&harq_ack2; + n1_pucch_inter = n1_pucch2; + ack_counter ++; + } - if (ack_counter == 0) - b[0] = 0; + if (ack_counter == 0) + b[0] = 0; - /*if (subframe == 3) { - n1_pucch_inter = n1_pucch2; - } else if (subframe == 2) { - n1_pucch_inter = n1_pucch1; - }*/ + /*if (subframe == 3) { + n1_pucch_inter = n1_pucch2; + } else if (subframe == 2) { + n1_pucch_inter = n1_pucch1; + }*/ + //LOG_I(PHY,"SFN/SF %d/%d calculating n1_pucch n1_pucch_inter=%d b[0]=%d b[1]=%d \n", + // proc->frame_tx%1024, + // proc->subframe_tx,n1_pucch_inter, + // b[0],b[1]); + return(n1_pucch_inter); + } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 + if (subframe == 3) { + LOG_I(PHY, "sbuframe=%d \n",subframe); - //LOG_I(PHY,"SFN/SF %d/%d calculating n1_pucch n1_pucch_inter=%d b[0]=%d b[1]=%d \n", - // proc->frame_tx%1024, - // proc->subframe_tx,n1_pucch_inter, - // b[0],b[1]); - - return(n1_pucch_inter); - - } else if ((bundling_flag==multiplexing)&&(SR==0)) { // Table 10.1 - - if (subframe == 3) { - LOG_I(PHY, "sbuframe=%d \n",subframe); - if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1) && (harq_ack3 == 1)) { - b[0] = 1; - b[1] = 1; - return(n1_pucch1); - } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 1; - b[1] = 0; - return(n1_pucch1); - } else if (((harq_ack0 == 0) || (harq_ack0 == 2)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 0) && (harq_ack3 == 2)) { - b[0] = 1; - b[1] = 1; - return(n1_pucch2); - } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { - b[0] = 1; - b[1] = 0; - return(n1_pucch1); - } else if ((harq_ack0 == 0) && (harq_ack1 == 2) && (harq_ack2 == 2) && (harq_ack3 == 2)) { - b[0] = 1; - b[1] = 0; - return(n1_pucch0); - } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 1; - b[1] = 0; - return(n1_pucch1); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && (harq_ack3 == 1)) { - b[0] = 0; - b[1] = 1; - return(n1_pucch3); - } else if (((harq_ack0 == 0) || (harq_ack0 == 2)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 0)) { - b[0] = 1; - b[1] = 1; - return(n1_pucch3); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 0; - b[1] = 1; - return(n1_pucch2); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { - b[0] = 0; - b[1] = 1; - return(n1_pucch0); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 0; - b[1] = 1; - return(n1_pucch0); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1) && (harq_ack3 == 1)) { - b[0] = 0; - b[1] = 1; - return(n1_pucch3); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 0) && (harq_ack2 == 2) && (harq_ack3 == 2)) { - b[0] = 0; - b[1] = 0; - return(n1_pucch1); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 1; - b[1] = 0; - return(n1_pucch2); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { - b[0] = 1; - b[1] = 0; - return(n1_pucch3); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 0; - b[1] = 1; - return(n1_pucch1); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && (harq_ack3 == 1)) { - b[0] = 0; - b[1] = 1; - return(n1_pucch3); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { - b[0] = 0; - b[1] = 0; - return(n1_pucch2); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack3 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[0] = 0; - b[1] = 0; - return(n1_pucch3); - } - } else if (subframe == 2) { - if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1)) { - b[0] = 1; - b[1] = 1; - return(n1_pucch2); - } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[0] = 1; - b[1] = 1; - return(n1_pucch1); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1)) { - b[0] = 1; - b[1] = 1; - return(n1_pucch0); - } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[0] = 0; - b[1] = 1; - return(n1_pucch0); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1)) { - b[0] = 1; - b[1] = 0; - return(n1_pucch2); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[1] = 0; - b[0] = 0; - return(n1_pucch1); - } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1)) { - b[0] = 0; - b[1] = 0; - return(n1_pucch2); - } else if ((harq_ack0 == 2) && (harq_ack1 == 2) && (harq_ack2 == 0)) { - b[0] = 0; - b[1] = 1; - return(n1_pucch2); - } else if ((harq_ack0 == 2) && (harq_ack1 == 0) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[0] = 1; - b[1] = 0; - return(n1_pucch1); - } else if ((harq_ack0 == 0) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { - b[0] = 1; - b[1] = 0; - return(n1_pucch0); - } - - } - } else if (SR==1) { // SR and 0,1,or 2 ACKS, (first 3 entries in Table 7.3-1 of 36.213) - // this should be number of ACKs (including - ack_counter = 0; - if (harq_ack0==1) - ack_counter ++; - if (harq_ack1==1) - ack_counter ++; - if (harq_ack2==1) - ack_counter ++; - if (harq_ack3==1) - ack_counter ++; - - switch (ack_counter) { - case 0: - b[0] = 0; - b[1] = 0; - break; - - case 1: - b[0] = 1; - b[1] = 1; - break; - - case 2: - b[0] = 1; - b[1] = 0; - break; - - case 3: - b[0] = 0; - b[1] = 1; - break; - - case 4: - b[0] = 1; - b[1] = 1; - break; + if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1) && (harq_ack3 == 1)) { + b[0] = 1; + b[1] = 1; + return(n1_pucch1); + } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 1; + b[1] = 0; + return(n1_pucch1); + } else if (((harq_ack0 == 0) || (harq_ack0 == 2)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 0) && (harq_ack3 == 2)) { + b[0] = 1; + b[1] = 1; + return(n1_pucch2); + } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { + b[0] = 1; + b[1] = 0; + return(n1_pucch1); + } else if ((harq_ack0 == 0) && (harq_ack1 == 2) && (harq_ack2 == 2) && (harq_ack3 == 2)) { + b[0] = 1; + b[1] = 0; + return(n1_pucch0); + } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 1; + b[1] = 0; + return(n1_pucch1); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && (harq_ack3 == 1)) { + b[0] = 0; + b[1] = 1; + return(n1_pucch3); + } else if (((harq_ack0 == 0) || (harq_ack0 == 2)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 0)) { + b[0] = 1; + b[1] = 1; + return(n1_pucch3); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 0; + b[1] = 1; + return(n1_pucch2); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { + b[0] = 0; + b[1] = 1; + return(n1_pucch0); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 0; + b[1] = 1; + return(n1_pucch0); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1) && (harq_ack3 == 1)) { + b[0] = 0; + b[1] = 1; + return(n1_pucch3); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 0) && (harq_ack2 == 2) && (harq_ack3 == 2)) { + b[0] = 0; + b[1] = 0; + return(n1_pucch1); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 1; + b[1] = 0; + return(n1_pucch2); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && (harq_ack3 == 1)) { + b[0] = 1; + b[1] = 0; + return(n1_pucch3); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0)) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 0; + b[1] = 1; + return(n1_pucch1); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && (harq_ack3 == 1)) { + b[0] = 0; + b[1] = 1; + return(n1_pucch3); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1) && ((harq_ack3 == 2) || (harq_ack3 == 0))) { + b[0] = 0; + b[1] = 0; + return(n1_pucch2); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack3 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[0] = 0; + b[1] = 0; + return(n1_pucch3); } + } else if (subframe == 2) { + if ((harq_ack0 == 1) && (harq_ack1 == 1) && (harq_ack2 == 1)) { + b[0] = 1; + b[1] = 1; + return(n1_pucch2); + } else if ((harq_ack0 == 1) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[0] = 1; + b[1] = 1; + return(n1_pucch1); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1)) { + b[0] = 1; + b[1] = 1; + return(n1_pucch0); + } else if ((harq_ack0 == 1) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[0] = 0; + b[1] = 1; + return(n1_pucch0); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && (harq_ack2 == 1)) { + b[0] = 1; + b[1] = 0; + return(n1_pucch2); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && (harq_ack1 == 1) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[1] = 0; + b[0] = 0; + return(n1_pucch1); + } else if (((harq_ack0 == 2) || (harq_ack0 == 0)) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && (harq_ack2 == 1)) { + b[0] = 0; + b[1] = 0; + return(n1_pucch2); + } else if ((harq_ack0 == 2) && (harq_ack1 == 2) && (harq_ack2 == 0)) { + b[0] = 0; + b[1] = 1; + return(n1_pucch2); + } else if ((harq_ack0 == 2) && (harq_ack1 == 0) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[0] = 1; + b[1] = 0; + return(n1_pucch1); + } else if ((harq_ack0 == 0) && ((harq_ack1 == 2) || (harq_ack1 == 0)) && ((harq_ack2 == 2) || (harq_ack2 == 0))) { + b[0] = 1; + b[1] = 0; + return(n1_pucch0); + } + } + } else if (SR==1) { // SR and 0,1,or 2 ACKS, (first 3 entries in Table 7.3-1 of 36.213) + // this should be number of ACKs (including + ack_counter = 0; - ack_counter = 0; - return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); + if (harq_ack0==1) + ack_counter ++; + + if (harq_ack1==1) + ack_counter ++; + + if (harq_ack2==1) + ack_counter ++; + + if (harq_ack3==1) + ack_counter ++; + + switch (ack_counter) { + case 0: + b[0] = 0; + b[1] = 0; + break; + + case 1: + b[0] = 1; + b[1] = 1; + break; + + case 2: + b[0] = 1; + b[1] = 0; + break; + + case 3: + b[0] = 0; + b[1] = 1; + break; + + case 4: + b[0] = 1; + b[1] = 1; + break; } - break; + ack_counter = 0; + return(ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); + } + break; } // switch tdd_config } @@ -1212,10 +1124,8 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue, void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empty_subframe) { - int aa; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - int nsymb; int subframe_tx = proc->subframe_tx; int ulsch_start; @@ -1224,46 +1134,43 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt int k,l; int dummy_tx_buffer[frame_parms->samples_per_tti] __attribute__((aligned(16))); #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_IN); + if ( LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->ofdm_mod_stats); } - nsymb = (frame_parms->Ncp == 0) ? 14 : 12; + nsymb = (frame_parms->Ncp == 0) ? 14 : 12; #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- - ue->hw_timing_advance- - ue->timing_advance- - ue->N_TA_offset+5); + ue->hw_timing_advance- + ue->timing_advance- + ue->N_TA_offset+5); //LOG_E(PHY,"ul-signal [subframe: %d, ulsch_start %d]\n",subframe_tx, ulsch_start); if(ulsch_start < 0) - ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); + ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); if (ulsch_start > (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)) - ulsch_start = ulsch_start % (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); + ulsch_start = ulsch_start % (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); //LOG_E(PHY,"ul-signal [subframe: %d, ulsch_start %d]\n",subframe_tx, ulsch_start); #else //this is the normal case ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance; #endif //else EXMIMO - if (empty_subframe) - { + if (empty_subframe) { overflow = ulsch_start - 9*frame_parms->samples_per_tti; + for (aa=0; aanb_antennas_tx; aa++) { - - if (overflow > 0) - { - memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*(frame_parms->samples_per_tti-overflow)); - memset(&ue->common_vars.txdata[aa][0],0,4*overflow); - } - else - { - memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*frame_parms->samples_per_tti); - } + if (overflow > 0) { + memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*(frame_parms->samples_per_tti-overflow)); + memset(&ue->common_vars.txdata[aa][0],0,4*overflow); + } else { + memset(&ue->common_vars.txdata[aa][ulsch_start],0,4*frame_parms->samples_per_tti); + } } + return; } @@ -1271,32 +1178,31 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt if (frame_parms->Ncp == 1) PHY_ofdm_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - dummy_tx_buffer, + dummy_tx_buffer, #else - &ue->common_vars.txdata[aa][ulsch_start], + &ue->common_vars.txdata[aa][ulsch_start], #endif - frame_parms->ofdm_symbol_size, - nsymb, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + frame_parms->ofdm_symbol_size, + nsymb, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); else { normal_prefix_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - dummy_tx_buffer, + dummy_tx_buffer, #else - &ue->common_vars.txdata[aa][ulsch_start], + &ue->common_vars.txdata[aa][ulsch_start], #endif - nsymb>>1, - &ue->frame_parms); - + nsymb>>1, + &ue->frame_parms); normal_prefix_mod(&ue->common_vars.txdataF[aa][((subframe_tx*nsymb)+(nsymb>>1))*frame_parms->ofdm_symbol_size], #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - dummy_tx_buffer+(frame_parms->samples_per_tti>>1), + dummy_tx_buffer+(frame_parms->samples_per_tti>>1), #else - &ue->common_vars.txdata[aa][ulsch_start+(frame_parms->samples_per_tti>>1)], + &ue->common_vars.txdata[aa][ulsch_start+(frame_parms->samples_per_tti>>1)], #endif - nsymb>>1, - &ue->frame_parms); + nsymb>>1, + &ue->frame_parms); } #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) @@ -1306,31 +1212,31 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt 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); #endif - - #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) 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++) { - ((short*)ue->common_vars.txdata[aa])[2*k] = ((short*)dummy_tx_buffer)[2*l]; - ((short*)ue->common_vars.txdata[aa])[2*k+1] = ((short*)dummy_tx_buffer)[2*l+1]; + ((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; + ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; } for (k=0; kcommon_vars.txdata[aa])[2*k] = ((short*)dummy_tx_buffer)[2*l]; - ((short*)ue->common_vars.txdata[aa])[2*k+1] = ((short*)dummy_tx_buffer)[2*l+1]; + ((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; + ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; } + #if defined(EXMIMO) + // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on for (k=ulsch_start - (frame_parms->samples_per_tti>>1) ; kcommon_vars.txdata[aa][k+frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + ue->common_vars.txdata[aa][k+frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; else if (k>(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - ue->common_vars.txdata[aa][k-frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + ue->common_vars.txdata[aa][k-frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; else - ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; + ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; } + #endif #endif /* @@ -1342,7 +1248,6 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt LOG_M("txBuff.m","txSignal",&ue->common_vars.txdata[aa][ulsch_start],frame_parms->samples_per_tti,1,1); } */ - } //nb_antennas_tx if ( LOG_DEBUGFLAG(UE_TIMING)) { @@ -1350,133 +1255,120 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_OUT); - } void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) { - int frame_tx = proc->frame_tx; int subframe_tx = proc->subframe_tx; LOG_USEDINLOG_VAR(int, prach_power); PRACH_RESOURCES_t prach_resources_local; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN); - ue->generate_prach=0; - if (ue->mac_enabled==0){ + if (ue->mac_enabled==0) { ue->prach_resources[eNB_id] = &prach_resources_local; prach_resources_local.ra_RNTI = 0xbeef; prach_resources_local.ra_PreambleIndex = 0; } - if (ue->mac_enabled==1){ + if (ue->mac_enabled==1) { // ask L2 for RACH transport if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) { //LOG_D(PHY,"Getting PRACH resources\n"); - ue->prach_resources[eNB_id] = ue_get_rach(ue->Mod_id, - ue->CC_id, - frame_tx, - eNB_id, - subframe_tx); + ue->CC_id, + frame_tx, + eNB_id, + subframe_tx); LOG_D(PHY,"Prach resources %p\n",ue->prach_resources[eNB_id]); } } if (ue->prach_resources[eNB_id]!=NULL) { - ue->generate_prach=1; ue->prach_cnt=0; #ifdef SMBV ue->prach_resources[eNB_id]->ra_PreambleIndex = 19; #endif LOG_I(PHY,"mode %d\n",mode); - + if ((ue->mac_enabled==1) && (mode != calib_prach_tx)) { ue->tx_power_dBm[subframe_tx] = ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id); - } - else { + } else { ue->tx_power_dBm[subframe_tx] = ue->tx_power_max_dBm; ue->prach_resources[eNB_id]->ra_PreambleIndex = 19; } - + LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d,PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n", - ue->Mod_id, - frame_tx, - subframe_tx, - ue->prach_resources[eNB_id]->ra_PreambleIndex, - get_PL(ue->Mod_id,ue->CC_id,eNB_id), - ue->tx_power_dBm[subframe_tx], - ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER, - ue->prach_resources[eNB_id]->ra_TDD_map_index, - ue->prach_resources[eNB_id]->ra_RNTI); - + ue->Mod_id, + frame_tx, + subframe_tx, + ue->prach_resources[eNB_id]->ra_PreambleIndex, + get_PL(ue->Mod_id,ue->CC_id,eNB_id), + ue->tx_power_dBm[subframe_tx], + ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER, + ue->prach_resources[eNB_id]->ra_TDD_map_index, + ue->prach_resources[eNB_id]->ra_RNTI); ue->tx_total_RE[subframe_tx] = 96; - #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) 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, - 6); - + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 6); #else ue->prach_vars[eNB_id]->amp = AMP; #endif if ((mode == calib_prach_tx) && (((proc->frame_tx&0xfffe)%100)==0)) LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : PRACH TX power %d dBm, amp %d\n", - ue->Mod_id, - proc->frame_rx, - proc->subframe_tx, - ue->tx_power_dBm[subframe_tx], - ue->prach_vars[eNB_id]->amp); - - + ue->Mod_id, + proc->frame_rx, + proc->subframe_tx, + ue->tx_power_dBm[subframe_tx], + ue->prach_vars[eNB_id]->amp); + // start_meas(&ue->tx_prach); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN); prach_power = generate_prach(ue,eNB_id,subframe_tx,frame_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT); // stop_meas(&ue->tx_prach); - LOG_D(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n", + LOG_I(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm (max %d dBm), digital power %d dB (amp %d)\n", ue->Mod_id, get_PL(ue->Mod_id,ue->CC_id,eNB_id), ue->tx_power_dBm[subframe_tx], + ue->tx_power_max_dBm, dB_fixed(prach_power), ue->prach_vars[eNB_id]->amp); - if (ue->mac_enabled==1){ + if (ue->mac_enabled==1) { Msg1_transmitted(ue->Mod_id, - ue->CC_id, - frame_tx, - eNB_id); + ue->CC_id, + frame_tx, + eNB_id); } - + LOG_I(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n", - ue->Mod_id,frame_tx,subframe_tx,eNB_id, - ue->prach_resources[eNB_id]->ra_PreambleIndex, - ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id), - get_PL(ue->Mod_id,ue->CC_id,eNB_id)); - - - + ue->Mod_id,frame_tx,subframe_tx,eNB_id, + ue->prach_resources[eNB_id]->ra_PreambleIndex, + ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id), + get_PL(ue->Mod_id,ue->CC_id,eNB_id)); + // if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue if (mode == calib_prach_tx) ue->prach_resources[eNB_id]=NULL; LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n", - ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt); - + ue->Mod_id,frame_tx,subframe_tx,ue->generate_prach,ue->prach_cnt); ue->prach_cnt++; if (ue->prach_cnt==3) ue->generate_prach=0; } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); } void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { - int harq_pid; int frame_tx=proc->frame_tx; int subframe_tx=proc->subframe_tx; @@ -1497,76 +1389,76 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB uint8_t cqi_status = 0; uint8_t ri_status = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); - // get harq_pid from subframe relationship harq_pid = subframe2harq_pid(&ue->frame_parms, - frame_tx, - subframe_tx); - + frame_tx, + subframe_tx); LOG_D(PHY,"Frame %d, Subframe %d : ue_uespec_procedures, harq_pid %d => subframe_scheduling %d\n", - frame_tx,subframe_tx,harq_pid, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag); + frame_tx,subframe_tx,harq_pid, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag); if (ue->mac_enabled == 1) { if ((ue->ulsch_Msg3_active[eNB_id] == 1) && - (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && - (ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3 - + (ue->ulsch_Msg3_frame[eNB_id] == frame_tx) && + (ue->ulsch_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3 ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1; if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0) - generate_ue_ulsch_params_from_rar(ue, - proc, - eNB_id); + generate_ue_ulsch_params_from_rar(ue, + proc, + eNB_id); ue->ulsch[eNB_id]->power_offset = 14; LOG_D(PHY,"[UE %d][RAPROC] Frame %d: Setting Msg3_flag in subframe %d, for harq_pid %d\n", - Mod_id, - frame_tx, - subframe_tx, - harq_pid); + Mod_id, + frame_tx, + subframe_tx, + harq_pid); Msg3_flag = 1; } else { - - AssertFatal(harq_pid!=255,"[UE%d] Frame %d subframe %d ulsch_decoding.c: FATAL ERROR: illegal harq_pid, exiting\n", - Mod_id,frame_tx, subframe_tx); + Mod_id,frame_tx, subframe_tx); Msg3_flag=0; } } if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) { - uint8_t isBad = 0; + if (ue->frame_parms.N_RB_UL <= ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb) { LOG_D(PHY,"Invalid PUSCH first_RB=%d for N_RB_UL=%d\n", - ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, - ue->frame_parms.N_RB_UL); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, + ue->frame_parms.N_RB_UL); isBad = 1; } + if (ue->frame_parms.N_RB_UL < ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb) { LOG_D(PHY,"Invalid PUSCH num_RB=%d for N_RB_UL=%d\n", - ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, - ue->frame_parms.N_RB_UL); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, + ue->frame_parms.N_RB_UL); isBad = 1; } + if (0 > ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb) { LOG_D(PHY,"Invalid PUSCH first_RB=%d\n", - ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb); isBad = 1; } + if (0 >= ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb) { LOG_D(PHY,"Invalid PUSCH num_RB=%d\n", - ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb); isBad = 1; } + if (ue->frame_parms.N_RB_UL < (ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb)) { LOG_D(PHY,"Invalid PUSCH num_RB=%d + first_RB=%d for N_RB_UL=%d\n", - ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, - ue->frame_parms.N_RB_UL); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, + ue->frame_parms.N_RB_UL); isBad = 1; } + if ((0 > ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx) || (3 < ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx)) { LOG_D(PHY,"Invalid PUSCH RV index=%d\n", ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx); @@ -1578,275 +1470,256 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; } } + if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) { - ue->generate_ul_signal[eNB_id] = 1; - // deactivate service request // ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit); - if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1)) - { + LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, + ue->ulsch[eNB_id]->Mlimit); + + if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1)) { // LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n"); - ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; + ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; } ack_status_cw0 = reset_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &Nbundled, - 0); + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &Nbundled, + 0); ack_status_cw1 = reset_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][1]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &NbundledCw1, - 1); - + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][1]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &NbundledCw1, + 1); //Nbundled = ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack; //ue->ulsch[eNB_id]->bundling = Nbundled; - first_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb; nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; - - // check Periodic CQI/RI reporting cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& - (is_cqi_TXOp(ue,proc,eNB_id)==1)); - + (is_cqi_TXOp(ue,proc,eNB_id)==1)); ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && - (is_ri_TXOp(ue,proc,eNB_id)==1)); - + (is_ri_TXOp(ue,proc,eNB_id)==1)); // compute CQI/RI resources compute_cqi_ri_resources(ue, ue->ulsch[eNB_id], eNB_id, ue->ulsch[eNB_id]->rnti, P_RNTI, CBA_RNTI, cqi_status, ri_status); if (ack_status_cw0 > 0) { - // check if we received a PDSCH at subframe_tx - 4 // ==> send ACK/NACK on PUSCH - if (ue->frame_parms.frame_type == FDD) - { + if (ue->frame_parms.frame_type == FDD) { ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = ack_status_cw0 + ack_status_cw1; } + if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + if(ue->ulsch[eNB_id]->o_ACK[0]) { + LOG_I(PHY,"PUSCH ACK\n"); + T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), + T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); + } else { + LOG_I(PHY,"PUSCH NACK\n"); + T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), + T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); + } + + LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d Generating ACK (%d,%d) for %d bits on PUSCH\n", + Mod_id, + ue->ulsch[eNB_id]->rnti, + frame_tx%1024,subframe_tx, + ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); + } + } if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - if(ue->ulsch[eNB_id]->o_ACK[0]) - { - LOG_I(PHY,"PUSCH ACK\n"); - T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), - T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); - } - else - { - LOG_I(PHY,"PUSCH NACK\n"); - T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), - T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); - } - LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d Generating ACK (%d,%d) for %d bits on PUSCH\n", - Mod_id, - ue->ulsch[eNB_id]->rnti, - frame_tx%1024,subframe_tx, - ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], - ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); + LOG_D(PHY, + "[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, " + "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n", + Mod_id,harq_pid,frame_tx%1024,subframe_tx, + first_rb,nb_rb, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx, + (ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift+ + ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2+ + ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1])%12, + ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2, + ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1], + ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK, + ack_status_cw0, + ack_status_cw1, + ue->ulsch[eNB_id]->bundling, Nbundled, + cqi_status, + ri_status); } - } - - - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ - LOG_D(PHY, - "[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, " - "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n", - Mod_id,harq_pid,frame_tx%1024,subframe_tx, - first_rb,nb_rb, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx, - (ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift+ - ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2+ - ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1])%12, - ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2, - ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1], - ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], - ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK, - ack_status_cw0, - ack_status_cw1, - ue->ulsch[eNB_id]->bundling, Nbundled, - cqi_status, - ri_status); - } - - - - if (Msg3_flag == 1) { LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d Generating (RRCConnectionRequest) Msg3 (nb_rb %d, first_rb %d, round %d, rvidx %d) Msg3: %x.%x.%x|%x.%x.%x.%x.%x.%x\n",Mod_id,frame_tx, - subframe_tx, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, - ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx, - ue->prach_resources[eNB_id]->Msg3[0], - ue->prach_resources[eNB_id]->Msg3[1], - ue->prach_resources[eNB_id]->Msg3[2], - ue->prach_resources[eNB_id]->Msg3[3], - ue->prach_resources[eNB_id]->Msg3[4], - ue->prach_resources[eNB_id]->Msg3[5], - ue->prach_resources[eNB_id]->Msg3[6], - ue->prach_resources[eNB_id]->Msg3[7], - ue->prach_resources[eNB_id]->Msg3[8]); - if ( LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ulsch_encoding_stats); - } - + subframe_tx, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, + ue->ulsch[eNB_id]->harq_processes[harq_pid]->rvidx, + ue->prach_resources[eNB_id]->Msg3[0], + ue->prach_resources[eNB_id]->Msg3[1], + ue->prach_resources[eNB_id]->Msg3[2], + ue->prach_resources[eNB_id]->Msg3[3], + ue->prach_resources[eNB_id]->Msg3[4], + ue->prach_resources[eNB_id]->Msg3[5], + ue->prach_resources[eNB_id]->Msg3[6], + ue->prach_resources[eNB_id]->Msg3[7], + ue->prach_resources[eNB_id]->Msg3[8]); + + if ( LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ulsch_encoding_stats); + } + AssertFatal(ulsch_encoding(ue->prach_resources[eNB_id]->Msg3, - ue, - harq_pid, - eNB_id, - proc->subframe_rx, - ue->transmission_mode[eNB_id],0,0)==0, - "ulsch_coding.c: FATAL ERROR: returning\n"); - - if ( LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->phy_proc_tx); - LOG_UI(PHY,"------FULL TX PROC : %5.2f ------\n",ue->phy_proc_tx.p_time/(cpuf*1000.0)); - stop_meas(&ue->ulsch_encoding_stats); - } + ue, + harq_pid, + eNB_id, + proc->subframe_rx, + ue->transmission_mode[eNB_id],0,0)==0, + "ulsch_coding.c: FATAL ERROR: returning\n"); + + if ( LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->phy_proc_tx); + LOG_I(PHY,"------FULL TX PROC : %5.2f ------\n",ue->phy_proc_tx.p_time/(cpuf*1000.0)); + stop_meas(&ue->ulsch_encoding_stats); + } if (ue->mac_enabled == 1) { - - // signal MAC that Msg3 was sent - Msg3_transmitted(Mod_id, - CC_id, - frame_tx, - eNB_id); + // signal MAC that Msg3 was sent + Msg3_transmitted(Mod_id, + CC_id, + frame_tx, + eNB_id); } + LOG_I(PHY,"Done Msg3 encoding\n"); } // Msg3_flag==1 else {// Msg3_flag==0 input_buffer_length = ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/8; if (ue->mac_enabled==1) { + // LOG_D(PHY,"[UE %d] ULSCH : Searching for MAC SDUs\n",Mod_id); + if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0) { + //if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) { + access_mode=SCHEDULED_ACCESS; + ue_get_sdu(Mod_id, + CC_id, + frame_tx, + subframe_tx, + eNB_id, + ulsch_input_buffer, + input_buffer_length, + &access_mode); + } - // LOG_D(PHY,"[UE %d] ULSCH : Searching for MAC SDUs\n",Mod_id); - if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0) { - //if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) { - access_mode=SCHEDULED_ACCESS; + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE] Frame %d, subframe %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,subframe_tx,harq_pid, ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3); - ue_get_sdu(Mod_id, - CC_id, - frame_tx, - subframe_tx, - eNB_id, - ulsch_input_buffer, - input_buffer_length, - &access_mode); - } - - + for (i=0; iulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3; i++) + LOG_T(PHY,"%x.",ulsch_input_buffer[i]); - - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE] Frame %d, subframe %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,subframe_tx,harq_pid, ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3); - - for (i=0; iulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3; i++) - LOG_T(PHY,"%x.",ulsch_input_buffer[i]); - - LOG_T(PHY,"\n"); + LOG_T(PHY,"\n"); + } + } else { + unsigned int taus(void); + + for (i=0; iulsch_encoding_stats); - } + + if ( LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ulsch_encoding_stats); + } + if (abstraction_flag==0) { - - if (ulsch_encoding(ulsch_input_buffer, - ue, - harq_pid, - eNB_id, - proc->subframe_rx, - ue->transmission_mode[eNB_id],0, - Nbundled)!=0) { - LOG_E(PHY,"ulsch_coding.c: FATAL ERROR: returning\n"); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); + if (ulsch_encoding(ulsch_input_buffer, + ue, + harq_pid, + eNB_id, + proc->subframe_rx, + ue->transmission_mode[eNB_id],0, + Nbundled)!=0) { + LOG_E(PHY,"ulsch_coding.c: FATAL ERROR: returning\n"); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); + if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->phy_proc_tx); + stop_meas(&ue->phy_proc_tx); } - return; - } + + return; + } } - + if(LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->ulsch_encoding_stats); } } - + if (abstraction_flag == 0) { if (ue->mac_enabled==1) { - pusch_power_cntl(ue,proc,eNB_id,1, abstraction_flag); - ue->tx_power_dBm[subframe_tx] = ue->ulsch[eNB_id]->Po_PUSCH; - } - else { - ue->tx_power_dBm[subframe_tx] = ue->tx_power_max_dBm; + pusch_power_cntl(ue,proc,eNB_id,1, abstraction_flag); + ue->tx_power_dBm[subframe_tx] = ue->ulsch[eNB_id]->Po_PUSCH; + } else { + ue->tx_power_dBm[subframe_tx] = ue->tx_power_max_dBm; } + ue->tx_total_RE[subframe_tx] = nb_rb*12; - #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - nb_rb); + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + nb_rb); #else - tx_amp = AMP; + tx_amp = AMP; #endif + T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), + T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb)); - T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), - T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb)); + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n", + Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp); + } - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n", - Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp); - } - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ulsch_modulation_stats); - } - ulsch_modulation(ue->common_vars.txdataF, - tx_amp, - frame_tx, - subframe_tx, - &ue->frame_parms, - ue->ulsch[eNB_id]); - for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) - generate_drs_pusch(ue, - proc, - (LTE_DL_FRAME_PARMS *)NULL, - (int32_t**)NULL, - eNB_id, - tx_amp, - subframe_tx, - first_rb, - nb_rb, - aa); + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ulsch_modulation_stats); + } - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ulsch_modulation_stats); + ulsch_modulation(ue->common_vars.txdataF, + tx_amp, + frame_tx, + subframe_tx, + &ue->frame_parms, + ue->ulsch[eNB_id]); + + for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) + generate_drs_pusch(ue, + proc, + (LTE_DL_FRAME_PARMS *)NULL, + (int32_t**)NULL, + eNB_id, + tx_amp, + subframe_tx, + first_rb, + nb_rb, + aa); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ulsch_modulation_stats); + } } - } - if (abstraction_flag==1) { // clear SR ue->sr[subframe_tx]=0; @@ -1854,84 +1727,72 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB } // subframe_scheduling_flag==1 VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_OUT); - } -void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) -{ - +void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { //LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; //int8_t frame_tx = proc->frame_tx; int8_t subframe_tx = proc->subframe_tx; int16_t tx_amp; int16_t Po_SRS; uint8_t nb_rb_srs; - SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; uint8_t isSrsTxOccasion = pSoundingrs_ul_config_dedicated->srsUeSubframe; - if(isSrsTxOccasion) - { + if(isSrsTxOccasion) { ue->generate_ul_signal[eNB_id] = 1; - if (ue->mac_enabled==1) - { - srs_power_cntl(ue,proc,eNB_id, (uint8_t*)(&nb_rb_srs), abstraction_flag); + + if (ue->mac_enabled==1) { + srs_power_cntl(ue,proc,eNB_id, (uint8_t *)(&nb_rb_srs), abstraction_flag); Po_SRS = ue->ulsch[eNB_id]->Po_SRS; - } - else - { + } else { Po_SRS = ue->tx_power_max_dBm; } #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - if (ue->mac_enabled==1) - { - tx_amp = get_tx_amp(Po_SRS, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - nb_rb_srs); - } - else - { - tx_amp = AMP; - } -#else + + if (ue->mac_enabled==1) { + tx_amp = get_tx_amp(Po_SRS, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + nb_rb_srs); + } else { tx_amp = AMP; + } + +#else + tx_amp = AMP; #endif LOG_D(PHY,"SRS PROC; TX_MAX_POWER %d, Po_SRS %d, NB_RB_UL %d, NB_RB_SRS %d TX_AMPL %d\n",ue->tx_power_max_dBm, - Po_SRS, - ue->frame_parms.N_RB_UL, - nb_rb_srs, - tx_amp); - + Po_SRS, + ue->frame_parms.N_RB_UL, + nb_rb_srs, + tx_amp); uint16_t nsymb = (ue->frame_parms.Ncp==0) ? 14:12; uint16_t symbol_offset = (int)ue->frame_parms.ofdm_symbol_size*((subframe_tx*nsymb)+(nsymb-1)); generate_srs(&ue->frame_parms, - &ue->soundingrs_ul_config_dedicated[eNB_id], - &ue->common_vars.txdataF[eNB_id][symbol_offset], - tx_amp, - subframe_tx); + &ue->soundingrs_ul_config_dedicated[eNB_id], + &ue->common_vars.txdataF[eNB_id][symbol_offset], + tx_amp, + subframe_tx); } } int16_t get_pucch2_cqi(PHY_VARS_UE *ue,int eNB_id,int *len) { - if ((ue->transmission_mode[eNB_id]<4)|| (ue->transmission_mode[eNB_id]==7)) { // Mode 1-0 feedback // 4-bit CQI message - /*LOG_I(PHY,"compute CQI value, TM %d, length 4, Cqi Avg %d, value %d \n", ue->transmission_mode[eNB_id], - ue->measurements.wideband_cqi_avg[eNB_id], - sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], - ue->transmission_mode[eNB_id]));*/ + /*LOG_I(PHY,"compute CQI value, TM %d, length 4, Cqi Avg %d, value %d \n", ue->transmission_mode[eNB_id], + ue->measurements.wideband_cqi_avg[eNB_id], + sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], + ue->transmission_mode[eNB_id]));*/ *len=4; return(sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], - ue->transmission_mode[eNB_id])); - } - else { // Mode 1-1 feedback, later - //LOG_I(PHY,"compute CQI value, TM %d, length 0, Cqi Avg 0 \n", ue->transmission_mode[eNB_id]); + ue->transmission_mode[eNB_id])); + } else { // Mode 1-1 feedback, later + //LOG_I(PHY,"compute CQI value, TM %d, length 0, Cqi Avg 0 \n", ue->transmission_mode[eNB_id]); *len=0; // 2-antenna ports RI=1, 6 bits (2 PMI, 4 CQI) - // 2-antenna ports RI=2, 8 bits (1 PMI, 7 CQI/DIFF CQI) return(0); } @@ -1939,7 +1800,6 @@ int16_t get_pucch2_cqi(PHY_VARS_UE *ue,int eNB_id,int *len) { int16_t get_pucch2_ri(PHY_VARS_UE *ue,int eNB_id) { - return(1); } @@ -1953,15 +1813,12 @@ void get_pucch_param(PHY_VARS_UE *ue, uint8_t cqi_report, uint16_t *pucch_resource, uint8_t *pucch_payload, - uint16_t *plength) -{ - - switch (format) { - case pucch_format1: - { - pucch_resource[0] = ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex; - pucch_payload[0] = 0; // payload is ignored in case of format1 - pucch_payload[1] = 0; // payload is ignored in case of format1 + uint16_t *plength) { + switch (format) { + case pucch_format1: { + pucch_resource[0] = ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex; + pucch_payload[0] = 0; // payload is ignored in case of format1 + pucch_payload[1] = 0; // payload is ignored in case of format1 } break; @@ -1969,58 +1826,50 @@ void get_pucch_param(PHY_VARS_UE *ue, case pucch_format1b: case pucch_format1b_csA2: case pucch_format1b_csA3: - case pucch_format1b_csA4: - { - pucch_resource[0] = get_n1_pucch(ue, - proc, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, - eNB_id, - ack_payload, - SR); - pucch_payload[0] = ack_payload[0]; - pucch_payload[1] = ack_payload[1]; - //pucch_payload[1] = 1; + case pucch_format1b_csA4: { + pucch_resource[0] = get_n1_pucch(ue, + proc, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, + eNB_id, + ack_payload, + SR); + pucch_payload[0] = ack_payload[0]; + pucch_payload[1] = ack_payload[1]; + //pucch_payload[1] = 1; } break; - case pucch_format2: - { - pucch_resource[0] = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex; - if(cqi_report) - { - pucch_payload[0] = get_pucch2_cqi(ue,eNB_id,(int*)plength); - } - else - { - *plength = 1; - pucch_payload[0] = get_pucch2_ri(ue,eNB_id); - } + case pucch_format2: { + pucch_resource[0] = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex; + + if(cqi_report) { + pucch_payload[0] = get_pucch2_cqi(ue,eNB_id,(int *)plength); + } else { + *plength = 1; + pucch_payload[0] = get_pucch2_ri(ue,eNB_id); + } } break; case pucch_format2a: case pucch_format2b: - LOG_E(PHY,"NO Resource available for PUCCH 2a/2b \n"); - break; + LOG_E(PHY,"NO Resource available for PUCCH 2a/2b \n"); + break; case pucch_format3: fprintf(stderr, "PUCCH format 3 not handled\n"); abort(); - } + } } void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { - - uint8_t pucch_ack_payload[2]; uint16_t pucch_resource; ANFBmode_t bundling_flag; PUCCH_FMT_t format; - uint8_t SR_payload; uint8_t pucch_payload[2]; uint16_t len; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int frame_tx=proc->frame_tx; int subframe_tx=proc->subframe_tx; @@ -2033,30 +1882,24 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin uint8_t nb_cw=0; uint8_t cqi_status=0; uint8_t ri_status=0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_IN); - SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - // 36.213 8.2 /*if ackNackSRS_SimultaneousTransmission == TRUE and in the cell specific SRS subframes UE shall transmit ACK/NACK and SR using the shortened PUCCH format. This shortened PUCCH format shall be used in a cell specific SRS subframe even if the UE does not transmit SRS in that subframe */ - int harq_pid = subframe2harq_pid(&ue->frame_parms, frame_tx, subframe_tx); - if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag) - { - LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT); - return; + if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag) { + LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT); + return; } uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); - bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; if ((frame_parms->frame_type==FDD) || @@ -2075,52 +1918,45 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin // - ACK/NACK // - CQI // - RI - SR_payload = 0; - if (is_SR_TXOp(ue,proc,eNB_id)==1) - { - if (ue->mac_enabled==1) { - SR_payload = ue_get_SR(Mod_id, - CC_id, - frame_tx, - eNB_id, - ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti, - subframe_tx); // subframe used for meas gap - } - else { - SR_payload = 1; - } + + if (is_SR_TXOp(ue,proc,eNB_id)==1) { + if (ue->mac_enabled==1) { + SR_payload = ue_get_SR(Mod_id, + CC_id, + frame_tx, + eNB_id, + ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti, + subframe_tx); // subframe used for meas gap + } else { + SR_payload = 1; + } } ack_status_cw0 = get_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, - subframe_tx, - proc->subframe_rx, - pucch_ack_payload, - 0); - + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + pucch_ack_payload, + 0); ack_status_cw1 = get_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][1]->harq_ack, - subframe_tx, - proc->subframe_rx, - pucch_ack_payload, - 1); - + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][1]->harq_ack, + subframe_tx, + proc->subframe_rx, + pucch_ack_payload, + 1); nb_cw = ( (ack_status_cw0 != 0) ? 1:0) + ( (ack_status_cw1 != 0) ? 1:0); - cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& - (is_cqi_TXOp(ue,proc,eNB_id)==1)); - + (is_cqi_TXOp(ue,proc,eNB_id)==1)); ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && - (is_ri_TXOp(ue,proc,eNB_id)==1)); + (is_ri_TXOp(ue,proc,eNB_id)==1)); // Part - II // if nothing to report ==> exit function - if( (nb_cw==0) && (SR_payload==0) && (cqi_status==0) && (ri_status==0) ) - { - LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d SR_payload %d nb_cw %d pucch_ack_payload[0] %d pucch_ack_payload[1] %d cqi_status %d Return \n", - frame_tx%1024, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status); - return; + if( (nb_cw==0) && (SR_payload==0) && (cqi_status==0) && (ri_status==0) ) { + LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d SR_payload %d nb_cw %d pucch_ack_payload[0] %d pucch_ack_payload[1] %d cqi_status %d Return \n", + frame_tx%1024, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status); + return; } // Part - III @@ -2143,184 +1979,169 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin &pucch_resource, (uint8_t *)&pucch_payload, &len); - - - LOG_I(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d (%d %d) AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n", - frame_tx%1024, subframe_tx, SR_payload, nb_cw, ack_status_cw0, ack_status_cw1, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0],pucch_payload[1]); - + LOG_D(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d (%d %d) AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n", + frame_tx%1024, subframe_tx, SR_payload, nb_cw, ack_status_cw0, ack_status_cw1, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0], + pucch_payload[1]); // Part - IV // Generate PUCCH signal ue->generate_ul_signal[eNB_id] = 1; switch (format) { - case pucch_format1: - case pucch_format1a: - case pucch_format1b: - { - if (ue->mac_enabled == 1) { - Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); - } - else { - Po_PUCCH = ue->tx_power_max_dBm; - } - ue->tx_power_dBm[subframe_tx] = Po_PUCCH; - ue->tx_total_RE[subframe_tx] = 12; - -#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - tx_amp = get_tx_amp(Po_PUCCH, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - 1); -#else - tx_amp = AMP; -#endif - - T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), - T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); - - if(format == pucch_format1) - { - LOG_D(PHY,"[UE %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx, - frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, - isShortenPucch, - ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, - Po_PUCCH); - } - else - { - if (SR_payload>0) { - LOG_D(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx % 1024, subframe_tx, - (format == pucch_format1a? "1a": ( - format == pucch_format1b? "1b" : "??")), - pucch_ack_payload[0],pucch_ack_payload[1], - frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, - isShortenPucch, - pucch_resource, - Po_PUCCH, - tx_amp); - } else { - LOG_D(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx,ue->rx_offset_diff, - (format == pucch_format1a? "1a": ( - format == pucch_format1b? "1b" : "??")), - frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, - isShortenPucch, - pucch_resource,pucch_payload[0],pucch_payload[1],SR_payload, - Po_PUCCH, - tx_amp); - } - } - - - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - if(pucch_payload[0]) - { - T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), - T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); - } - else - { - T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), - T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); - } - } - - generate_pucch1x(ue->common_vars.txdataF, - &ue->frame_parms, - ue->ncs_cell, - format, - &ue->pucch_config_dedicated[eNB_id], - pucch_resource, - isShortenPucch, // shortened format - pucch_payload, - tx_amp, - subframe_tx); - - } - break; - - - case pucch_format2: - { + case pucch_format1: + case pucch_format1a: + case pucch_format1b: { if (ue->mac_enabled == 1) { - Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); - } - else { - Po_PUCCH = ue->tx_power_max_dBm; + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } else { + Po_PUCCH = ue->tx_power_max_dBm; } + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - tx_amp = get_tx_amp(Po_PUCCH, - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - 1); + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); #else tx_amp = AMP; #endif T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), - T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); - if( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx, - Po_PUCCH, - isShortenPucch, - tx_amp); - } - generate_pucch2x(ue->common_vars.txdataF, - &ue->frame_parms, - ue->ncs_cell, - format, - &ue->pucch_config_dedicated[eNB_id], - pucch_resource, - pucch_payload, - len, // A - 0, // B2 not needed - tx_amp, - subframe_tx, - ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti); - } - break; + T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); - case pucch_format2a: + if(format == pucch_format1) { + LOG_D(PHY,"[UE %d][SR %x] AbsSubframe %d.%d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, + isShortenPucch, + ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, + Po_PUCCH); + } else { + if (SR_payload>0) { + LOG_D(PHY,"[UE %d][SR %x] AbsSubFrame %d.%d Generating PUCCH %s payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d, amp %d\n", + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx % 1024, subframe_tx, + (format == pucch_format1a? "1a": ( + format == pucch_format1b? "1b" : "??")), + pucch_ack_payload[0],pucch_ack_payload[1], + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, + isShortenPucch, + pucch_resource, + Po_PUCCH, + tx_amp); + } else { + LOG_D(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d rx_offset_diff: %d, Generating PUCCH %s, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx,ue->rx_offset_diff, + (format == pucch_format1a? "1a": ( + format == pucch_format1b? "1b" : "??")), + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, + isShortenPucch, + pucch_resource,pucch_payload[0],pucch_payload[1],SR_payload, + Po_PUCCH, + tx_amp); + } + } + + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + if(pucch_payload[0]) { + T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), + T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); + } else { + T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti), + T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid)); + } + } + + generate_pucch1x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + pucch_resource, + isShortenPucch, // shortened format + pucch_payload, + tx_amp, + subframe_tx); + } + break; + + case pucch_format2: { + if (ue->mac_enabled == 1) { + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } else { + Po_PUCCH = ue->tx_power_max_dBm; + } + + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; + ue->tx_total_RE[subframe_tx] = 12; +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); +#else + tx_amp = AMP; +#endif + T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]), + T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id))); + + if( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n", + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx, + Po_PUCCH, + isShortenPucch, + tx_amp); + } + + generate_pucch2x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + pucch_resource, + pucch_payload, + len, // A + 0, // B2 not needed + tx_amp, + subframe_tx, + ue->pdcch_vars[ue->current_thread_id[proc->subframe_rx]][eNB_id]->crnti); + } + break; + + case pucch_format2a: LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2a (RI or CQI) Ack/Nack 1bit \n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx); + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx); break; - case pucch_format2b: + + case pucch_format2b: LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2b (RI or CQI) Ack/Nack 2bits\n", - Mod_id, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, - frame_tx%1024, subframe_tx); + Mod_id, + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti, + frame_tx%1024, subframe_tx); break; - default: + + default: break; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT); - } void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) { - int subframe_tx = proc->subframe_tx; int frame_tx = proc->frame_tx; SLSS_t *slss; SLDCH_t *sldch; SLSCH_t *slsch; - LOG_D(PHY,"****** start Sidelink TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, subframe_tx); // check for SLBCH/SLSS @@ -2331,78 +2152,61 @@ void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) { // check for SLSCH if ((slsch = ue_get_slsch(ue->Mod_id,ue->CC_id,frame_tx,subframe_tx)) != NULL) generate_slsch(ue,slsch,frame_tx,subframe_tx); - } void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) { - - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; //int32_t ulsch_start=0; int subframe_tx = proc->subframe_tx; int frame_tx = proc->frame_tx; unsigned int aa; uint8_t isSubframeSRS; - uint8_t next1_thread_id = ue->current_thread_id[proc->subframe_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[proc->subframe_rx]+1); uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); - LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, subframe_tx); - T(T_UE_PHY_UL_TICK, T_INT(ue->Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx)); - - ue->generate_ul_signal[eNB_id] = 0; + if ( LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->phy_proc_tx); } ue->tx_power_dBm[subframe_tx]=-127; - for (aa=0; aanb_antennas_tx; aa++) { memset(&ue->common_vars.txdataF[aa][subframe_tx*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti], - 0, - frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*sizeof(int32_t)); + 0, + frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*sizeof(int32_t)); } - + if (subframe_select(&ue->frame_parms,proc->subframe_tx) == SF_UL || ue->frame_parms.frame_type == FDD) { - if (ue->UE_mode[eNB_id] != PRACH ) { + if (ue->UE_mode[eNB_id] > PRACH ) { // check cell srs subframe and ue srs subframe. This has an impact on pusch encoding isSubframeSRS = is_srs_occasion_common(&ue->frame_parms,proc->frame_tx,proc->subframe_tx); - ue_compute_srs_occasion(ue,proc,eNB_id,isSubframeSRS); - ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag); - LOG_D(PHY,"ULPOWERS After ulsch_uespec_procedures : ue->tx_power_dBm[%d]=%d, NPRB %d\n", - subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_total_RE[subframe_tx]); + subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_total_RE[subframe_tx]); } - + if (ue->UE_mode[eNB_id] == PUSCH) { // check if we need to use PUCCH 1a/1b ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); // check if we need to use SRS ue_srs_procedures(ue,proc,eNB_id,abstraction_flag); } // UE_mode==PUSCH - } - LOG_D(PHY,"doing ulsch_common_procedures (%d.%d): generate_ul_signal %d\n",frame_tx,subframe_tx, - ue->generate_ul_signal[eNB_id]); + ue->generate_ul_signal[eNB_id]); ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[eNB_id] == 0)); - - if ((ue->UE_mode[eNB_id] == PRACH) && + + if ((ue->UE_mode[eNB_id] == PRACH) && (ue->frame_parms.prach_config_common.prach_Config_enabled==1)) { - // check if we have PRACH opportunity - if (is_prach_subframe(&ue->frame_parms,frame_tx,subframe_tx)) { - ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } } // mode is PRACH @@ -2412,131 +2216,113 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui // reset DL ACK/NACK status uint8_t N_bundled = 0; - if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0] != NULL) - { + + if (ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0] != NULL) { reset_ack(&ue->frame_parms, - ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &N_bundled, - 0); + ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); reset_ack(&ue->frame_parms, - ue->dlsch[next1_thread_id][eNB_id][0]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &N_bundled, - 0); + ue->dlsch[next1_thread_id][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); reset_ack(&ue->frame_parms, - ue->dlsch[next2_thread_id][eNB_id][0]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &N_bundled, - 0); + ue->dlsch[next2_thread_id][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); } if (ue->dlsch_SI[eNB_id] != NULL) reset_ack(&ue->frame_parms, - ue->dlsch_SI[eNB_id]->harq_ack, - subframe_tx, - proc->subframe_rx, - ue->ulsch[eNB_id]->o_ACK, - &N_bundled, - 0); - + ue->dlsch_SI[eNB_id]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, subframe_tx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); + if ( LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->phy_proc_tx); } } -void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_flag) -{ +void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_flag) { int aa;//i,aa; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - for (aa=0; aanb_antennas_tx; aa++) { #if defined(EXMIMO) //this is the EXPRESS MIMO case int i; + // set the whole tx buffer to RX for (i=0; isamples_per_tti; i++) ue->common_vars.txdata[aa][i] = 0x00010001; - + #else //this is the normal case // memset(&ue->common_vars.txdata[aa][0],0, - // (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)*sizeof(int32_t)); + // (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti)*sizeof(int32_t)); #endif //else EXMIMO - } - } void ue_measurement_procedures( - uint16_t l, // symbol index of each slot [0..6] - PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id, - uint16_t slot, // slot index of each radio frame [0..19] - uint8_t abstraction_flag,runmode_t mode) -{ - + uint16_t l, // symbol index of each slot [0..6] + PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t eNB_id, + uint16_t slot, // slot index of each radio frame [0..19] + uint8_t abstraction_flag,runmode_t mode) { //LOG_I(PHY,"ue_measurement_procedures l %d Ncp %d\n",l,ue->frame_parms.Ncp); - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - int subframe_rx = proc->subframe_rx; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN); if (l==0) { // UE measurements on symbol 0 - LOG_D(PHY,"Calling measurements subframe %d, rxdata %p\n",subframe_rx,ue->common_vars.rxdata); - LOG_D(PHY,"Calling measurements subframe %d, rxdata %p\n",subframe_rx,ue->common_vars.rxdata); + LOG_D(PHY,"Calling measurements subframe %d, rxdata %p\n",subframe_rx,ue->common_vars.rxdata); + lte_ue_measurements(ue, + (subframe_rx*frame_parms->samples_per_tti+ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME), + (subframe_rx == 1) ? 1 : 0, + 0, + 0, + subframe_rx); - lte_ue_measurements(ue, - (subframe_rx*frame_parms->samples_per_tti+ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME), - (subframe_rx == 1) ? 1 : 0, - 0, - 0, - subframe_rx); - - - if(slot == 0) - T(T_UE_PHY_MEAS, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), - T_INT((int)(10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB)), - T_INT((int)ue->measurements.rx_rssi_dBm[0]), - T_INT((int)(ue->measurements.rx_power_avg_dB[0] - ue->measurements.n0_power_avg_dB)), - T_INT((int)ue->measurements.rx_power_avg_dB[0]), - T_INT((int)ue->measurements.n0_power_avg_dB), - T_INT((int)ue->measurements.wideband_cqi_avg[0]), - T_INT((int)ue->common_vars.freq_offset)); + if(slot == 0) + T(T_UE_PHY_MEAS, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), + T_INT((int)(10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB)), + T_INT((int)ue->measurements.rx_rssi_dBm[0]), + T_INT((int)(ue->measurements.rx_power_avg_dB[0] - ue->measurements.n0_power_avg_dB)), + T_INT((int)ue->measurements.rx_power_avg_dB[0]), + T_INT((int)ue->measurements.n0_power_avg_dB), + T_INT((int)ue->measurements.wideband_cqi_avg[0]), + T_INT((int)ue->common_vars.freq_offset)); } if (( (slot%2) == 0) && (l==(6-ue->frame_parms.Ncp))) { - // make sure we have signal from PSS/SSS for N0 measurement - // LOG_I(PHY," l==(6-ue->frame_parms.Ncp) ue_rrc_measurements\n"); - + // LOG_I(PHY," l==(6-ue->frame_parms.Ncp) ue_rrc_measurements\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN); ue_rrc_measurements(ue, - slot, - abstraction_flag); + slot, + abstraction_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT); - } // accumulate and filter timing offset estimation every subframe (instead of every frame) if (( (slot%2) == 0) && (l==(4-frame_parms->Ncp))) { - // AGC - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_IN); - #ifndef OAI_USRP #ifndef OAI_BLADERF #ifndef OAI_LMSSDR @@ -2544,20 +2330,16 @@ void ue_measurement_procedures( #endif #endif #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); - eNB_id = 0; - if (ue->no_timing_correction==0) lte_adjust_synch(&ue->frame_parms, - ue, - eNB_id, - subframe_rx, - 0, - 16384); - + ue, + eNB_id, + subframe_rx, + 0, + 16384); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT); @@ -2565,23 +2347,17 @@ void ue_measurement_procedures( -void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t abstraction_flag) -{ - +void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uint8_t abstraction_flag) { // int i; int pbch_tx_ant=0; uint8_t pbch_phase; uint16_t frame_tx; static uint8_t first_run = 1; uint8_t pbch_trials = 0; - DevAssert(ue); - int frame_rx = proc->frame_rx; int subframe_rx = proc->subframe_rx; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); - pbch_phase=(frame_rx%4); if (pbch_phase>=4) @@ -2590,15 +2366,14 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin for (pbch_trials=0; pbch_trials<4; pbch_trials++) { //for (pbch_phase=0;pbch_phase<4;pbch_phase++) { //LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,eNB_id); - pbch_tx_ant = rx_pbch(&ue->common_vars, - ue->pbch_vars[eNB_id], - &ue->frame_parms, - eNB_id, - ue->frame_parms.nb_antenna_ports_eNB==1?SISO:ALAMOUTI, - ue->high_speed_flag, - pbch_phase); - + ue->pbch_vars[eNB_id], + &ue->frame_parms, + eNB_id, + ue->frame_parms.nb_antenna_ports_eNB==1?SISO:ALAMOUTI, + ue->high_speed_flag, + pbch_phase); + if ((pbch_tx_ant>0) && (pbch_tx_ant<=4)) { break; } @@ -2609,19 +2384,16 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin pbch_phase=0; } - - if ((pbch_tx_ant>0) && (pbch_tx_ant<=4)) { - if (opt_enabled) { static uint8_t dummy[3]; dummy[0] = ue->pbch_vars[eNB_id]->decoded_output[2]; dummy[1] = ue->pbch_vars[eNB_id]->decoded_output[1]; 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); + frame_rx, subframe_rx, 0, 0); LOG_D(OPT,"[UE %d][PBCH] Frame %d trace pdu for PBCH\n", - ue->Mod_id, subframe_rx); + ue->Mod_id, subframe_rx); } if (pbch_tx_ant>2) { @@ -2630,95 +2402,77 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin return; } - ue->pbch_vars[eNB_id]->pdu_errors_conseq = 0; frame_tx = (((int)(ue->pbch_vars[eNB_id]->decoded_output[2]&0x03))<<8); frame_tx += ((int)(ue->pbch_vars[eNB_id]->decoded_output[1]&0xfc)); frame_tx += pbch_phase; if (ue->mac_enabled==1) { - dl_phy_sync_success(ue->Mod_id,frame_rx,eNB_id, - ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0); + ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0); } - // if this is the first PBCH after initial synchronization, make L1 state = PRACH - if (ue->UE_mode[eNB_id]==NOT_SYNCHED) ue->UE_mode[eNB_id] = PRACH; + // if this is the first PBCH after initial synchronization and no timing correction is performed, make L1 state = PRACH + if (ue->UE_mode[eNB_id]==NOT_SYNCHED && ue->no_timing_correction == 1) ue->UE_mode[eNB_id] = PRACH; if (first_run) { first_run = 0; - proc->frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); proc->frame_tx = proc->frame_rx; - for(int th_id=0; th_idproc.proc_rxtx[th_id].frame_rx = proc->frame_rx; ue->proc.proc_rxtx[th_id].frame_tx = proc->frame_tx; - printf("[UE %d] frame %d, subframe %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d, rx_offset %d) => new frame %d\n", - ue->Mod_id, - ue->proc.proc_rxtx[th_id].frame_rx, - subframe_rx, - pbch_tx_ant, - frame_tx, - pbch_phase, - ue->rx_offset, - proc->frame_rx); + ue->Mod_id, + ue->proc.proc_rxtx[th_id].frame_rx, + subframe_rx, + pbch_tx_ant, + frame_tx, + pbch_phase, + ue->rx_offset, + proc->frame_rx); } - frame_rx = proc->frame_rx; - } else if (((frame_tx & 0x03FF) != (proc->frame_rx & 0x03FF))) { //(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) { LOG_D(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).\n", - ue->Mod_id, - proc->frame_rx, - subframe_rx, - pbch_tx_ant, - frame_tx, - frame_rx & 0x03FF, - pbch_phase); - - + ue->Mod_id, + proc->frame_rx, + subframe_rx, + pbch_tx_ant, + frame_tx, + frame_rx & 0x03FF, + pbch_phase); proc->frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); proc->frame_tx = proc->frame_rx; frame_rx = proc->frame_rx; - - for(int th_id=0; th_idproc.proc_rxtx[th_id].frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); ue->proc.proc_rxtx[th_id].frame_tx = proc->frame_rx; } - } if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_UI(PHY,"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n", - ue->Mod_id, - frame_rx, - subframe_rx, - ue->frame_parms.nb_antenna_ports_eNB, - pbch_tx_ant, - frame_tx, - ue->frame_parms.N_RB_DL, - ue->frame_parms.phich_config_common.phich_duration, - ue->frame_parms.phich_config_common.phich_resource); + ue->Mod_id, + frame_rx, + subframe_rx, + ue->frame_parms.nb_antenna_ports_eNB, + pbch_tx_ant, + frame_tx, + ue->frame_parms.N_RB_DL, + ue->frame_parms.phich_config_common.phich_duration, + ue->frame_parms.phich_config_common.phich_resource); } - - } else { - + } else { if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n", - ue->Mod_id,frame_rx, subframe_rx); - + ue->Mod_id,frame_rx, subframe_rx); LOG_I(PHY,"[UE %d] rx_offset %d\n",ue->Mod_id,ue->rx_offset); - - LOG_M("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_tti,1,1); - LOG_M("PBCH_rxF0_ext.m","pbch0_ext",ue->pbch_vars[0]->rxdataF_ext[0],12*4*6,1,1); LOG_M("PBCH_rxF0_comp.m","pbch0_comp",ue->pbch_vars[0]->rxdataF_comp[0],12*4*6,1,1); LOG_M("PBCH_rxF_llr.m","pbch_llr",ue->pbch_vars[0]->llr,(ue->frame_parms.Ncp==0) ? 1920 : 1728,1,4); @@ -2730,9 +2484,8 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin if (ue->mac_enabled == 1) rrc_out_of_sync_ind(ue->Mod_id,frame_rx,eNB_id); else AssertFatal(ue->pbch_vars[eNB_id]->pdu_errors_conseq<100, - "More that 100 consecutive PBCH errors! Exiting!\n"); + "More that 100 consecutive PBCH errors! Exiting!\n"); } - if (frame_rx % 100 == 0) { ue->pbch_vars[eNB_id]->pdu_fer = ue->pbch_vars[eNB_id]->pdu_errors - ue->pbch_vars[eNB_id]->pdu_errors_last; @@ -2741,277 +2494,242 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_UI(PHY,"[UE %d] frame %d, slot %d, PBCH errors = %d, consecutive errors = %d!\n", - ue->Mod_id,frame_rx, subframe_rx, - ue->pbch_vars[eNB_id]->pdu_errors, - ue->pbch_vars[eNB_id]->pdu_errors_conseq); + ue->Mod_id,frame_rx, subframe_rx, + ue->pbch_vars[eNB_id]->pdu_errors, + ue->pbch_vars[eNB_id]->pdu_errors_conseq); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT); } -int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t abstraction_flag) -{ - +int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t abstraction_flag) { unsigned int dci_cnt=0, i; - int frame_rx = proc->frame_rx; int subframe_rx = proc->subframe_rx; DCI_ALLOC_t dci_alloc_rx[8]; - uint8_t next1_thread_id = ue->current_thread_id[subframe_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe_rx]+1); uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); - LOG_D(PHY,"DCI Decoding procedure in %d.%d\n",frame_rx,subframe_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_IN); + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->dlsch_rx_pdcch_stats); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); rx_pdcch(ue, - proc->frame_rx, - subframe_rx, - eNB_id, - ue->frame_parms.nb_antenna_ports_eNB==1?SISO:ALAMOUTI, - ue->high_speed_flag); - + proc->frame_rx, + subframe_rx, + eNB_id, + ue->frame_parms.nb_antenna_ports_eNB==1?SISO:ALAMOUTI, + ue->high_speed_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN); - - + /*printf("Decode SIB frame param aggregation + DCI %d %d, num_pdcch_symbols %d\n", - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dciFormat, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dciFormat, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); */ //agregation level == FF means no configuration on - if(ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel == 0xFF || ue->decode_SIB) - { - // search all possible dcis - dci_cnt = dci_decoding_procedure(ue, - dci_alloc_rx, - (ue->UE_mode[eNB_id] < PUSCH)? 1 : 0, // if we're in PUSCH don't listen to common search space, - // later when we need paging or RA during connection, update this ... - eNB_id,subframe_rx); - } - else - { - // search only preconfigured dcis - // search C RNTI dci - dci_cnt = dci_CRNTI_decoding_procedure(ue, - dci_alloc_rx, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dciFormat, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel, - eNB_id, - subframe_rx); - } - + if(ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel == 0xFF || ue->decode_SIB) { + // search all possible dcis + dci_cnt = dci_decoding_procedure(ue, + dci_alloc_rx, + (ue->UE_mode[eNB_id] < PUSCH)? 1 : 0, // if we're in PUSCH don't listen to common search space, + // later when we need paging or RA during connection, update this ... + eNB_id,subframe_rx); + } else { + // search only preconfigured dcis + // search C RNTI dci + dci_cnt = dci_CRNTI_decoding_procedure(ue, + dci_alloc_rx, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dciFormat, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel, + eNB_id, + subframe_rx); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT); //LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d PHICH RX\n",ue->Mod_id,frame_rx,subframe_rx); - + if (is_phich_subframe(&ue->frame_parms,subframe_rx)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PHICH, VCD_FUNCTION_IN); rx_phich(ue,proc, - subframe_rx,eNB_id); + subframe_rx,eNB_id); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PHICH, VCD_FUNCTION_OUT); } - + uint8_t *nCCE_current = &ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->nCCE[subframe_rx]; uint8_t *nCCE_dest = &ue->pdcch_vars[next1_thread_id][eNB_id]->nCCE[subframe_rx]; uint8_t *nCCE_dest1 = &ue->pdcch_vars[next2_thread_id][eNB_id]->nCCE[subframe_rx]; memcpy(nCCE_dest, nCCE_current, sizeof(uint8_t)); memcpy(nCCE_dest1, nCCE_current, sizeof(uint8_t)); - LOG_D(PHY,"current_thread %d next1_thread %d next2_thread %d \n", ue->current_thread_id[subframe_rx], next1_thread_id, next2_thread_id); - LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d, Mode %s: DCI found %i --> rnti %x / crnti %x : format %d\n", - ue->Mod_id,frame_rx%1024,subframe_rx,mode_string[ue->UE_mode[eNB_id]], - dci_cnt, - dci_alloc_rx[0].rnti, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, - dci_alloc_rx[0].format ); - + ue->Mod_id,frame_rx%1024,subframe_rx,mode_string[ue->UE_mode[eNB_id]], + dci_cnt, + dci_alloc_rx[0].rnti, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, + dci_alloc_rx[0].format ); ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dci_received += dci_cnt; for (i=0; iUE_mode[eNB_id]>PRACH) && - (dci_alloc_rx[i].rnti == ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti) && - (dci_alloc_rx[i].format != format0)) { - + (dci_alloc_rx[i].rnti == ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti) && + (dci_alloc_rx[i].format != format0)) { LOG_D(PHY,"[UE %d][DCI][PDSCH %x] AbsSubframe %d.%d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n", - ue->Mod_id,dci_alloc_rx[i].rnti, - frame_rx%1024,subframe_rx, - dci_alloc_rx[i].format, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->nCCE[subframe_rx], - get_nCCE(3,&ue->frame_parms,get_mi(&ue->frame_parms,0))); - + ue->Mod_id,dci_alloc_rx[i].rnti, + frame_rx%1024,subframe_rx, + dci_alloc_rx[i].format, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->nCCE[subframe_rx], + get_nCCE(3,&ue->frame_parms,get_mi(&ue->frame_parms,0))); + //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - + if ((ue->UE_mode[eNB_id] > PRACH) && - (generate_ue_dlsch_params_from_dci(frame_rx, - subframe_rx, - (void *)&dci_alloc_rx[i].dci_pdu, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, - dci_alloc_rx[i].format, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], - ue->pdsch_vars[ue->current_thread_id[subframe_rx]][eNB_id], - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id], - &ue->frame_parms, - ue->pdsch_config_dedicated, - SI_RNTI, - 0, - P_RNTI, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], - ue->pdcch_vars[0%RX_NB_TH][eNB_id]->crnti_is_temporary? ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti: 0)==0)) { - - // update TPC for PUCCH - if((dci_alloc_rx[i].format == format1) || - (dci_alloc_rx[i].format == format1A) || - (dci_alloc_rx[i].format == format1B) || - (dci_alloc_rx[i].format == format2) || - (dci_alloc_rx[i].format == format2A) || - (dci_alloc_rx[i].format == format2B)) - { - //ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->g_pucch += ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->delta_PUCCH; - int32_t delta_pucch = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->delta_PUCCH; - for(int th_id=0; th_iddlsch[th_id][eNB_id][0]->g_pucch += delta_pucch; - } - LOG_D(PHY,"update TPC for PUCCH %d.%d / pid %d delta_PUCCH %d g_pucch %d %d \n",frame_rx, subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid, - delta_pucch, - ue->dlsch[0][eNB_id][0]->g_pucch, - ue->dlsch[1][eNB_id][0]->g_pucch - //ue->dlsch[2][eNB_id][0]->g_pucch - ); + (generate_ue_dlsch_params_from_dci(frame_rx, + subframe_rx, + (void *)&dci_alloc_rx[i].dci_pdu, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, + dci_alloc_rx[i].format, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], + ue->pdsch_vars[ue->current_thread_id[subframe_rx]][eNB_id], + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id], + &ue->frame_parms, + ue->pdsch_config_dedicated, + SI_RNTI, + 0, + P_RNTI, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], + ue->pdcch_vars[0%RX_NB_TH][eNB_id]->crnti_is_temporary? ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti: 0)==0)) { + // update TPC for PUCCH + if((dci_alloc_rx[i].format == format1) || + (dci_alloc_rx[i].format == format1A) || + (dci_alloc_rx[i].format == format1B) || + (dci_alloc_rx[i].format == format2) || + (dci_alloc_rx[i].format == format2A) || + (dci_alloc_rx[i].format == format2B)) { + //ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->g_pucch += ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->delta_PUCCH; + int32_t delta_pucch = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->delta_PUCCH; + + for(int th_id=0; th_iddlsch[th_id][eNB_id][0]->g_pucch += delta_pucch; } - - ue->dlsch_received[eNB_id]++; - + + LOG_D(PHY,"update TPC for PUCCH %d.%d / pid %d delta_PUCCH %d g_pucch %d %d \n",frame_rx, subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid, + delta_pucch, + ue->dlsch[0][eNB_id][0]->g_pucch, + ue->dlsch[1][eNB_id][0]->g_pucch + //ue->dlsch[2][eNB_id][0]->g_pucch + ); + } + + ue->dlsch_received[eNB_id]++; + if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Generated UE DLSCH C_RNTI format %d\n",ue->Mod_id,dci_alloc_rx[i].format); - dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d=> %d\n",ue->Mod_id,subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active); + LOG_D(PHY,"[UE %d] Generated UE DLSCH C_RNTI format %d\n",ue->Mod_id,dci_alloc_rx[i].format); + dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); + LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d=> %d\n",ue->Mod_id,subframe_rx,ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active); } - - // we received a CRNTI, so we're in PUSCH - if (ue->UE_mode[eNB_id] != PUSCH) { + + // we received a CRNTI, so we're in PUSCH + if (ue->UE_mode[eNB_id] != PUSCH) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); - } - - //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - ue->UE_mode[eNB_id] = PUSCH; - } - } else { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Problem in DCI!\n",ue->Mod_id,frame_rx,subframe_rx); - dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - } - } - - else if ((dci_alloc_rx[i].rnti == SI_RNTI) && - ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",ue->Mod_id,frame_rx,subframe_rx,ue->pdcch_vars[subframe_rx&1][eNB_id]->crnti); + } - - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); + //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); + ue->UE_mode[eNB_id] = PUSCH; } - - if (generate_ue_dlsch_params_from_dci(frame_rx, - subframe_rx, - (void *)&dci_alloc_rx[i].dci_pdu, - SI_RNTI, - dci_alloc_rx[i].format, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], - ue->pdsch_vars_SI[eNB_id], - &ue->dlsch_SI[eNB_id], - &ue->frame_parms, - ue->pdsch_config_dedicated, - SI_RNTI, - 0, - P_RNTI, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], - 0)==0) { - - ue->dlsch_SI_received[eNB_id]++; - - LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); - //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - - } + } else { + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Problem in DCI!\n",ue->Mod_id,frame_rx,subframe_rx); + dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); } - - else if ((dci_alloc_rx[i].rnti == P_RNTI) && - ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { - + } else if ((dci_alloc_rx[i].rnti == SI_RNTI) && + ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); } + if (generate_ue_dlsch_params_from_dci(frame_rx, + subframe_rx, + (void *)&dci_alloc_rx[i].dci_pdu, + SI_RNTI, + dci_alloc_rx[i].format, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], + ue->pdsch_vars_SI[eNB_id], + &ue->dlsch_SI[eNB_id], + &ue->frame_parms, + ue->pdsch_config_dedicated, + SI_RNTI, + 0, + P_RNTI, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], + 0)==0) { + ue->dlsch_SI_received[eNB_id]++; + LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH SI_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); + //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); + } + } else if ((dci_alloc_rx[i].rnti == P_RNTI) && + ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d] subframe %d: Found rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); + } if (generate_ue_dlsch_params_from_dci(frame_rx, - subframe_rx, - (void *)&dci_alloc_rx[i].dci_pdu, - P_RNTI, - dci_alloc_rx[i].format, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], - ue->pdsch_vars_p[eNB_id], - &ue->dlsch_SI[eNB_id], - &ue->frame_parms, - ue->pdsch_config_dedicated, - SI_RNTI, - 0, - P_RNTI, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], + subframe_rx, + (void *)&dci_alloc_rx[i].dci_pdu, + P_RNTI, + dci_alloc_rx[i].format, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], + ue->pdsch_vars_p[eNB_id], + &ue->dlsch_SI[eNB_id], + &ue->frame_parms, + ue->pdsch_config_dedicated, + SI_RNTI, + 0, + P_RNTI, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], 0)==0) { - - ue->dlsch_p_received[eNB_id]++; - LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH P_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); - //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - + ue->dlsch_p_received[eNB_id]++; + LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH P_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C"); + //dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); } - } - - else if ((ue->prach_resources[eNB_id]) && - (dci_alloc_rx[i].rnti == ue->prach_resources[eNB_id]->ra_RNTI) && - ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { - + } else if ((ue->prach_resources[eNB_id]) && + (dci_alloc_rx[i].rnti == ue->prach_resources[eNB_id]->ra_RNTI) && + ((dci_alloc_rx[i].format == format1A) || (dci_alloc_rx[i].format == format1C))) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d][RAPROC] subframe %d: Found RA rnti %x, format 1%s, dci_cnt %d\n",ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,dci_alloc_rx[i].format==format1A?"A":"C",i); } - if (generate_ue_dlsch_params_from_dci(frame_rx, - subframe_rx, - (void *)&dci_alloc_rx[i].dci_pdu, - ue->prach_resources[eNB_id]->ra_RNTI, - dci_alloc_rx[i].format, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], - ue->pdsch_vars_ra[eNB_id], - &ue->dlsch_ra[eNB_id], - &ue->frame_parms, - ue->pdsch_config_dedicated, - SI_RNTI, - ue->prach_resources[eNB_id]->ra_RNTI, - P_RNTI, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], + subframe_rx, + (void *)&dci_alloc_rx[i].dci_pdu, + ue->prach_resources[eNB_id]->ra_RNTI, + dci_alloc_rx[i].format, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id], + ue->pdsch_vars_ra[eNB_id], + &ue->dlsch_ra[eNB_id], + &ue->frame_parms, + ue->pdsch_config_dedicated, + SI_RNTI, + ue->prach_resources[eNB_id]->ra_RNTI, + P_RNTI, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id], 0)==0) { - - ue->dlsch_ra_received[eNB_id]++; + ue->dlsch_ra_received[eNB_id]++; - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Generate UE DLSCH RA_RNTI format 1A, rb_alloc %x, dlsch_ra[eNB_id] %p\n", - ue->Mod_id,ue->dlsch_ra[eNB_id]->harq_processes[0]->rb_alloc_even[0],ue->dlsch_ra[eNB_id]); - } + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d] Generate UE DLSCH RA_RNTI format 1A, rb_alloc %x, dlsch_ra[eNB_id] %p\n", + ue->Mod_id,ue->dlsch_ra[eNB_id]->harq_processes[0]->rb_alloc_even[0],ue->dlsch_ra[eNB_id]); + } } } else if( (dci_alloc_rx[i].rnti == ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti) && - (dci_alloc_rx[i].format == format0)) { - + (dci_alloc_rx[i].format == format0)) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found rnti %x, format 0, dci_cnt %d\n", ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i); @@ -3019,48 +2737,46 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint ue->ulsch_no_allocation_counter[eNB_id] = 0; //dump_dci(&ue->frame_parms,&dci_alloc_rx[i]); - - if ((ue->UE_mode[eNB_id] > PRACH) && - (generate_ue_ulsch_params_from_dci((void *)&dci_alloc_rx[i].dci_pdu, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, - subframe_rx, - format0, - ue, - proc, - SI_RNTI, - 0, - P_RNTI, - CBA_RNTI, - eNB_id, - 0)==0)) { - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - - LOG_USEDINLOG_VAR(int8_t,harq_pid) = subframe2harq_pid(&ue->frame_parms, - pdcch_alloc2ul_frame(&ue->frame_parms,proc->frame_rx,proc->subframe_rx), - pdcch_alloc2ul_subframe(&ue->frame_parms,proc->subframe_rx)); - T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), - T_INT(dci_alloc_rx[i].rnti), - T_INT(harq_pid), - T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs), - T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round), - T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb), - T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb), - T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS)); - LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); - } + if ((ue->UE_mode[eNB_id] > PRACH) && + (generate_ue_ulsch_params_from_dci((void *)&dci_alloc_rx[i].dci_pdu, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, + subframe_rx, + format0, + ue, + proc, + SI_RNTI, + 0, + P_RNTI, + CBA_RNTI, + eNB_id, + 0)==0)) { + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_USEDINLOG_VAR(int8_t,harq_pid) = subframe2harq_pid(&ue->frame_parms, + pdcch_alloc2ul_frame(&ue->frame_parms,proc->frame_rx,proc->subframe_rx), + pdcch_alloc2ul_subframe(&ue->frame_parms,proc->subframe_rx)); + T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx), + T_INT(dci_alloc_rx[i].rnti), + T_INT(harq_pid), + T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs), + T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round), + T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb), + T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb), + T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS)); + LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); + } } } else if( (dci_alloc_rx[i].rnti == ue->ulsch[eNB_id]->cba_rnti[0]) && - (dci_alloc_rx[i].format == format0)) { + (dci_alloc_rx[i].format == format0)) { // UE could belong to more than one CBA group // ue->Mod_id%ue->ulsch[eNB_id]->num_active_cba_groups] if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found cba rnti %x, format 0, dci_cnt %d\n", - ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i); - /* - if (((frame_rx%100) == 0) || (frame_rx < 20)) - dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); - */ + ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i); + /* + if (((frame_rx%100) == 0) || (frame_rx < 20)) + dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); + */ } ue->ulsch_no_allocation_counter[eNB_id] = 0; @@ -3068,51 +2784,48 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint if ((ue->UE_mode[eNB_id] > PRACH) && (generate_ue_ulsch_params_from_dci((void *)&dci_alloc_rx[i].dci_pdu, - ue->ulsch[eNB_id]->cba_rnti[0], - subframe_rx, - format0, - ue, - proc, - SI_RNTI, - 0, - P_RNTI, - CBA_RNTI, - eNB_id, - 0)==0)) { - + ue->ulsch[eNB_id]->cba_rnti[0], + subframe_rx, + format0, + ue, + proc, + SI_RNTI, + 0, + P_RNTI, + CBA_RNTI, + eNB_id, + 0)==0)) { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d] Generate UE ULSCH CBA_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx); } + ue->ulsch[eNB_id]->num_cba_dci[(subframe_rx+4)%10]++; } - } - - else { + } else { if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, - ue->ulsch[eNB_id]->cba_rnti[0], - dci_alloc_rx[i].format); - - // dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, + ue->ulsch[eNB_id]->cba_rnti[0], + dci_alloc_rx[i].format); + // dump_dci(&ue->frame_parms, &dci_alloc_rx[i]); } } + } - } if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->dlsch_rx_pdcch_stats); + stop_meas(&ue->dlsch_rx_pdcch_stats); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); return(0); } void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abstraction_flag) { - int subframe_rx = proc->subframe_rx; int frame_rx = proc->frame_rx; int pmch_mcs=-1; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) int CC_id = ue->CC_id; #endif uint8_t sync_area=255; @@ -3122,19 +2835,16 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs if (is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms)) { // LOG_D(PHY,"ue calling pmch subframe ..\n "); - LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n", - ue->Mod_id,frame_rx,subframe_rx); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - + ue->Mod_id,frame_rx,subframe_rx); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) pmch_mcs = ue_query_mch(ue->Mod_id, - CC_id, - frame_rx, - subframe_rx, - eNB_id, - &sync_area, - &mcch_active); - + CC_id, + frame_rx, + subframe_rx, + eNB_id, + &sync_area, + &mcch_active); #else pmch_mcs=-1; #endif @@ -3144,158 +2854,148 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs fill_UE_dlsch_MCH(ue,pmch_mcs,1,0,0); for (l=2; l<12; l++) { - slot_fep_mbsfn(ue, - l, - subframe_rx, - 0,0);//ue->rx_offset,0); + slot_fep_mbsfn(ue, + l, + subframe_rx, + 0,0);//ue->rx_offset,0); } - + for (l=2; l<12; l++) { - rx_pmch(ue, - 0, - subframe_rx, - l); + rx_pmch(ue, + 0, + subframe_rx, + l); } - - + ue->dlsch_MCH[0]->harq_processes[0]->Qm = get_Qm(pmch_mcs); - ue->dlsch_MCH[0]->harq_processes[0]->G = get_G(&ue->frame_parms, - ue->dlsch_MCH[0]->harq_processes[0]->nb_rb, - ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even, - ue->dlsch_MCH[0]->harq_processes[0]->Qm, - 1, - 2, - frame_rx, - subframe_rx, - 0); - + ue->dlsch_MCH[0]->harq_processes[0]->nb_rb, + ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even, + ue->dlsch_MCH[0]->harq_processes[0]->Qm, + 1, + 2, + frame_rx, + subframe_rx, + 0); dlsch_unscrambling(&ue->frame_parms,1,ue->dlsch_MCH[0], - ue->dlsch_MCH[0]->harq_processes[0]->G, - ue->pdsch_vars_MCH[0]->llr[0],0,subframe_rx<<1); - + ue->dlsch_MCH[0]->harq_processes[0]->G, + ue->pdsch_vars_MCH[0]->llr[0],0,subframe_rx<<1); LOG_D(PHY,"start turbo decode for MCH %d.%d --> nb_rb %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->nb_rb); LOG_D(PHY,"start turbo decode for MCH %d.%d --> rb_alloc_even %x \n", frame_rx, subframe_rx, (unsigned int)((intptr_t)ue->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even)); LOG_D(PHY,"start turbo decode for MCH %d.%d --> Qm %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->Qm); LOG_D(PHY,"start turbo decode for MCH %d.%d --> Nl %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->Nl); LOG_D(PHY,"start turbo decode for MCH %d.%d --> G %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->harq_processes[0]->G); LOG_D(PHY,"start turbo decode for MCH %d.%d --> Kmimo %d \n", frame_rx, subframe_rx, ue->dlsch_MCH[0]->Kmimo); - ret = dlsch_decoding(ue, - ue->pdsch_vars_MCH[0]->llr[0], - &ue->frame_parms, - ue->dlsch_MCH[0], - ue->dlsch_MCH[0]->harq_processes[0], - frame_rx, - subframe_rx, - 0, - 0,1); + ue->pdsch_vars_MCH[0]->llr[0], + &ue->frame_parms, + ue->dlsch_MCH[0], + ue->dlsch_MCH[0]->harq_processes[0], + frame_rx, + subframe_rx, + 0, + 0,1); + if (mcch_active == 1) - ue->dlsch_mcch_trials[sync_area][0]++; + ue->dlsch_mcch_trials[sync_area][0]++; else - ue->dlsch_mtch_trials[sync_area][0]++; - + ue->dlsch_mtch_trials[sync_area][0]++; + if (ret == (1+ue->dlsch_MCH[0]->max_turbo_iterations)) { - if (mcch_active == 1) - ue->dlsch_mcch_errors[sync_area][0]++; - else - ue->dlsch_mtch_errors[sync_area][0]++; - - LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", - ue->Mod_id, + if (mcch_active == 1) + ue->dlsch_mcch_errors[sync_area][0]++; + else + ue->dlsch_mtch_errors[sync_area][0]++; + + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", + ue->Mod_id, frame_rx,subframe_rx, - ue->dlsch_mcch_errors[sync_area][0], - ue->dlsch_mtch_errors[sync_area][0], - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, - ue->dlsch_MCH[0]->max_turbo_iterations, - ue->dlsch_MCH[0]->harq_processes[0]->G); - // dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); + ue->dlsch_mcch_errors[sync_area][0], + ue->dlsch_mtch_errors[sync_area][0], + ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, + ue->dlsch_MCH[0]->max_turbo_iterations, + ue->dlsch_MCH[0]->harq_processes[0]->G); + // dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - for (int i=0; idlsch_MCH[0]->harq_processes[0]->TBS>>3; i++) { - LOG_T(PHY,"%02x.",ue->dlsch_MCH[0]->harq_processes[0]->c[0][i]); - } - - LOG_T(PHY,"\n"); + LOG_T(PHY,"%02x.",ue->dlsch_MCH[0]->harq_processes[0]->c[0][i]); + } + + LOG_T(PHY,"\n"); } - - - // if (subframe_rx==9) - // mac_xface->macphy_exit("Why are we exiting here?"); + + // if (subframe_rx==9) + // mac_xface->macphy_exit("Why are we exiting here?"); } else { // decoding successful -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - - ue_send_mch_sdu(ue->Mod_id, - CC_id, - frame_rx, - ue->dlsch_MCH[0]->harq_processes[0]->b, - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, - eNB_id,// not relevant in eMBMS context - sync_area); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ue_send_mch_sdu(ue->Mod_id, + CC_id, + frame_rx, + ue->dlsch_MCH[0]->harq_processes[0]->b, + ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, + eNB_id,// not relevant in eMBMS context + sync_area); - if (mcch_active == 1) - ue->dlsch_mcch_received[sync_area][0]++; - else - ue->dlsch_mtch_received[sync_area][0]++; + if (mcch_active == 1) + ue->dlsch_mcch_received[sync_area][0]++; + else + ue->dlsch_mtch_received[sync_area][0]++; - if (ue->dlsch_mch_received_sf[subframe_rx%5][0] == 1 ) { - ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; - } else { - ue->dlsch_mch_received[0]+=1; - ue->dlsch_mch_received_sf[subframe_rx][0]=1; - } + if (ue->dlsch_mch_received_sf[subframe_rx%5][0] == 1 ) { + ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; + } else { + ue->dlsch_mch_received[0]+=1; + ue->dlsch_mch_received_sf[subframe_rx][0]=1; + } -#endif // #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#endif // #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) } // decoding sucessful } // pmch_mcs>=0 } // is_pmch_subframe=true } -void copy_harq_proc_struct(LTE_DL_UE_HARQ_t *harq_processes_dest, LTE_DL_UE_HARQ_t *current_harq_processes) -{ - harq_processes_dest->B = current_harq_processes->B ; - harq_processes_dest->C = current_harq_processes->C ; - harq_processes_dest->Cminus = current_harq_processes->Cminus ; - harq_processes_dest->Cplus = current_harq_processes->Cplus ; - harq_processes_dest->DCINdi = current_harq_processes->DCINdi ; - harq_processes_dest->F = current_harq_processes->F ; - harq_processes_dest->G = current_harq_processes->G ; - harq_processes_dest->Kminus = current_harq_processes->Kminus ; - harq_processes_dest->Kplus = current_harq_processes->Kplus ; - harq_processes_dest->Nl = current_harq_processes->Nl ; - harq_processes_dest->Qm = current_harq_processes->Qm ; - harq_processes_dest->TBS = current_harq_processes->TBS ; - harq_processes_dest->b = current_harq_processes->b ; - harq_processes_dest->codeword = current_harq_processes->codeword ; - harq_processes_dest->delta_PUCCH = current_harq_processes->delta_PUCCH ; - harq_processes_dest->dl_power_off = current_harq_processes->dl_power_off ; - harq_processes_dest->first_tx = current_harq_processes->first_tx ; - harq_processes_dest->mcs = current_harq_processes->mcs ; - harq_processes_dest->mimo_mode = current_harq_processes->mimo_mode ; - harq_processes_dest->nb_rb = current_harq_processes->nb_rb ; - harq_processes_dest->pmi_alloc = current_harq_processes->pmi_alloc ; - harq_processes_dest->rb_alloc_even[0] = current_harq_processes->rb_alloc_even[0] ; - harq_processes_dest->rb_alloc_even[1] = current_harq_processes->rb_alloc_even[1] ; - harq_processes_dest->rb_alloc_even[2] = current_harq_processes->rb_alloc_even[2] ; - harq_processes_dest->rb_alloc_even[3] = current_harq_processes->rb_alloc_even[3] ; - harq_processes_dest->rb_alloc_odd[0] = current_harq_processes->rb_alloc_odd[0] ; - harq_processes_dest->rb_alloc_odd[1] = current_harq_processes->rb_alloc_odd[1] ; - harq_processes_dest->rb_alloc_odd[2] = current_harq_processes->rb_alloc_odd[2] ; - harq_processes_dest->rb_alloc_odd[3] = current_harq_processes->rb_alloc_odd[3] ; - harq_processes_dest->round = current_harq_processes->round ; - harq_processes_dest->rvidx = current_harq_processes->rvidx ; - harq_processes_dest->status = current_harq_processes->status ; - harq_processes_dest->vrb_type = current_harq_processes->vrb_type ; +void copy_harq_proc_struct(LTE_DL_UE_HARQ_t *harq_processes_dest, LTE_DL_UE_HARQ_t *current_harq_processes) { + harq_processes_dest->B = current_harq_processes->B ; + harq_processes_dest->C = current_harq_processes->C ; + harq_processes_dest->Cminus = current_harq_processes->Cminus ; + harq_processes_dest->Cplus = current_harq_processes->Cplus ; + harq_processes_dest->DCINdi = current_harq_processes->DCINdi ; + harq_processes_dest->F = current_harq_processes->F ; + harq_processes_dest->G = current_harq_processes->G ; + harq_processes_dest->Kminus = current_harq_processes->Kminus ; + harq_processes_dest->Kplus = current_harq_processes->Kplus ; + harq_processes_dest->Nl = current_harq_processes->Nl ; + harq_processes_dest->Qm = current_harq_processes->Qm ; + harq_processes_dest->TBS = current_harq_processes->TBS ; + harq_processes_dest->b = current_harq_processes->b ; + harq_processes_dest->codeword = current_harq_processes->codeword ; + harq_processes_dest->delta_PUCCH = current_harq_processes->delta_PUCCH ; + harq_processes_dest->dl_power_off = current_harq_processes->dl_power_off ; + harq_processes_dest->first_tx = current_harq_processes->first_tx ; + harq_processes_dest->mcs = current_harq_processes->mcs ; + harq_processes_dest->mimo_mode = current_harq_processes->mimo_mode ; + harq_processes_dest->nb_rb = current_harq_processes->nb_rb ; + harq_processes_dest->pmi_alloc = current_harq_processes->pmi_alloc ; + harq_processes_dest->rb_alloc_even[0] = current_harq_processes->rb_alloc_even[0] ; + harq_processes_dest->rb_alloc_even[1] = current_harq_processes->rb_alloc_even[1] ; + harq_processes_dest->rb_alloc_even[2] = current_harq_processes->rb_alloc_even[2] ; + harq_processes_dest->rb_alloc_even[3] = current_harq_processes->rb_alloc_even[3] ; + harq_processes_dest->rb_alloc_odd[0] = current_harq_processes->rb_alloc_odd[0] ; + harq_processes_dest->rb_alloc_odd[1] = current_harq_processes->rb_alloc_odd[1] ; + harq_processes_dest->rb_alloc_odd[2] = current_harq_processes->rb_alloc_odd[2] ; + harq_processes_dest->rb_alloc_odd[3] = current_harq_processes->rb_alloc_odd[3] ; + harq_processes_dest->round = current_harq_processes->round ; + harq_processes_dest->rvidx = current_harq_processes->rvidx ; + harq_processes_dest->status = current_harq_processes->status ; + harq_processes_dest->vrb_type = current_harq_processes->vrb_type ; } -void copy_ack_struct(harq_status_t *harq_ack_dest, harq_status_t *current_harq_ack) -{ - memcpy(harq_ack_dest, current_harq_ack, sizeof(harq_status_t)); +void copy_ack_struct(harq_status_t *harq_ack_dest, harq_status_t *current_harq_ack) { + memcpy(harq_ack_dest, current_harq_ack, sizeof(harq_status_t)); } void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSCH_t pdsch, LTE_UE_DLSCH_t *dlsch0, LTE_UE_DLSCH_t *dlsch1, int s0, int s1, int abstraction_flag) { - int subframe_rx = proc->subframe_rx; int m; int harq_pid; @@ -3305,8 +3005,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC if (dlsch0->active == 0) return; - for (m=s0;m<=s1;m++) { - + for (m=s0; m<=s1; m++) { if (dlsch0 && (!dlsch1)) { harq_pid = dlsch0->current_harq_pid; LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d Symbol %d\n",ue->Mod_id,subframe_rx,harq_pid,m); @@ -3318,15 +3017,11 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC dual_stream_UE = 1; eNB_id_i = ue->n_connected_eNB; i_mod = dlsch0->harq_processes[harq_pid]->Qm; - - } - else if((pdsch==PDSCH) && (ue->transmission_mode[eNB_id]==3)) - { - dual_stream_UE = rx_IC_dual_stream; - eNB_id_i = eNB_id; - i_mod = 0; - } - else { + } else if((pdsch==PDSCH) && (ue->transmission_mode[eNB_id]==3)) { + dual_stream_UE = rx_IC_dual_stream; + eNB_id_i = eNB_id; + i_mod = 0; + } else { dual_stream_UE = 0; eNB_id_i = eNB_id+1; i_mod = 0; @@ -3344,48 +3039,50 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC } if ((m==s0) && (m<4)) - first_symbol_flag = 1; + first_symbol_flag = 1; else - first_symbol_flag = 0; + first_symbol_flag = 0; if (LOG_DEBUGFLAG(UE_TIMING)) { uint8_t slot = 0; + if(m >= ue->frame_parms.symbols_per_tti>>1) - slot = 1; + slot = 1; + start_meas(&ue->dlsch_llr_stats_parallelization[ue->current_thread_id[subframe_rx]][slot]); } + // process DLSCH received in first slot rx_pdsch(ue, - pdsch, - eNB_id, - eNB_id_i, - proc->frame_rx, - subframe_rx, // subframe, - m, - first_symbol_flag, - dual_stream_UE, - i_mod, - dlsch0->current_harq_pid); + pdsch, + eNB_id, + eNB_id_i, + proc->frame_rx, + subframe_rx, // subframe, + m, + first_symbol_flag, + dual_stream_UE, + i_mod, + dlsch0->current_harq_pid); + if (LOG_DEBUGFLAG(UE_TIMING)) { - uint8_t slot = 0; - if(m >= ue->frame_parms.symbols_per_tti>>1) - slot = 1; - stop_meas(&ue->dlsch_llr_stats_parallelization[ue->current_thread_id[subframe_rx]][slot]); - LOG_UI(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",proc->frame_rx,subframe_rx,m,ue->dlsch_llr_stats_parallelization[ue->current_thread_id[subframe_rx]][slot].p_time/(cpuf*1000.0)); + uint8_t slot = 0; + + if(m >= ue->frame_parms.symbols_per_tti>>1) + slot = 1; + + stop_meas(&ue->dlsch_llr_stats_parallelization[ue->current_thread_id[subframe_rx]][slot]); + LOG_I(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",proc->frame_rx,subframe_rx,m,ue->dlsch_llr_stats_parallelization[ue->current_thread_id[subframe_rx]][slot].p_time/(cpuf*1000.0)); } - - - if(first_symbol_flag) - { - proc->first_symbol_available = 1; + if(first_symbol_flag) { + proc->first_symbol_available = 1; } } // CRNTI active } } void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mode, int abstraction_flag) { - int frame_rx = proc->frame_rx; int subframe_rx = proc->subframe_rx; int timing_advance; @@ -3394,99 +3091,85 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo uint8_t *rar; uint8_t next1_thread_id = ue->current_thread_id[subframe_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe_rx]+1); uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); - LOG_D(PHY,"[UE %d][RAPROC] Frame %d subframe %d Received RAR mode %d\n", - ue->Mod_id, - frame_rx, - subframe_rx, ue->UE_mode[eNB_id]); - + ue->Mod_id, + frame_rx, + subframe_rx, ue->UE_mode[eNB_id]); if (ue->mac_enabled == 1) { if ((ue->UE_mode[eNB_id] != PUSCH) && - (ue->prach_resources[eNB_id]->Msg3!=NULL)) { + (ue->prach_resources[eNB_id]->Msg3!=NULL)) { LOG_D(PHY,"[UE %d][RAPROC] Frame %d subframe %d Invoking MAC for RAR (current preamble %d)\n", - ue->Mod_id,frame_rx, - subframe_rx, - ue->prach_resources[eNB_id]->ra_PreambleIndex); - + ue->Mod_id,frame_rx, + subframe_rx, + ue->prach_resources[eNB_id]->ra_PreambleIndex); timing_advance = ue_process_rar(ue->Mod_id, - ue->CC_id, - frame_rx, - ue->prach_resources[eNB_id]->ra_RNTI, - dlsch0->harq_processes[0]->b, - &ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, - ue->prach_resources[eNB_id]->ra_PreambleIndex, - dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload - + ue->CC_id, + frame_rx, + ue->prach_resources[eNB_id]->ra_RNTI, + dlsch0->harq_processes[0]->b, + &ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, + ue->prach_resources[eNB_id]->ra_PreambleIndex, + dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload ue->pdcch_vars[next1_thread_id][eNB_id]->crnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti; ue->pdcch_vars[next2_thread_id][eNB_id]->crnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti; - if (timing_advance!=0xffff) { - - LOG_D(PHY,"[UE %d][RAPROC] Frame %d subframe %d Got rnti %x and timing advance %d from RAR\n", + LOG_D(PHY,"[UE %d][RAPROC] Frame %d subframe %d Got rnti %x and timing advance %d from RAR\n", ue->Mod_id, frame_rx, subframe_rx, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti, timing_advance); + // remember this c-rnti is still a tc-rnti + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti_is_temporary = 1; + //timing_advance = 0; + process_timing_advance_rar(ue,proc,timing_advance); - // remember this c-rnti is still a tc-rnti - - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti_is_temporary = 1; - - //timing_advance = 0; - process_timing_advance_rar(ue,proc,timing_advance); - - if (mode!=debug_prach) { - ue->ulsch_Msg3_active[eNB_id]=1; - get_Msg3_alloc(&ue->frame_parms, - subframe_rx, - frame_rx, - &ue->ulsch_Msg3_frame[eNB_id], - &ue->ulsch_Msg3_subframe[eNB_id]); - - LOG_D(PHY,"[UE %d][RAPROC] Got Msg3_alloc Frame %d subframe %d: Msg3_frame %d, Msg3_subframe %d\n", - ue->Mod_id, - frame_rx, - subframe_rx, - ue->ulsch_Msg3_frame[eNB_id], - ue->ulsch_Msg3_subframe[eNB_id]); - harq_pid = subframe2harq_pid(&ue->frame_parms, - ue->ulsch_Msg3_frame[eNB_id], - ue->ulsch_Msg3_subframe[eNB_id]); - ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; - - ue->UE_mode[eNB_id] = RA_RESPONSE; - // ue->Msg3_timer[eNB_id] = 10; - ue->ulsch[eNB_id]->power_offset = 6; - ue->ulsch_no_allocation_counter[eNB_id] = 0; - } + if (mode!=debug_prach) { + ue->ulsch_Msg3_active[eNB_id]=1; + get_Msg3_alloc(&ue->frame_parms, + subframe_rx, + frame_rx, + &ue->ulsch_Msg3_frame[eNB_id], + &ue->ulsch_Msg3_subframe[eNB_id]); + LOG_D(PHY,"[UE %d][RAPROC] Got Msg3_alloc Frame %d subframe %d: Msg3_frame %d, Msg3_subframe %d\n", + ue->Mod_id, + frame_rx, + subframe_rx, + ue->ulsch_Msg3_frame[eNB_id], + ue->ulsch_Msg3_subframe[eNB_id]); + harq_pid = subframe2harq_pid(&ue->frame_parms, + ue->ulsch_Msg3_frame[eNB_id], + ue->ulsch_Msg3_subframe[eNB_id]); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; + ue->UE_mode[eNB_id] = RA_RESPONSE; + // ue->Msg3_timer[eNB_id] = 10; + ue->ulsch[eNB_id]->power_offset = 6; + ue->ulsch_no_allocation_counter[eNB_id] = 0; + } } else { // PRACH preamble doesn't match RAR - LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match !!!\n", - ue->Mod_id, - ue->prach_resources[eNB_id]->ra_PreambleIndex); + LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match !!!\n", + ue->Mod_id, + ue->prach_resources[eNB_id]->ra_PreambleIndex); } } // mode != PUSCH - } - else { + } else { rar = dlsch0->harq_processes[0]->b+1; timing_advance = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4)); process_timing_advance_rar(ue,proc,timing_advance); } - } void ue_dlsch_procedures(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - int eNB_id, - PDSCH_t pdsch, - LTE_UE_DLSCH_t *dlsch0, - LTE_UE_DLSCH_t *dlsch1, - int *dlsch_errors, - runmode_t mode, - int abstraction_flag) { - + UE_rxtx_proc_t *proc, + int eNB_id, + PDSCH_t pdsch, + LTE_UE_DLSCH_t *dlsch0, + LTE_UE_DLSCH_t *dlsch1, + int *dlsch_errors, + runmode_t mode, + int abstraction_flag) { int harq_pid; int frame_rx = proc->frame_rx; int subframe_rx = proc->subframe_rx; @@ -3497,7 +3180,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, uint8_t is_cw1_active = 0; if (dlsch0==NULL) - AssertFatal(0,"dlsch0 should be defined at this level \n"); + AssertFatal(0,"dlsch0 should be defined at this level \n"); harq_pid = dlsch0->current_harq_pid; is_cw0_active = dlsch0->harq_processes[harq_pid]->status; @@ -3508,329 +3191,332 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, LOG_D(PHY,"AbsSubframe %d.%d Start Turbo Decoder for CW0 [harq_pid %d] ? %d \n", frame_rx%1024, subframe_rx, harq_pid, is_cw0_active); LOG_D(PHY,"AbsSubframe %d.%d Start Turbo Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx%1024, subframe_rx, harq_pid, is_cw1_active); - if(is_cw0_active && is_cw1_active) - { - dlsch0->Kmimo = 2; - dlsch1->Kmimo = 2; - } - else - { - dlsch0->Kmimo = 1; + if(is_cw0_active && is_cw1_active) { + dlsch0->Kmimo = 2; + dlsch1->Kmimo = 2; + } else { + dlsch0->Kmimo = 1; } + if (1) { switch (pdsch) { - case SI_PDSCH: - pdsch_vars = ue->pdsch_vars_SI[eNB_id]; - break; - case RA_PDSCH: - pdsch_vars = ue->pdsch_vars_ra[eNB_id]; - break; - case P_PDSCH: - pdsch_vars = ue->pdsch_vars_p[eNB_id]; - break; - case PDSCH: - pdsch_vars = ue->pdsch_vars[ue->current_thread_id[subframe_rx]][eNB_id]; - break; - case PMCH: - case PDSCH1: - LOG_E(PHY,"Illegal PDSCH %d for ue_pdsch_procedures\n",pdsch); - pdsch_vars = NULL; - return; - break; - default: - pdsch_vars = NULL; - return; - break; + case SI_PDSCH: + pdsch_vars = ue->pdsch_vars_SI[eNB_id]; + break; + case RA_PDSCH: + pdsch_vars = ue->pdsch_vars_ra[eNB_id]; + break; + + case P_PDSCH: + pdsch_vars = ue->pdsch_vars_p[eNB_id]; + break; + + case PDSCH: + pdsch_vars = ue->pdsch_vars[ue->current_thread_id[subframe_rx]][eNB_id]; + break; + + case PMCH: + case PDSCH1: + LOG_E(PHY,"Illegal PDSCH %d for ue_pdsch_procedures\n",pdsch); + pdsch_vars = NULL; + return; + break; + + default: + pdsch_vars = NULL; + return; + break; } + if (frame_rx < *dlsch_errors) *dlsch_errors=0; if (pdsch==RA_PDSCH) { - if (ue->prach_resources[eNB_id]!=NULL) - dlsch0->rnti = ue->prach_resources[eNB_id]->ra_RNTI; + dlsch0->rnti = ue->prach_resources[eNB_id]->ra_RNTI; else { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: FATAL, prach_resources is NULL\n",ue->Mod_id,frame_rx,subframe_rx); - AssertFatal(1==0,"prach_resources is NULL"); + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: FATAL, prach_resources is NULL\n",ue->Mod_id,frame_rx,subframe_rx); + AssertFatal(1==0,"prach_resources is NULL"); } } - - - // start turbo decode for CW 0 - dlsch0->harq_processes[harq_pid]->G = get_G(&ue->frame_parms, - dlsch0->harq_processes[harq_pid]->nb_rb, - dlsch0->harq_processes[harq_pid]->rb_alloc_even, - dlsch0->harq_processes[harq_pid]->Qm, - dlsch0->harq_processes[harq_pid]->Nl, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - frame_rx, - subframe_rx, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); + + // start turbo decode for CW 0 + dlsch0->harq_processes[harq_pid]->G = get_G(&ue->frame_parms, + dlsch0->harq_processes[harq_pid]->nb_rb, + dlsch0->harq_processes[harq_pid]->rb_alloc_even, + dlsch0->harq_processes[harq_pid]->Qm, + dlsch0->harq_processes[harq_pid]->Nl, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + frame_rx, + subframe_rx, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->dlsch_unscrambling_stats); + } + + dlsch_unscrambling(&ue->frame_parms, + 0, + dlsch0, + dlsch0->harq_processes[harq_pid]->G, + pdsch_vars->llr[0], + 0, + subframe_rx<<1); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->dlsch_unscrambling_stats); + } + + LOG_D(PHY," ------ start turbo decoder for AbsSubframe %d.%d / %d ------ \n", frame_rx, subframe_rx, harq_pid); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> nb_rb %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->nb_rb); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> rb_alloc_even %x \n", frame_rx, subframe_rx, harq_pid, + (unsigned int)((intptr_t)dlsch0->harq_processes[harq_pid]->rb_alloc_even)); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Qm %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->Qm); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->Nl); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->G); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->Kmimo); + LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); + } + + ret = dlsch_decoding(ue, + pdsch_vars->llr[0], + &ue->frame_parms, + dlsch0, + dlsch0->harq_processes[harq_pid], + frame_rx, + subframe_rx, + harq_pid, + pdsch==PDSCH?1:0, + dlsch0->harq_processes[harq_pid]->TBS>256?1:0); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, " --> Unscrambling for CW0 %5.3f\n", + (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); + LOG_I(PHY, "AbsSubframe %d.%d --> Turbo Decoding for CW0 %5.3f\n", + frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); + } + + if(is_cw1_active) { + // start turbo decode for CW 1 + dlsch1->harq_processes[harq_pid]->G = get_G(&ue->frame_parms, + dlsch1->harq_processes[harq_pid]->nb_rb, + dlsch1->harq_processes[harq_pid]->rb_alloc_even, + dlsch1->harq_processes[harq_pid]->Qm, + dlsch1->harq_processes[harq_pid]->Nl, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + frame_rx, + subframe_rx, + ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->dlsch_unscrambling_stats); } + dlsch_unscrambling(&ue->frame_parms, - 0, - dlsch0, - dlsch0->harq_processes[harq_pid]->G, - pdsch_vars->llr[0], - 0, - subframe_rx<<1); + 0, + dlsch1, + dlsch1->harq_processes[harq_pid]->G, + pdsch_vars->llr[1], + 1, + subframe_rx<<1); + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->dlsch_unscrambling_stats); } - - LOG_D(PHY," ------ start turbo decoder for AbsSubframe %d.%d / %d ------ \n", frame_rx, subframe_rx, harq_pid); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> nb_rb %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->nb_rb); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> rb_alloc_even %x \n", frame_rx, subframe_rx, harq_pid, (unsigned int)((intptr_t)dlsch0->harq_processes[harq_pid]->rb_alloc_even)); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Qm %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->Qm); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->Nl); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->harq_processes[harq_pid]->G); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, subframe_rx, harq_pid, dlsch0->Kmimo); - LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); - + + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> nb_rb %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->nb_rb); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> rb_alloc_even %x \n", frame_rx, subframe_rx, harq_pid, (uint16_t)((intptr_t)dlsch1->harq_processes[harq_pid]->rb_alloc_even)); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Qm %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->Qm); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->Nl); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->G); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->Kmimo); + LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); } - ret = dlsch_decoding(ue, - pdsch_vars->llr[0], - &ue->frame_parms, - dlsch0, - dlsch0->harq_processes[harq_pid], - frame_rx, - subframe_rx, - harq_pid, - pdsch==PDSCH?1:0, - dlsch0->harq_processes[harq_pid]->TBS>256?1:0); - + + ret1 = dlsch_decoding(ue, + pdsch_vars->llr[1], + &ue->frame_parms, + dlsch1, + dlsch1->harq_processes[harq_pid], + frame_rx, + subframe_rx, + harq_pid, + pdsch==PDSCH?1:0, + dlsch1->harq_processes[harq_pid]->TBS>256?1:0); + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, " --> Unscrambling for CW0 %5.3f\n", - (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); - LOG_UI(PHY, "AbsSubframe %d.%d --> Turbo Decoding for CW0 %5.3f\n", - frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); - + LOG_I(PHY, " --> Unscrambling for CW1 %5.3f\n", + (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); + LOG_I(PHY, "AbsSubframe %d.%d --> Turbo Decoding for CW1 %5.3f\n", + frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); } - if(is_cw1_active) - { - // start turbo decode for CW 1 - dlsch1->harq_processes[harq_pid]->G = get_G(&ue->frame_parms, - dlsch1->harq_processes[harq_pid]->nb_rb, - dlsch1->harq_processes[harq_pid]->rb_alloc_even, - dlsch1->harq_processes[harq_pid]->Qm, - dlsch1->harq_processes[harq_pid]->Nl, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - frame_rx, - subframe_rx, - ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->dlsch_unscrambling_stats); - } - dlsch_unscrambling(&ue->frame_parms, - 0, - dlsch1, - dlsch1->harq_processes[harq_pid]->G, - pdsch_vars->llr[1], - 1, - subframe_rx<<1); - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->dlsch_unscrambling_stats); - } - - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> nb_rb %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->nb_rb); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> rb_alloc_even %x \n", frame_rx, subframe_rx, harq_pid, (uint16_t)((intptr_t)dlsch1->harq_processes[harq_pid]->rb_alloc_even)); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Qm %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->Qm); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->Nl); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->harq_processes[harq_pid]->G); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, subframe_rx, harq_pid, dlsch1->Kmimo); - LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); - - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); - } - - ret1 = dlsch_decoding(ue, - pdsch_vars->llr[1], - &ue->frame_parms, - dlsch1, - dlsch1->harq_processes[harq_pid], - frame_rx, - subframe_rx, - harq_pid, - pdsch==PDSCH?1:0, - dlsch1->harq_processes[harq_pid]->TBS>256?1:0); - - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, " --> Unscrambling for CW1 %5.3f\n", - (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); - LOG_UI(PHY, "AbsSubframe %d.%d --> Turbo Decoding for CW1 %5.3f\n", - frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); - } - LOG_D(PHY,"AbsSubframe %d.%d --> Turbo Decoding for CW1 %5.3f\n", - frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); - } - - LOG_D(PHY," ------ end turbo decoder for AbsSubframe %d.%d ------ \n", frame_rx, subframe_rx); - - + LOG_D(PHY,"AbsSubframe %d.%d --> Turbo Decoding for CW1 %5.3f\n", + frame_rx%1024, subframe_rx,(ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); + } + + LOG_D(PHY," ------ end turbo decoder for AbsSubframe %d.%d ------ \n", frame_rx, subframe_rx); // Check CRC for CW 0 if (ret == (1+dlsch0->max_turbo_iterations)) { *dlsch_errors=*dlsch_errors+1; - if(dlsch0->rnti != 0xffff) - { - - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : DLSCH CW0 in error (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,subframe_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); + if(dlsch0->rnti != 0xffff) { + LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : DLSCH CW0 in error (rv %d,round %d, mcs %d,TBS %d)\n", + ue->Mod_id,dlsch0->rnti, + harq_pid,frame_rx,subframe_rx, + dlsch0->harq_processes[harq_pid]->rvidx, + dlsch0->harq_processes[harq_pid]->round, + dlsch0->harq_processes[harq_pid]->mcs, + dlsch0->harq_processes[harq_pid]->TBS); + } + } else { + if(dlsch0->rnti != 0xffff) { + LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : Received DLSCH CW0 (rv %d,round %d, mcs %d,TBS %d)\n", + ue->Mod_id,dlsch0->rnti, + harq_pid,frame_rx,subframe_rx, + dlsch0->harq_processes[harq_pid]->rvidx, + dlsch0->harq_processes[harq_pid]->round, + dlsch0->harq_processes[harq_pid]->mcs, + dlsch0->harq_processes[harq_pid]->TBS); } - - } else { - if(dlsch0->rnti != 0xffff) - { - LOG_D(PHY,"[UE %d][PDSCH %x/%d] AbsSubframe %d.%d : Received DLSCH CW0 (rv %d,round %d, mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,subframe_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->round, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - } - - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)){ + if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { int j; LOG_D(PHY,"dlsch harq_pid %d (rx): \n",dlsch0->current_harq_pid); for (j=0; jharq_processes[dlsch0->current_harq_pid]->TBS>>3; j++) - LOG_T(PHY,"%x.",dlsch0->harq_processes[dlsch0->current_harq_pid]->b[j]); + LOG_T(PHY,"%x.",dlsch0->harq_processes[dlsch0->current_harq_pid]->b[j]); LOG_T(PHY,"\n"); } - if (ue->mac_enabled == 1) { - - switch (pdsch) { - case PDSCH: - ue_send_sdu(ue->Mod_id, - CC_id, - frame_rx, - subframe_rx, - dlsch0->harq_processes[dlsch0->current_harq_pid]->b, - dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS>>3, - eNB_id); - break; - case SI_PDSCH: - ue_decode_si(ue->Mod_id, - CC_id, - frame_rx, - eNB_id, - ue->dlsch_SI[eNB_id]->harq_processes[0]->b, - ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); - break; - case P_PDSCH: - ue_decode_p(ue->Mod_id, - CC_id, - frame_rx, - eNB_id, - ue->dlsch_SI[eNB_id]->harq_processes[0]->b, - ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); - break; - case RA_PDSCH: - process_rar(ue,proc,eNB_id,mode,abstraction_flag); - break; - case PDSCH1: - LOG_E(PHY,"Shouldn't have PDSCH1 yet, come back later\n"); - AssertFatal(1==0,"exiting"); - break; - case PMCH: - LOG_E(PHY,"Shouldn't have PMCH here\n"); - AssertFatal(1==0,"exiting"); - break; - } - } - ue->total_TBS[eNB_id] = ue->total_TBS[eNB_id] + - dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - ue->total_received_bits[eNB_id] = ue->total_TBS[eNB_id] + - dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; - } - // Check CRC for CW 1 - if(is_cw1_active) - { - if (ret1 == (1+dlsch0->max_turbo_iterations)) { - LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,subframe_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - - } else { - LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n", - ue->Mod_id,dlsch0->rnti, - harq_pid,frame_rx,subframe_rx, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->TBS); - - - if (ue->mac_enabled == 1) { - switch (pdsch) { - case PDSCH: - if(is_cw1_active) - ue_send_sdu(ue->Mod_id, - CC_id, - frame_rx, - subframe_rx, - dlsch1->harq_processes[dlsch1->current_harq_pid]->b, - dlsch1->harq_processes[dlsch1->current_harq_pid]->TBS>>3, - eNB_id); - break; - case SI_PDSCH: - case P_PDSCH: - case RA_PDSCH: - case PDSCH1: - case PMCH: - AssertFatal(0,"exiting"); - break; - } - } + switch (pdsch) { + case PDSCH: + ue_send_sdu(ue->Mod_id, + CC_id, + frame_rx, + subframe_rx, + dlsch0->harq_processes[dlsch0->current_harq_pid]->b, + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS>>3, + eNB_id); + break; + + case SI_PDSCH: + ue_decode_si(ue->Mod_id, + CC_id, + frame_rx, + eNB_id, + ue->dlsch_SI[eNB_id]->harq_processes[0]->b, + ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); + break; + + case P_PDSCH: + ue_decode_p(ue->Mod_id, + CC_id, + frame_rx, + eNB_id, + ue->dlsch_SI[eNB_id]->harq_processes[0]->b, + ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); + break; + + case RA_PDSCH: + process_rar(ue,proc,eNB_id,mode,abstraction_flag); + break; + + case PDSCH1: + LOG_E(PHY,"Shouldn't have PDSCH1 yet, come back later\n"); + AssertFatal(1==0,"exiting"); + break; + + case PMCH: + LOG_E(PHY,"Shouldn't have PMCH here\n"); + AssertFatal(1==0,"exiting"); + break; } } - + + ue->total_TBS[eNB_id] = ue->total_TBS[eNB_id] + + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; + ue->total_received_bits[eNB_id] = ue->total_TBS[eNB_id] + + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS; + } + + // Check CRC for CW 1 + if(is_cw1_active) { + if (ret1 == (1+dlsch0->max_turbo_iterations)) { + LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH CW1 in error (rv %d,mcs %d,TBS %d)\n", + ue->Mod_id,dlsch0->rnti, + harq_pid,frame_rx,subframe_rx, + dlsch0->harq_processes[harq_pid]->rvidx, + dlsch0->harq_processes[harq_pid]->mcs, + dlsch0->harq_processes[harq_pid]->TBS); + } else { + LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH CW1 (rv %d,mcs %d,TBS %d)\n", + ue->Mod_id,dlsch0->rnti, + harq_pid,frame_rx,subframe_rx, + dlsch0->harq_processes[harq_pid]->rvidx, + dlsch0->harq_processes[harq_pid]->mcs, + dlsch0->harq_processes[harq_pid]->TBS); + + if (ue->mac_enabled == 1) { + switch (pdsch) { + case PDSCH: + if(is_cw1_active) + ue_send_sdu(ue->Mod_id, + CC_id, + frame_rx, + subframe_rx, + dlsch1->harq_processes[dlsch1->current_harq_pid]->b, + dlsch1->harq_processes[dlsch1->current_harq_pid]->TBS>>3, + eNB_id); + + break; + + case SI_PDSCH: + case P_PDSCH: + case RA_PDSCH: + case PDSCH1: + case PMCH: + AssertFatal(0,"exiting"); + break; + } + } + } + } + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (mcs %d, rv %d, TBS %d)\n", - ue->Mod_id, - dlsch0->rnti,harq_pid, - frame_rx,subframe_rx,ret, - dlsch0->harq_processes[harq_pid]->mcs, - dlsch0->harq_processes[harq_pid]->rvidx, - dlsch0->harq_processes[harq_pid]->TBS); - + ue->Mod_id, + dlsch0->rnti,harq_pid, + frame_rx,subframe_rx,ret, + dlsch0->harq_processes[harq_pid]->mcs, + dlsch0->harq_processes[harq_pid]->rvidx, + dlsch0->harq_processes[harq_pid]->TBS); + if (frame_rx%100==0) { - LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d dlsch_errors %d, dlsch_received %d, dlsch_fer %d, current_dlsch_cqi %d\n", - ue->Mod_id,dlsch0->rnti, - frame_rx,subframe_rx, - ue->dlsch_errors[eNB_id], - ue->dlsch_received[eNB_id], - ue->dlsch_fer[eNB_id], - ue->measurements.wideband_cqi_tot[eNB_id]); + LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d dlsch_errors %d, dlsch_received %d, dlsch_fer %d, current_dlsch_cqi %d\n", + ue->Mod_id,dlsch0->rnti, + frame_rx,subframe_rx, + ue->dlsch_errors[eNB_id], + ue->dlsch_received[eNB_id], + ue->dlsch_fer[eNB_id], + ue->measurements.wideband_cqi_tot[eNB_id]); } - } /*LOG_DEBUGFLAG(DEBUG_UE_PHYPROC) */ - } - - } /*! @@ -3842,258 +3528,256 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, #ifdef UE_SLOT_PARALLELISATION #define FIFO_PRIORITY 40 void *UE_thread_slot1_dl_processing(void *arg) { + static __thread int UE_dl_slot1_processing_retval; + struct rx_tx_thread_data *rtd = arg; + UE_rxtx_proc_t *proc = rtd->proc; + PHY_VARS_UE *ue = rtd->UE; + int frame_rx; + uint8_t subframe_rx; + uint8_t pilot0; + uint8_t pilot1; + uint8_t slot1; + uint8_t next_subframe_rx; + uint8_t next_subframe_slot0; + proc->instance_cnt_slot1_dl_processing=-1; + proc->subframe_rx=proc->sub_frame_start; + char threadname[256]; + sprintf(threadname,"UE_thread_slot1_dl_processing_%d", proc->sub_frame_start); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); - static __thread int UE_dl_slot1_processing_retval; - struct rx_tx_thread_data *rtd = arg; - UE_rxtx_proc_t *proc = rtd->proc; - PHY_VARS_UE *ue = rtd->UE; + if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.slot1_proc_one != -1 ) + CPU_SET(threads.slot1_proc_one, &cpuset); - int frame_rx; - uint8_t subframe_rx; - uint8_t pilot0; - uint8_t pilot1; - uint8_t slot1; + if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) + CPU_SET(threads.slot1_proc_two, &cpuset); - uint8_t next_subframe_rx; - uint8_t next_subframe_slot0; + if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) + CPU_SET(threads.slot1_proc_three, &cpuset); - proc->instance_cnt_slot1_dl_processing=-1; - proc->subframe_rx=proc->sub_frame_start; + init_thread(900000,1000000, FIFO_PRIORITY-1, &cpuset, + threadname); - char threadname[256]; - sprintf(threadname,"UE_thread_slot1_dl_processing_%d", proc->sub_frame_start); + while (!oai_exit) { + if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE] error locking mutex for UE slot1 dl processing\n" ); + exit_fun("nothing to add"); + } - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.slot1_proc_one != -1 ) - CPU_SET(threads.slot1_proc_one, &cpuset); - if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) - CPU_SET(threads.slot1_proc_two, &cpuset); - if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) - CPU_SET(threads.slot1_proc_three, &cpuset); + while (proc->instance_cnt_slot1_dl_processing < 0) { + // most of the time, the thread is waiting here + pthread_cond_wait( &proc->cond_slot1_dl_processing, &proc->mutex_slot1_dl_processing ); + } - init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset, - threadname); + if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE slot1 dl processing \n" ); + exit_fun("nothing to add"); + } - while (!oai_exit) { - if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE] error locking mutex for UE slot1 dl processing\n" ); - exit_fun("nothing to add"); - } - while (proc->instance_cnt_slot1_dl_processing < 0) { - // most of the time, the thread is waiting here - pthread_cond_wait( &proc->cond_slot1_dl_processing, &proc->mutex_slot1_dl_processing ); - } - if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE slot1 dl processing \n" ); - exit_fun("nothing to add"); - } + /*for(int th_idx=0; th_idx< RX_NB_TH; th_idx++) + { + frame_rx = ue->proc.proc_rxtx[0].frame_rx; + subframe_rx = ue->proc.proc_rxtx[0].subframe_rx; + printf("AbsSubframe %d.%d execute dl slot1 processing \n", frame_rx, subframe_rx); + }*/ + frame_rx = proc->frame_rx; + subframe_rx = proc->subframe_rx; + next_subframe_rx = (1+subframe_rx)%10; + next_subframe_slot0 = next_subframe_rx<<1; + slot1 = (subframe_rx<<1) + 1; + pilot0 = 0; - /*for(int th_idx=0; th_idx< RX_NB_TH; th_idx++) - { - frame_rx = ue->proc.proc_rxtx[0].frame_rx; - subframe_rx = ue->proc.proc_rxtx[0].subframe_rx; - printf("AbsSubframe %d.%d execute dl slot1 processing \n", frame_rx, subframe_rx); - }*/ - frame_rx = proc->frame_rx; - subframe_rx = proc->subframe_rx; - next_subframe_rx = (1+subframe_rx)%10; - next_subframe_slot0 = next_subframe_rx<<1; + //printf("AbsSubframe %d.%d execute dl slot1 processing \n", frame_rx, subframe_rx); - slot1 = (subframe_rx<<1) + 1; - pilot0 = 0; + if (ue->frame_parms.Ncp == 0) { // normal prefix + pilot1 = 4; + } else { // extended prefix + pilot1 = 3; + } - //printf("AbsSubframe %d.%d execute dl slot1 processing \n", frame_rx, subframe_rx); - - if (ue->frame_parms.Ncp == 0) { // normal prefix - pilot1 = 4; - } else { // extended prefix - pilot1 = 3; - } - - /**** Slot1 FE Processing ****/ - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); - } - // I- start dl slot1 processing - // do first symbol of next downlink subframe for channel estimation - /* - // 1- perform FFT for pilot ofdm symbols first (ofdmSym0 next subframe ofdmSym11) - if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) - { - front_end_fft(ue, - pilot0, - next_subframe_slot0, - 0, - 0); - } + /**** Slot1 FE Processing ****/ + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); + } + // I- start dl slot1 processing + // do first symbol of next downlink subframe for channel estimation + /* + // 1- perform FFT for pilot ofdm symbols first (ofdmSym0 next subframe ofdmSym11) + if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) + { front_end_fft(ue, - pilot1, - slot1, - 0, - 0); - */ - // 1- perform FFT - for (int l=1; lframe_parms.symbols_per_tti>>1; l++) - { - //if( (l != pilot0) && (l != pilot1)) - { - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ofdm_demod_stats); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); - //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,l); - front_end_fft(ue, - l, - slot1, - 0, - 0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ofdm_demod_stats); - } - } - } // for l=1..l2 - - if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) - { - //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0); - front_end_fft(ue, - pilot0, - next_subframe_slot0, - 0, - 0); - } - - // 2- perform Channel Estimation for slot1 - for (int l=1; lframe_parms.symbols_per_tti>>1; l++) - { - if(l == pilot1) - { - //wait until channel estimation for pilot0/slot1 is available - uint32_t wait = 0; - while(proc->chan_est_pilot0_slot1_available == 0) - { - usleep(1); - wait++; - } - //printf("[slot1 dl processing] ChanEst symbol %d slot %d wait%d\n",l,slot1,wait); - } - //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,l); - front_end_chanEst(ue, - l, - slot1, - 0); - ue_measurement_procedures(l-1,ue,proc,0,1+(subframe_rx<<1),0,ue->mode); - } - //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0); - front_end_chanEst(ue, pilot0, next_subframe_slot0, + 0, 0); + } - if ( (subframe_rx == 0) && (ue->decode_MIB == 1)) - { - ue_pbch_procedures(0,ue,proc,0); + front_end_fft(ue, + pilot1, + slot1, + 0, + 0); + */ + // 1- perform FFT + for (int l=1; lframe_parms.symbols_per_tti>>1; l++) { + //if( (l != pilot0) && (l != pilot1)) + { + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ofdm_demod_stats); } - proc->chan_est_slot1_available = 1; - //printf("Set available slot 1channelEst to 1 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - //printf(" [slot1 dl processing] ==> FFT/CHanEst Done for AbsSubframe %d.%d \n", proc->frame_rx, proc->subframe_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); + //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,l); + front_end_fft(ue, + l, + slot1, + 0, + 0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - //printf(" [slot1 dl processing] ==> Start LLR Comuptation slot1 for AbsSubframe %d.%d \n", proc->frame_rx, proc->subframe_rx); + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ofdm_demod_stats); + } + } + } // for l=1..l2 + if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) { + //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0); + front_end_fft(ue, + pilot0, + next_subframe_slot0, + 0, + 0); + } - if ( LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); - LOG_UI(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); + // 2- perform Channel Estimation for slot1 + for (int l=1; lframe_parms.symbols_per_tti>>1; l++) { + if(l == pilot1) { + //wait until channel estimation for pilot0/slot1 is available + uint32_t wait = 0; + + while(proc->chan_est_pilot0_slot1_available == 0) { + usleep(1); + wait++; } + //printf("[slot1 dl processing] ChanEst symbol %d slot %d wait%d\n",l,slot1,wait); + } + + //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,l); + front_end_chanEst(ue, + l, + slot1, + 0); + ue_measurement_procedures(l-1,ue,proc,0,1+(subframe_rx<<1),0,ue->mode); + } + + //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,next_subframe_slot0,pilot0); + front_end_chanEst(ue, + pilot0, + next_subframe_slot0, + 0); + + if ( (subframe_rx == 0) && (ue->decode_MIB == 1)) { + ue_pbch_procedures(0,ue,proc,0); + } + + proc->chan_est_slot1_available = 1; + //printf("Set available slot 1channelEst to 1 AbsSubframe %d.%d \n",frame_rx,subframe_rx); + //printf(" [slot1 dl processing] ==> FFT/CHanEst Done for AbsSubframe %d.%d \n", proc->frame_rx, proc->subframe_rx); + + //printf(" [slot1 dl processing] ==> Start LLR Comuptation slot1 for AbsSubframe %d.%d \n", proc->frame_rx, proc->subframe_rx); + + if ( LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); + LOG_I(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); + } //wait until pdcch is decoded uint32_t wait = 0; - while(proc->dci_slot0_available == 0) - { - usleep(1); - wait++; - } - //printf("[slot1 dl processing] AbsSubframe %d.%d LLR Computation Start wait DCI %d\n",frame_rx,subframe_rx,wait); + while(proc->dci_slot0_available == 0) { + usleep(1); + wait++; + } + + //printf("[slot1 dl processing] AbsSubframe %d.%d LLR Computation Start wait DCI %d\n",frame_rx,subframe_rx,wait); /**** Pdsch Procedure Slot1 ****/ // start slot1 thread for Pdsch Procedure (slot1) // do procedures for C-RNTI //printf("AbsSubframe %d.%d Pdsch Procedure (slot1)\n",frame_rx,subframe_rx); - if ( LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); } + // start slave thread for Pdsch Procedure (slot1) // do procedures for C-RNTI uint8_t eNB_id = 0; uint8_t abstraction_flag = 0; - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { - //wait until first ofdm symbol is processed - //wait = 0; - //while(proc->first_symbol_available == 0) - //{ - // usleep(1); - // wait++; - //} - //printf("[slot1 dl processing] AbsSubframe %d.%d LLR Computation Start wait First Ofdm Sym %d\n",frame_rx,subframe_rx,wait); - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - ue_pdsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - NULL, - (ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); - LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); - LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { + //wait until first ofdm symbol is processed + //wait = 0; + //while(proc->first_symbol_available == 0) + //{ + // usleep(1); + // wait++; + //} + //printf("[slot1 dl processing] AbsSubframe %d.%d LLR Computation Start wait First Ofdm Sym %d\n",frame_rx,subframe_rx,wait); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + ue_pdsch_procedures(ue, + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + NULL, + (ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); + LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); } // do procedures for SI-RNTI if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { - ue_pdsch_procedures(ue, - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - (ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); + ue_pdsch_procedures(ue, + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + (ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); } // do procedures for P-RNTI if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { - ue_pdsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - (ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); + ue_pdsch_procedures(ue, + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + (ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); } + // do procedures for RA-RNTI if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { - ue_pdsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - (ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); + ue_pdsch_procedures(ue, + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + (ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); } proc->llr_slot1_available=1; @@ -4101,571 +3785,81 @@ void *UE_thread_slot1_dl_processing(void *arg) { if ( LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); - LOG_UI(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); } - - if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); - exit_fun("noting to add"); - } - proc->instance_cnt_slot1_dl_processing--; - if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE FEP Slo1\n" ); - exit_fun("noting to add"); - } + if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); + exit_fun("noting to add"); } - // thread finished - free(arg); - return &UE_dl_slot1_processing_retval; + + proc->instance_cnt_slot1_dl_processing--; + + if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE FEP Slo1\n" ); + exit_fun("noting to add"); + } + } + + // thread finished + free(arg); + return &UE_dl_slot1_processing_retval; } #endif #ifdef UE_SLOT_PARALLELISATION int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, - uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { - - int l,l2; - int pmch_flag=0; - int frame_rx = proc->frame_rx; - int subframe_rx = proc->subframe_rx; - uint8_t pilot0; - uint8_t pilot1; - uint8_t slot0; - uint8_t slot1; - uint8_t first_ofdm_sym; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - - - T(T_UE_PHY_DL_TICK, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx)); - - T(T_UE_PHY_INPUT_SIGNAL, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(0), - T_BUFFER(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti * 4)); - - - // start timers - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); - } - - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); - start_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); - } - - pmch_flag = is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) ? 1 : 0; - - if (do_pdcch_flag) { - // deactivate reception until we scan pdcch - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]) - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active = 0; - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]) - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]->active = 0; - - if (ue->dlsch_SI[eNB_id]) - ue->dlsch_SI[eNB_id]->active = 0; - if (ue->dlsch_p[eNB_id]) - ue->dlsch_p[eNB_id]->active = 0; - if (ue->dlsch_ra[eNB_id]) - ue->dlsch_ra[eNB_id]->active = 0; - } - - if ( LOG_DEBUG_FLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", - ue->Mod_id,frame_rx, subframe_rx); - } - - - - - if (subframe_select(&ue->frame_parms,subframe_rx) == SF_S) { // S-subframe, do first 5 symbols only - l2 = 4; - } else if (pmch_flag == 1) { // do first 2 symbols only - l2 = 1; - } else { // normal subframe, last symbol to be processed is the first of the second slot - l2 = (ue->frame_parms.symbols_per_tti/2)-1; - } - - int prev_subframe_rx = (subframe_rx - 1)<0? 9: (subframe_rx - 1); - if (subframe_select(&ue->frame_parms,prev_subframe_rx) != SF_DL) { - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - // RX processing of symbols l=0...l2 - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - first_ofdm_sym = 0; - } else { - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - // RX processing of symbols l=1...l2 (l=0 is done in last scheduling epoch) - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - first_ofdm_sym = 1; - } - slot0 = (subframe_rx<<1); - slot1 = (subframe_rx<<1) + 1; - pilot0 = 0; - if (ue->frame_parms.Ncp == 0) { // normal prefix - pilot1 = 4; - } else { // extended prefix - pilot1 = 3; - } - - //LOG_I(PHY,"Set available channelEst to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - //LOG_I(PHY,"Set available llrs slot1 to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - //LOG_I(PHY,"Set available dci info slot0 to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - proc->chan_est_pilot0_slot1_available=0; - proc->llr_slot1_available=0; - proc->dci_slot0_available=0; - proc->first_symbol_available=0; - proc->chan_est_slot1_available=0; - //proc->channel_level=0; - - if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE %d][Slot0] error locking mutex for UE slot1 dl processing\n",ue->Mod_id ); - exit_fun("nothing to add"); - } - - proc->instance_cnt_slot1_dl_processing++; - if (proc->instance_cnt_slot1_dl_processing == 0) - { - LOG_D(PHY,"unblock slot1 dl processing thread blocked on instance_cnt_slot1_dl_processing : %d \n", proc->instance_cnt_slot1_dl_processing ); - if (pthread_cond_signal(&proc->cond_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE %d][Slot0] ERROR pthread_cond_signal for UE slot1 processing thread\n", ue->Mod_id); - exit_fun("nothing to add"); - } - if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { - LOG_E( PHY, "[SCHED][UE %d][Slot0] error unlocking mutex for UE slot1 dl processing \n",ue->Mod_id ); - exit_fun("nothing to add"); - } - - } else - { - LOG_E( PHY, "[SCHED][UE %d] UE RX thread busy (IC %d)!!\n", ue->Mod_id, proc->instance_cnt_slot1_dl_processing); - if (proc->instance_cnt_slot1_dl_processing > 2) - exit_fun("instance_cnt_slot1_dl_processing > 2"); - } - //AssertFatal(pthread_cond_signal(&proc->cond_slot1_dl_processing) ==0 ,""); - AssertFatal(pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) ==0,""); - - - /**** Slot0 FE Processing ****/ - // I- start main thread for FFT/ChanEst symbol: 0/1 --> 7 - if ( LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); - } - // 1- perform FFT for pilot ofdm symbols first (ofdmSym7 ofdmSym4 or (ofdmSym6 ofdmSym3)) - //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,pilot0); - front_end_fft(ue, - pilot0, - slot1, - 0, - 0); - //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,pilot1); - front_end_fft(ue, - pilot1, - slot0, - 0, - 0); - //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,pilot1); - front_end_chanEst(ue, - pilot1, - slot0, - 0); - //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,pilot0); - front_end_chanEst(ue, - pilot0, - slot1, - 0); - proc->chan_est_pilot0_slot1_available = 1; - //printf("Set available channelEst to 1 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - - // 2- perform FFT for other ofdm symbols other than pilots - for (l=first_ofdm_sym; l<=l2; l++) - { - if( (l != pilot0) && (l != pilot1)) - { - //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,l); - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ofdm_demod_stats); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); - front_end_fft(ue, - l, - slot0, - 0, - 0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ofdm_demod_stats); - } - } - } // for l=1..l2 - - // 3- perform Channel Estimation for slot0 - for (l=first_ofdm_sym; l<=l2; l++) - { - if( (l != pilot0) && (l != pilot1)) - { - //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,l); - front_end_chanEst(ue, - l, - slot0, - 0); - } - ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode); - } - - if (do_pdcch_flag) { - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); - } - if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { - LOG_UI(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - } - - //proc->dci_slot0_available = 1; - return(-1); - } - //proc->dci_slot0_available=1; - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - } - } - - //printf("num_pdcch_symbols %d\n",ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); - - // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); - LOG_UI(PHY, "[AbsSFN %d.%d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); - } - - //wait until slot1 FE is done - uint32_t wait = 0; - while(proc->chan_est_slot1_available == 0) - { - usleep(1); - wait++; - } - - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "[AbsSFN %d.%d] FULL FE Processing %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); - } - /**** End Subframe FE Processing ****/ - - - //Trigger LLR parallelized for Slot 1 - //proc->dci_slot0_available=1; - //printf("Set available dci slot0 to 1 AbsSubframe %d.%d \n",frame_rx%1024,subframe_rx); - - /**** Pdsch Procedure Slot0 ****/ - // start main thread for Pdsch Procedure (slot0) - // do procedures for C-RNTI - //printf("AbsSubframe %d.%d Pdsch Procedure (slot0)\n",frame_rx%1024,subframe_rx); - //printf("AbsSubframe %d.%d Pdsch Procedure PDSCH Active %d \n",frame_rx%1024,subframe_rx, ue->dlsch[ue->current_thread_id[subframe_rx]][0][0]->active); - - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); - } - - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); - } - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - ue_pdsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - (ue->frame_parms.symbols_per_tti>>1)-1, - abstraction_flag); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); - } - - // do procedures for SI-RNTI - if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); - ue_pdsch_procedures(ue, - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - (ue->frame_parms.symbols_per_tti>>1)-1, - abstraction_flag); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); - } - - // do procedures for SI-RNTI - if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); - ue_pdsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - (ue->frame_parms.symbols_per_tti>>1)-1, - abstraction_flag); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); - } - - // do procedures for RA-RNTI - if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); - ue_pdsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - (ue->frame_parms.symbols_per_tti>>1)-1, - abstraction_flag); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); - } - - // LLR linear - proc->dci_slot0_available=1; - //printf("Set available dci slot0 to 1 AbsSubframe %d.%d \n",frame_rx%1024,subframe_rx); - - - if (LOG_DEBUGFLAG(UE_TIMING)){ - stop_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); - LOG_UI(PHY, "[AbsSFN %d.%d] Slot0: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); - } - - - //wait until LLR Slot1 is done - wait = 0; - while(proc->llr_slot1_available == 0) - { - usleep(1); - wait++; - } - - - - if (LOG_DEBUGFLAG(UE_TIMING)){ - stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "[AbsSFN %d.%d] Full LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - } - - - //=====================================================================// - if (LOG_DEBUGFLAG(UE_TIMING)){ - start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); - } - - LOG_D(PHY,"==> Start Turbo Decoder active dlsch %d SI %d RA %d \n",ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active, - ue->dlsch_SI[eNB_id]->active, - //ue->dlsch_p[eNB_id]->active, - ue->dlsch_ra[eNB_id]->active); - // Start Turbo decoder - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - ue_dlsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1], - &ue->dlsch_errors[eNB_id], - mode, - abstraction_flag); - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); - } - - // do procedures for SI-RNTI - if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { - ue_dlsch_procedures(ue, - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - &ue->dlsch_SI_errors[eNB_id], - mode, - abstraction_flag); - ue->dlsch_SI[eNB_id]->active = 0; - } - - // do procedures for P-RNTI - if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { - ue_dlsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - &ue->dlsch_p_errors[eNB_id], - mode, - abstraction_flag); - ue->dlsch_p[eNB_id]->active = 0; - } - // do procedures for RA-RNTI - if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { - ue_dlsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - &ue->dlsch_ra_errors[eNB_id], - mode, - abstraction_flag); - ue->dlsch_ra[eNB_id]->active = 0; - } - - if (LOG_DEBUGFLAG(UE_TIMING) - stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "[AbsSFN %d.%d] Channel Decoder: %5.2f \n",frame_rx,subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - } - - // duplicate harq structure - uint8_t current_harq_pid = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid; - LTE_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[current_harq_pid]; - harq_status_t *current_harq_ack = &ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_ack[subframe_rx]; - - // For Debug parallelisation - //if (current_harq_ack->ack == 0) { - //printf("[slot0 dl processing][End of Channel Decoding] AbsSubframe %d.%d Decode Fail for HarqId%d Round%d\n",frame_rx,subframe_rx,current_harq_pid,current_harq_processes->round); - //} - for(uint8_t rx_th_idx=1; rx_th_idxdlsch[ue->current_thread_id[(subframe_rx+rx_th_idx)%10]][eNB_id][0]->harq_processes[current_harq_pid]; - harq_status_t *harq_ack_dest = &ue->dlsch[ue->current_thread_id[(subframe_rx+rx_th_idx)%10]][eNB_id][0]->harq_ack[subframe_rx]; - - copy_harq_proc_struct(harq_processes_dest, current_harq_processes); - copy_ack_struct(harq_ack_dest, current_harq_ack); - - } - /* - LTE_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[(subframe_rx+1)%RX_NB_TH][eNB_id][0]->harq_processes[current_harq_pid]; - LTE_DL_UE_HARQ_t *harq_processes_dest1 = ue->dlsch[(subframe_rx+2)%RX_NB_TH][eNB_id][0]->harq_processes[current_harq_pid]; - - harq_status_t *current_harq_ack = &ue->dlsch[subframe_rx%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; - harq_status_t *harq_ack_dest = &ue->dlsch[(subframe_rx+1)%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; - harq_status_t *harq_ack_dest1 = &ue->dlsch[(subframe_rx+2)%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; - - copy_harq_proc_struct(harq_processes_dest, current_harq_processes); - copy_ack_struct(harq_ack_dest, current_harq_ack); - - copy_harq_proc_struct(harq_processes_dest1, current_harq_processes); - copy_ack_struct(harq_ack_dest1, current_harq_ack); - */ - if (subframe_rx==9) { - if (frame_rx % 10 == 0) { - if ((ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]) != 0) - ue->dlsch_fer[eNB_id] = (100*(ue->dlsch_errors[eNB_id] - ue->dlsch_errors_last[eNB_id]))/(ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]); - - ue->dlsch_errors_last[eNB_id] = ue->dlsch_errors[eNB_id]; - ue->dlsch_received_last[eNB_id] = ue->dlsch_received[eNB_id]; - } - - - ue->bitrate[eNB_id] = (ue->total_TBS[eNB_id] - ue->total_TBS_last[eNB_id])*100; - ue->total_TBS_last[eNB_id] = ue->total_TBS[eNB_id]; - LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", - ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], - ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); - -#if UE_AUTOTEST_TRACE - if ((frame_rx % 100 == 0)) { - LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); - } -#endif - - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); - - if (LOG_DEBUGFLAG(UE_TIMING)){ - stop_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "------FULL RX PROC [AbsSFN %d.%d]: %5.2f ------\n",frame_rx,subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - } - - LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); - return (0); -} -#endif /*UE_SLOT_PARALLELISATION */ - - -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, - uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { - + uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { int l,l2; - int pilot1; int pmch_flag=0; int frame_rx = proc->frame_rx; int subframe_rx = proc->subframe_rx; - - uint8_t next1_thread_id = ue->current_thread_id[subframe_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe_rx]+1); - uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); - + uint8_t pilot0; + uint8_t pilot1; + uint8_t slot0; + uint8_t slot1; + uint8_t first_ofdm_sym; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - - T(T_UE_PHY_DL_TICK, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx)); - T(T_UE_PHY_INPUT_SIGNAL, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(0), T_BUFFER(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti], ue->frame_parms.samples_per_tti * 4)); - // start timers - if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_I(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); } - if(LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); - start_meas(&ue->generic_stat); + start_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); } pmch_flag = is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) ? 1 : 0; if (do_pdcch_flag) { - // deactivate reception until we scan pdcch - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]) - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active = 0; - if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]) - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]->active = 0; + // deactivate reception until we scan pdcch + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]) + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active = 0; - if (ue->dlsch_SI[eNB_id]) - ue->dlsch_SI[eNB_id]->active = 0; - if (ue->dlsch_p[eNB_id]) - ue->dlsch_p[eNB_id]->active = 0; - if (ue->dlsch_ra[eNB_id]) - ue->dlsch_ra[eNB_id]->active = 0; + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]) + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]->active = 0; + + if (ue->dlsch_SI[eNB_id]) + ue->dlsch_SI[eNB_id]->active = 0; + + if (ue->dlsch_p[eNB_id]) + ue->dlsch_p[eNB_id]->active = 0; + + if (ue->dlsch_ra[eNB_id]) + ue->dlsch_ra[eNB_id]->active = 0; } - if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { - LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", - ue->Mod_id,frame_rx, subframe_rx); + if ( LOG_DEBUG_FLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", + ue->Mod_id,frame_rx, subframe_rx); } - if (ue->frame_parms.Ncp == 0) { // normal prefix - pilot1 = 4; - } else { // extended prefix - pilot1 = 3; - } - - if (subframe_select(&ue->frame_parms,subframe_rx) == SF_S) { // S-subframe, do first 5 symbols only l2 = 4; } else if (pmch_flag == 1) { // do first 2 symbols only @@ -4675,6 +3869,488 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, } int prev_subframe_rx = (subframe_rx - 1)<0? 9: (subframe_rx - 1); + + if (subframe_select(&ue->frame_parms,prev_subframe_rx) != SF_DL) { + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // RX processing of symbols l=0...l2 + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + first_ofdm_sym = 0; + } else { + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // RX processing of symbols l=1...l2 (l=0 is done in last scheduling epoch) + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + first_ofdm_sym = 1; + } + + slot0 = (subframe_rx<<1); + slot1 = (subframe_rx<<1) + 1; + pilot0 = 0; + + if (ue->frame_parms.Ncp == 0) { // normal prefix + pilot1 = 4; + } else { // extended prefix + pilot1 = 3; + } + + //LOG_I(PHY,"Set available channelEst to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); + //LOG_I(PHY,"Set available llrs slot1 to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); + //LOG_I(PHY,"Set available dci info slot0 to 0 AbsSubframe %d.%d \n",frame_rx,subframe_rx); + proc->chan_est_pilot0_slot1_available=0; + proc->llr_slot1_available=0; + proc->dci_slot0_available=0; + proc->first_symbol_available=0; + proc->chan_est_slot1_available=0; + //proc->channel_level=0; + + if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE %d][Slot0] error locking mutex for UE slot1 dl processing\n",ue->Mod_id ); + exit_fun("nothing to add"); + } + + proc->instance_cnt_slot1_dl_processing++; + + if (proc->instance_cnt_slot1_dl_processing == 0) { + LOG_D(PHY,"unblock slot1 dl processing thread blocked on instance_cnt_slot1_dl_processing : %d \n", proc->instance_cnt_slot1_dl_processing ); + + if (pthread_cond_signal(&proc->cond_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE %d][Slot0] ERROR pthread_cond_signal for UE slot1 processing thread\n", ue->Mod_id); + exit_fun("nothing to add"); + } + + if (pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) != 0) { + LOG_E( PHY, "[SCHED][UE %d][Slot0] error unlocking mutex for UE slot1 dl processing \n",ue->Mod_id ); + exit_fun("nothing to add"); + } + } else { + LOG_E( PHY, "[SCHED][UE %d] UE RX thread busy (IC %d)!!\n", ue->Mod_id, proc->instance_cnt_slot1_dl_processing); + + if (proc->instance_cnt_slot1_dl_processing > 2) + exit_fun("instance_cnt_slot1_dl_processing > 2"); + } + + //AssertFatal(pthread_cond_signal(&proc->cond_slot1_dl_processing) ==0 ,""); + AssertFatal(pthread_mutex_unlock(&proc->mutex_slot1_dl_processing) ==0,""); + + /**** Slot0 FE Processing ****/ + // I- start main thread for FFT/ChanEst symbol: 0/1 --> 7 + if ( LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); + } + + // 1- perform FFT for pilot ofdm symbols first (ofdmSym7 ofdmSym4 or (ofdmSym6 ofdmSym3)) + //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,pilot0); + front_end_fft(ue, + pilot0, + slot1, + 0, + 0); + //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,pilot1); + front_end_fft(ue, + pilot1, + slot0, + 0, + 0); + //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,pilot1); + front_end_chanEst(ue, + pilot1, + slot0, + 0); + //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot1,pilot0); + front_end_chanEst(ue, + pilot0, + slot1, + 0); + proc->chan_est_pilot0_slot1_available = 1; + //printf("Set available channelEst to 1 AbsSubframe %d.%d \n",frame_rx,subframe_rx); + + // 2- perform FFT for other ofdm symbols other than pilots + for (l=first_ofdm_sym; l<=l2; l++) { + if( (l != pilot0) && (l != pilot1)) { + //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,l); + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ofdm_demod_stats); + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); + front_end_fft(ue, + l, + slot0, + 0, + 0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ofdm_demod_stats); + } + } + } // for l=1..l2 + + // 3- perform Channel Estimation for slot0 + for (l=first_ofdm_sym; l<=l2; l++) { + if( (l != pilot0) && (l != pilot1)) { + //printf("AbsSubframe %d.%d ChanEst slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,l); + front_end_chanEst(ue, + l, + slot0, + 0); + } + + ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode); + } + + if (do_pdcch_flag) { + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); + } + + if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) { + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + LOG_I(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + } + + //proc->dci_slot0_available = 1; + return(-1); + } + + //proc->dci_slot0_available=1; + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + } + } + + //printf("num_pdcch_symbols %d\n",ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + + // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); + LOG_I(PHY, "[AbsSFN %d.%d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",frame_rx,subframe_rx, + ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); + } + + //wait until slot1 FE is done + uint32_t wait = 0; + + while(proc->chan_est_slot1_available == 0) { + usleep(1); + wait++; + } + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "[AbsSFN %d.%d] FULL FE Processing %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); + } + + /**** End Subframe FE Processing ****/ + + //Trigger LLR parallelized for Slot 1 + //proc->dci_slot0_available=1; + //printf("Set available dci slot0 to 1 AbsSubframe %d.%d \n",frame_rx%1024,subframe_rx); + + /**** Pdsch Procedure Slot0 ****/ + // start main thread for Pdsch Procedure (slot0) + // do procedures for C-RNTI + //printf("AbsSubframe %d.%d Pdsch Procedure (slot0)\n",frame_rx%1024,subframe_rx); + //printf("AbsSubframe %d.%d Pdsch Procedure PDSCH Active %d \n",frame_rx%1024,subframe_rx, ue->dlsch[ue->current_thread_id[subframe_rx]][0][0]->active); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); + } + + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); + } + + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + ue_pdsch_procedures(ue, + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + (ue->frame_parms.symbols_per_tti>>1)-1, + abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + } + + // do procedures for SI-RNTI + if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); + ue_pdsch_procedures(ue, + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + (ue->frame_parms.symbols_per_tti>>1)-1, + abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); + } + + // do procedures for SI-RNTI + if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); + ue_pdsch_procedures(ue, + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + (ue->frame_parms.symbols_per_tti>>1)-1, + abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); + } + + // do procedures for RA-RNTI + if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); + ue_pdsch_procedures(ue, + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + (ue->frame_parms.symbols_per_tti>>1)-1, + abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); + } + + // LLR linear + proc->dci_slot0_available=1; + //printf("Set available dci slot0 to 1 AbsSubframe %d.%d \n",frame_rx%1024,subframe_rx); + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); + LOG_I(PHY, "[AbsSFN %d.%d] Slot0: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); + } + + //wait until LLR Slot1 is done + wait = 0; + + while(proc->llr_slot1_available == 0) { + usleep(1); + wait++; + } + + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "[AbsSFN %d.%d] Full LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + } + + //=====================================================================// + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); + } + + LOG_D(PHY,"==> Start Turbo Decoder active dlsch %d SI %d RA %d \n",ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active, + ue->dlsch_SI[eNB_id]->active, + //ue->dlsch_p[eNB_id]->active, + ue->dlsch_ra[eNB_id]->active); + + // Start Turbo decoder + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + ue_dlsch_procedures(ue, + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1], + &ue->dlsch_errors[eNB_id], + mode, + abstraction_flag); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + } + + // do procedures for SI-RNTI + if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { + ue_dlsch_procedures(ue, + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + &ue->dlsch_SI_errors[eNB_id], + mode, + abstraction_flag); + ue->dlsch_SI[eNB_id]->active = 0; + } + + // do procedures for P-RNTI + if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { + ue_dlsch_procedures(ue, + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + &ue->dlsch_p_errors[eNB_id], + mode, + abstraction_flag); + ue->dlsch_p[eNB_id]->active = 0; + } + + // do procedures for RA-RNTI + if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { + ue_dlsch_procedures(ue, + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + &ue->dlsch_ra_errors[eNB_id], + mode, + abstraction_flag); + ue->dlsch_ra[eNB_id]->active = 0; + } + + if (LOG_DEBUGFLAG(UE_TIMING) + stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "[AbsSFN %d.%d] Channel Decoder: %5.2f \n",frame_rx,subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); +} + +// duplicate harq structure +uint8_t current_harq_pid = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid; +LTE_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[current_harq_pid]; +harq_status_t *current_harq_ack = &ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_ack[subframe_rx]; + +// For Debug parallelisation +//if (current_harq_ack->ack == 0) { +//printf("[slot0 dl processing][End of Channel Decoding] AbsSubframe %d.%d Decode Fail for HarqId%d Round%d\n",frame_rx,subframe_rx,current_harq_pid,current_harq_processes->round); +//} +for(uint8_t rx_th_idx=1; rx_th_idxdlsch[ue->current_thread_id[(subframe_rx+rx_th_idx)%10]][eNB_id][0]->harq_processes[current_harq_pid]; + harq_status_t *harq_ack_dest = &ue->dlsch[ue->current_thread_id[(subframe_rx+rx_th_idx)%10]][eNB_id][0]->harq_ack[subframe_rx]; + copy_harq_proc_struct(harq_processes_dest, current_harq_processes); + copy_ack_struct(harq_ack_dest, current_harq_ack); +} + +/* +LTE_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[(subframe_rx+1)%RX_NB_TH][eNB_id][0]->harq_processes[current_harq_pid]; +LTE_DL_UE_HARQ_t *harq_processes_dest1 = ue->dlsch[(subframe_rx+2)%RX_NB_TH][eNB_id][0]->harq_processes[current_harq_pid]; + +harq_status_t *current_harq_ack = &ue->dlsch[subframe_rx%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; +harq_status_t *harq_ack_dest = &ue->dlsch[(subframe_rx+1)%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; +harq_status_t *harq_ack_dest1 = &ue->dlsch[(subframe_rx+2)%RX_NB_TH][eNB_id][0]->harq_ack[subframe_rx]; + +copy_harq_proc_struct(harq_processes_dest, current_harq_processes); +copy_ack_struct(harq_ack_dest, current_harq_ack); + +copy_harq_proc_struct(harq_processes_dest1, current_harq_processes); +copy_ack_struct(harq_ack_dest1, current_harq_ack); +*/ +if (subframe_rx==9) { + if (frame_rx % 10 == 0) { + if ((ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]) != 0) + ue->dlsch_fer[eNB_id] = (100*(ue->dlsch_errors[eNB_id] - ue->dlsch_errors_last[eNB_id]))/(ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]); + + ue->dlsch_errors_last[eNB_id] = ue->dlsch_errors[eNB_id]; + ue->dlsch_received_last[eNB_id] = ue->dlsch_received[eNB_id]; + } + + ue->bitrate[eNB_id] = (ue->total_TBS[eNB_id] - ue->total_TBS_last[eNB_id])*100; + ue->total_TBS_last[eNB_id] = ue->total_TBS[eNB_id]; + LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", + ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], + ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); +#if UE_AUTOTEST_TRACE + + if ((frame_rx % 100 == 0)) { + LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); + } + +#endif +} + +VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); + +if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "------FULL RX PROC [AbsSFN %d.%d]: %5.2f ------\n",frame_rx,subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); +} + +LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); +return (0); +} +#endif /*UE_SLOT_PARALLELISATION */ + + +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, + uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { + int l,l2; + int pilot1; + int pmch_flag=0; + int frame_rx = proc->frame_rx; + int subframe_rx = proc->subframe_rx; + uint8_t next1_thread_id = ue->current_thread_id[subframe_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe_rx]+1); + uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); + T(T_UE_PHY_DL_TICK, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx)); + T(T_UE_PHY_INPUT_SIGNAL, T_INT(ue->Mod_id), T_INT(frame_rx%1024), T_INT(subframe_rx), T_INT(0), + T_BUFFER(&ue->common_vars.rxdata[0][subframe_rx*ue->frame_parms.samples_per_tti], + ue->frame_parms.samples_per_tti * 4)); + + // start timers + if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_I(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); + } + + if(LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); + start_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); + } + + pmch_flag = is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) ? 1 : 0; + + if (do_pdcch_flag) { + // deactivate reception until we scan pdcch + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]) + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active = 0; + + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]) + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1]->active = 0; + + if (ue->dlsch_SI[eNB_id]) + ue->dlsch_SI[eNB_id]->active = 0; + + if (ue->dlsch_p[eNB_id]) + ue->dlsch_p[eNB_id]->active = 0; + + if (ue->dlsch_ra[eNB_id]) + ue->dlsch_ra[eNB_id]->active = 0; + } + + if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { + LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", + ue->Mod_id,frame_rx, subframe_rx); + } + + if (ue->frame_parms.Ncp == 0) { // normal prefix + pilot1 = 4; + } else { // extended prefix + pilot1 = 3; + } + + if (subframe_select(&ue->frame_parms,subframe_rx) == SF_S) { // S-subframe, do first 5 symbols only + l2 = 4; + } else if (pmch_flag == 1) { // do first 2 symbols only + l2 = 1; + } else { // normal subframe, last symbol to be processed is the first of the second slot + l2 = (ue->frame_parms.symbols_per_tti/2)-1; + } + + int prev_subframe_rx = (subframe_rx - 1)<0? 9: (subframe_rx - 1); + if (subframe_select(&ue->frame_parms,prev_subframe_rx) != SF_DL) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // RX processing of symbols l=0...l2 @@ -4689,115 +4365,122 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, LOG_D(PHY," ------ slot 0 Processing: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); LOG_D(PHY," ------ --> FFT/ChannelEst/PDCCH slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + for (; l<=l2; l++) { if (abstraction_flag == 0) { - if (LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->ofdm_demod_stats); - } + if (LOG_DEBUGFLAG(UE_TIMING)) { + start_meas(&ue->ofdm_demod_stats); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); slot_fep(ue, - l, - (subframe_rx<<1), - 0, - 0, - 0); + l, + (subframe_rx<<1), + 0, + 0, + 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); - } + } } ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode); if (do_pdcch_flag) { if ((l==pilot1) || - ((pmch_flag==1)&&(l==l2))) { - LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id); + ((pmch_flag==1)&&(l==l2))) { + LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id); - //start_meas(&ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]]); - if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx); - return(-1); - } - //stop_meas(&ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]]); - //printf("subframe %d n_pdcch_sym %d pdcch procedures %5.3f \n", - // subframe_rx, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - // (ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); - LOG_D(PHY,"num_pdcch_symbols %d\n",ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + //start_meas(&ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]]); + if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) { + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx); + return(-1); + } + + //stop_meas(&ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]]); + //printf("subframe %d n_pdcch_sym %d pdcch procedures %5.3f \n", + // subframe_rx, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + // (ue->rx_pdcch_stats[ue->current_thread_id[subframe_rx]].p_time)/(cpuf*1000.0)); + LOG_D(PHY,"num_pdcch_symbols %d\n",ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); } } - } // for l=1..l2 - ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode); + ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode); LOG_D(PHY," ------ end FFT/ChannelEst/PDCCH slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); // If this is PMCH, call procedures, do channel estimation for first symbol of next DL subframe and return if (pmch_flag == 1) { ue_pmch_procedures(ue,proc,eNB_id,abstraction_flag); - int next_subframe_rx = (1+subframe_rx)%10; - if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) - { + + if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) { slot_fep(ue, - 0, - (next_subframe_rx<<1), - 0, - 0, - 0); + 0, + (next_subframe_rx<<1), + 0, + 0, + 0); } return 0; } slot_fep(ue, - 0, - 1+(subframe_rx<<1), - 0, - 0, - 0); + 0, + 1+(subframe_rx<<1), + 0, + 0, + 0); // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->generic_stat); - LOG_UI(PHY, "[SFN %d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",subframe_rx,ue->generic_stat.p_time/(cpuf*1000.0)); + stop_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); + LOG_I(PHY, "[SFN %d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",subframe_rx,ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } - LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->generic_stat); + start_meas(&ue->crnti_procedures_stats); } + // do procedures for C-RNTI if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - ue->frame_parms.symbols_per_tti>>1, - abstraction_flag); - + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + ue->frame_parms.symbols_per_tti>>1, + abstraction_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } + if (LOG_DEBUGFLAG(UE_TIMING)) { + stop_meas(&ue->crnti_procedures_stats); + } + LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + // do procedures for SI-RNTI if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, - - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - ue->frame_parms.symbols_per_tti>>1, - abstraction_flag); + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + ue->frame_parms.symbols_per_tti>>1, + abstraction_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } @@ -4805,14 +4488,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - ue->frame_parms.symbols_per_tti>>1, - abstraction_flag); + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + ue->frame_parms.symbols_per_tti>>1, + abstraction_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); } @@ -4820,14 +4503,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, - ue->frame_parms.symbols_per_tti>>1, - abstraction_flag); + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols, + ue->frame_parms.symbols_per_tti>>1, + abstraction_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } @@ -4840,235 +4523,230 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->ofdm_demod_stats); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); - slot_fep(ue, - l, - 1+(subframe_rx<<1), - 0, - 0, - 0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); + slot_fep(ue, + l, + 1+(subframe_rx<<1), + 0, + 0, + 0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); } } ue_measurement_procedures(l-1,ue,proc,eNB_id,1+(subframe_rx<<1),abstraction_flag,mode); - } // for l=1..l2 - ue_measurement_procedures(l-1,ue,proc,eNB_id,1+(subframe_rx<<1),abstraction_flag,mode); + ue_measurement_procedures(l-1,ue,proc,eNB_id,1+(subframe_rx<<1),abstraction_flag,mode); // do first symbol of next downlink subframe for channel estimation int next_subframe_rx = (1+subframe_rx)%10; - if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) - { + + if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) { slot_fep(ue, - 0, - (next_subframe_rx<<1), - 0, - 0, - 0); + 0, + (next_subframe_rx<<1), + 0, + 0, + 0); } } // not an S-subframe + if(LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->generic_stat); - LOG_UI(PHY, "[SFN %d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",subframe_rx,ue->generic_stat.p_time/(cpuf*1000.0)); + LOG_I(PHY, "[SFN %d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",subframe_rx,ue->generic_stat.p_time/(cpuf*1000.0)); } LOG_D(PHY," ------ end FFT/ChannelEst/PDCCH slot 1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); - if ( (subframe_rx == 0) && (ue->decode_MIB == 1)) - { + if ( (subframe_rx == 0) && (ue->decode_MIB == 1)) { ue_pbch_procedures(eNB_id,ue,proc,abstraction_flag); } - - // do procedures for C-RNTI LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); + if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - if (LOG_DEBUGFLAG(UE_TIMING)) { + + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } + ue_pdsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - NULL, - 1+(ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + NULL, + 1+(ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { + + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } + ue_dlsch_procedures(ue, - proc, - eNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], - ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1], - &ue->dlsch_errors[eNB_id], - mode, - abstraction_flag); - if (LOG_DEBUGFLAG(UE_TIMING)) { + proc, + eNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0], + ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][1], + &ue->dlsch_errors[eNB_id], + mode, + abstraction_flag); + + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); - LOG_UI(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); - } + if (LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->generic_stat); } if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) { - if(subframe_rx==5 && ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->nb_rb > 20){ - //LOG_M("decoder_llr.m","decllr",dlsch_llr,G,1,0); - //LOG_M("llr.m","llr", &ue->pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); - - LOG_M("rxdataF0_current.m" , "rxdataF0", &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); - //LOG_M("rxdataF0_previous.m" , "rxdataF0_prev_sss", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); - - //LOG_M("rxdataF0_previous.m" , "rxdataF0_prev", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); - - LOG_M("dl_ch_estimates.m", "dl_ch_estimates_sfn5", &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].dl_ch_estimates[0][0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); - LOG_M("dl_ch_estimates_ext.m", "dl_ch_estimatesExt_sfn5", &ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_estimates_ext[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); - LOG_M("rxdataF_comp00.m","rxdataF_comp00", &ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->rxdataF_comp0[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); - //LOG_M("magDLFirst.m", "magDLFirst", &phy_vars_ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_mag0[0][0],14*frame_parms->N_RB_DL*12,1,1); - //LOG_M("magDLSecond.m", "magDLSecond", &phy_vars_ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_magb0[0][0],14*frame_parms->N_RB_DL*12,1,1); - - AssertFatal (0,""); + if(subframe_rx==5 && ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid]->nb_rb > 20) { + //LOG_M("decoder_llr.m","decllr",dlsch_llr,G,1,0); + //LOG_M("llr.m","llr", &ue->pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); + LOG_M("rxdataF0_current.m", "rxdataF0", &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + //LOG_M("rxdataF0_previous.m" , "rxdataF0_prev_sss", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + //LOG_M("rxdataF0_previous.m" , "rxdataF0_prev", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + LOG_M("dl_ch_estimates.m", "dl_ch_estimates_sfn5", &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].dl_ch_estimates[0][0][0],14*ue->frame_parms.ofdm_symbol_size,1, + 1); + LOG_M("dl_ch_estimates_ext.m", "dl_ch_estimatesExt_sfn5", &ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_estimates_ext[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); + LOG_M("rxdataF_comp00.m","rxdataF_comp00", &ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->rxdataF_comp0[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); + //LOG_M("magDLFirst.m", "magDLFirst", &phy_vars_ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_mag0[0][0],14*frame_parms->N_RB_DL*12,1,1); + //LOG_M("magDLSecond.m", "magDLSecond", &phy_vars_ue->pdsch_vars[ue->current_thread_id[subframe_rx]][0]->dl_ch_magb0[0][0],14*frame_parms->N_RB_DL*12,1,1); + AssertFatal (0,""); } } // do procedures for SI-RNTI if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { ue_pdsch_procedures(ue, - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - 1+(ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); - + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + 1+(ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); ue_dlsch_procedures(ue, - proc, - eNB_id, - SI_PDSCH, - ue->dlsch_SI[eNB_id], - NULL, - &ue->dlsch_SI_errors[eNB_id], - mode, - abstraction_flag); + proc, + eNB_id, + SI_PDSCH, + ue->dlsch_SI[eNB_id], + NULL, + &ue->dlsch_SI_errors[eNB_id], + mode, + abstraction_flag); ue->dlsch_SI[eNB_id]->active = 0; } // do procedures for P-RNTI if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { ue_pdsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - 1+(ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); - + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + 1+(ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); ue_dlsch_procedures(ue, - proc, - eNB_id, - P_PDSCH, - ue->dlsch_p[eNB_id], - NULL, - &ue->dlsch_p_errors[eNB_id], - mode, - abstraction_flag); + proc, + eNB_id, + P_PDSCH, + ue->dlsch_p[eNB_id], + NULL, + &ue->dlsch_p_errors[eNB_id], + mode, + abstraction_flag); ue->dlsch_p[eNB_id]->active = 0; } + // do procedures for RA-RNTI if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { ue_pdsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - 1+(ue->frame_parms.symbols_per_tti>>1), - ue->frame_parms.symbols_per_tti-1, - abstraction_flag); + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + 1+(ue->frame_parms.symbols_per_tti>>1), + ue->frame_parms.symbols_per_tti-1, + abstraction_flag); ue_dlsch_procedures(ue, - proc, - eNB_id, - RA_PDSCH, - ue->dlsch_ra[eNB_id], - NULL, - &ue->dlsch_ra_errors[eNB_id], - mode, - abstraction_flag); + proc, + eNB_id, + RA_PDSCH, + ue->dlsch_ra[eNB_id], + NULL, + &ue->dlsch_ra_errors[eNB_id], + mode, + abstraction_flag); ue->dlsch_ra[eNB_id]->active = 0; } // duplicate harq structure - uint8_t current_harq_pid = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->current_harq_pid; LTE_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_processes[current_harq_pid]; LTE_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[next1_thread_id][eNB_id][0]->harq_processes[current_harq_pid]; LTE_DL_UE_HARQ_t *harq_processes_dest1 = ue->dlsch[next2_thread_id][eNB_id][0]->harq_processes[current_harq_pid]; - harq_status_t *current_harq_ack = &ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->harq_ack[subframe_rx]; harq_status_t *harq_ack_dest = &ue->dlsch[next1_thread_id][eNB_id][0]->harq_ack[subframe_rx]; harq_status_t *harq_ack_dest1 = &ue->dlsch[next2_thread_id][eNB_id][0]->harq_ack[subframe_rx]; - copy_harq_proc_struct(harq_processes_dest, current_harq_processes); copy_ack_struct(harq_ack_dest, current_harq_ack); - copy_harq_proc_struct(harq_processes_dest1, current_harq_processes); copy_ack_struct(harq_ack_dest1, current_harq_ack); if (subframe_rx==9) { if (frame_rx % 10 == 0) { if ((ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]) != 0) - ue->dlsch_fer[eNB_id] = (100*(ue->dlsch_errors[eNB_id] - ue->dlsch_errors_last[eNB_id]))/(ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]); + ue->dlsch_fer[eNB_id] = (100*(ue->dlsch_errors[eNB_id] - ue->dlsch_errors_last[eNB_id]))/(ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]); ue->dlsch_errors_last[eNB_id] = ue->dlsch_errors[eNB_id]; ue->dlsch_received_last[eNB_id] = ue->dlsch_received[eNB_id]; } - ue->bitrate[eNB_id] = (ue->total_TBS[eNB_id] - ue->total_TBS_last[eNB_id])*100; ue->total_TBS_last[eNB_id] = ue->total_TBS[eNB_id]; LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", - ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], - ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); + ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], + ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { if ((frame_rx % 100 == 0)) { LOG_UI(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); } } - } if ( LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->generic_stat); - LOG_UI(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); + LOG_I(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); if ( LOG_DEBUGFLAG(UE_TIMING) ) { stop_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); - LOG_UI(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); + LOG_I(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); @@ -5077,19 +4755,15 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, -void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) -{ +void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { #if defined(ENABLE_ITTI) MessageDef *msg_p; int result; #endif - int frame_rx = proc->frame_rx; int frame_tx = proc->frame_tx; int subframe_rx = proc->subframe_rx; int subframe_tx = proc->subframe_tx; - - UE_L2_STATE_t ret; int slot; @@ -5097,8 +4771,8 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u ue->UE_mode[eNB_id]=PUSCH; } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1); + if ( LOG_DEBUGFLAG(UE_TIMING)) { start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); } @@ -5111,15 +4785,14 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u if (msg_p != NULL) { switch (ITTI_MSG_ID(msg_p)) { - case PHY_FIND_CELL_REQ: - LOG_I(PHY, "[UE %d] Received %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p)); + case PHY_FIND_CELL_REQ: + LOG_E(PHY, "[UE %d] Received PLMN doesn't match SIM data, but not developped further processing %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p)); + /* TODO process the message */ + break; - /* TODO process the message */ - break; - - default: - LOG_E(PHY, "[UE %d] Received unexpected message %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p)); - break; + default: + LOG_E(PHY, "[UE %d] Received unexpected message %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p)); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); @@ -5129,62 +4802,61 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u #endif - for (slot=0;slot<2;slot++) { - + for (slot=0; slot<2; slot++) { if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)|| - (ue->frame_parms.frame_type == FDD)) { + (ue->frame_parms.frame_type == FDD)) { phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode); } if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) || - (ue->frame_parms.frame_type == FDD)) { + (ue->frame_parms.frame_type == FDD)) { phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); } if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) && - (slot==1)) { + (slot==1)) { phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag); } if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) && - (slot==0)) { - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); + (slot==0)) { + phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); } if (ue->mac_enabled==1) { if (slot==0) { - - //LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx); + //LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx); ret = ue_scheduler(ue->Mod_id, - frame_rx, - subframe_rx, - frame_tx, - subframe_tx, - subframe_select(&ue->frame_parms,subframe_tx), - eNB_id, - 0/*FIXME CC_id*/); - - if (ret == CONNECTION_LOST) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_RESYNCH) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", - ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = RESYNCH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_HO_PRACH) { - LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", - ue->Mod_id,frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - } + frame_rx, + subframe_rx, + frame_tx, + subframe_tx, + subframe_select(&ue->frame_parms,subframe_tx), + eNB_id, + 0/*FIXME CC_id*/); + + if (ret == CONNECTION_LOST) { + LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, + frame_rx,subframe_tx); + ue->UE_mode[eNB_id] = PRACH; + // mac_xface->macphy_exit("Connection lost"); + } else if (ret == PHY_RESYNCH) { + LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", + ue->Mod_id, + frame_rx,subframe_tx); + ue->UE_mode[eNB_id] = RESYNCH; + // mac_xface->macphy_exit("Connection lost"); + } else if (ret == PHY_HO_PRACH) { + LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", + ue->Mod_id,frame_rx,subframe_tx); + ue->UE_mode[eNB_id] = PRACH; + } } } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0); - if (LOG_DEBUGFLAG(UE_TIMING)) { + + if (LOG_DEBUGFLAG(UE_TIMING)) { stop_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); } } // slot diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h new file mode 100644 index 0000000000..e9ad4dc888 --- /dev/null +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -0,0 +1,172 @@ + +static int cmpdouble(const void *p1, const void *p2) { + return *(double *)p1 > *(double *)p2; +} + +double median(varArray_t *input) { + return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize); +} + +double q1(varArray_t *input) { + return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize); +} + +double q3(varArray_t *input) { + return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize); +} + +void dumpVarArray(varArray_t *input) { + double *ptr=dataArray(input); + printf("dumping size=%ld\n", input->size); + + for (int i=0; i < input->size; i++) + printf("%.1f:", *ptr++); + + printf("\n"); +} +void sumUpStats(time_stats_t * res, time_stats_t * src, int lastActive) { + reset_meas(res); + for (int i=0; idiff+=src[i].diff; + res->diff_square+=src[i].diff_square; + res->trials+=src[i].trials; + if (src[i].max > res->max) + res->max=src[i].max; + } + res->p_time=src[lastActive].p_time; +} +void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastActive) { + reset_meas(res); + for (int i=0; idiff+=src[i][0].diff+src[i][1].diff; + res->diff_square+=src[i][0].diff_square+src[i][1].diff_square; + res->trials+=src[i][0].trials+src[i][1].trials; + if (src[i][0].max > res->max) + res->max=src[i][0].max; + if (src[i][1].max > res->max) + res->max=src[i][1].max;} + int last=src[lastActive][0].in < src[lastActive][1].in? 1 : 0 ; + res->p_time=src[lastActive][last].p_time; +} + +double squareRoot(time_stats_t *ptr) { + double timeBase=1/(1000*cpu_freq_GHz); + return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials - + pow((double)ptr->diff/ptr->trials*timeBase,2)); +} + +void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) { + double timeBase=1/(1000*cpu_freq_GHz); + printf("%-43s %6.2f us (%d trials)\n", + txt, + (double)ptr->diff/ptr->trials*timeBase, + ptr->trials); + printf(" Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n", + squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size); +} + +void printStatIndent(time_stats_t *ptr, char *txt) { + printf("|__ %-38s %6.2f us (%3d trials)\n", + txt, + ptr->trials?inMicroS(ptr->diff/ptr->trials):0, + ptr->trials); +} + +void printStatIndent2(time_stats_t *ptr, char *txt) { + double timeBase=1/(1000*cpu_freq_GHz); + printf(" |__ %-34s %6.2f us (%3d trials)\n", + txt, + ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, + ptr->trials); +} + +void printStatIndent3(time_stats_t *ptr, char *txt) { + double timeBase=1/(1000*cpu_freq_GHz); + printf(" |__ %-30s %6.2f us (%3d trials)\n", + txt, + ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, + ptr->trials); +} + + +void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) { + fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;", + squareRoot(ptr), + (double)ptr->max, *(double*)dataArray(sortedList), + median(sortedList),q1(sortedList),q3(sortedList), + dropped); +} + +struct option * parse_oai_options(paramdef_t *options) { + int l; + + for(l=0; options[l].optname[0]!=0; l++) {}; + + struct option *long_options=calloc(sizeof(struct option),l); + + for(int i=0; options[i].optname[0]!=0; i++) { + long_options[i].name=options[i].optname; + long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument; + + if ( options[i].voidptr) + switch (options[i].type) { + case TYPE_INT: + *options[i].iptr=options[i].defintval; + break; + + case TYPE_DOUBLE: + *options[i].dblptr=options[i].defdblval; + break; + + case TYPE_UINT8: + *options[i].u8ptr=options[i].defintval; + break; + + case TYPE_UINT16: + *options[i].u16ptr=options[i].defintval; + break; + + default: + printf("not parsed type for default value %s\n", options[i].optname ); + exit(1); + } + + continue; + }; + return long_options; +} + +void display_options_values(paramdef_t *options, int verbose) { + for(paramdef_t * ptr=options; ptr->optname[0]!=0; ptr++) { + char varText[256]="need specific display"; + + if (ptr->voidptr != NULL) { + if ( (ptr->paramflags & PARAMFLAG_BOOL) ) + strcpy(varText, *(bool *)ptr->iptr ? "True": "False" ); + else switch (ptr->type) { + case TYPE_INT: + sprintf(varText,"%d",*ptr->iptr); + break; + + case TYPE_DOUBLE: + sprintf(varText,"%.2f",*ptr->dblptr); + break; + + case TYPE_UINT8: + sprintf(varText,"%d",(int)*ptr->u8ptr); + break; + + case TYPE_UINT16: + sprintf(varText,"%d",(int)*ptr->u16ptr); + break; + + default: + printf("not decoded type\n"); + exit(1); + } + } + + printf("--%-20s set to %s\n",ptr->optname, varText); + if (verbose) printf("%s\n",ptr->helpstr); + } +} diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 8cfdcf9e2d..b557df3c92 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -72,6 +72,9 @@ void feptx_ofdm(RU_t *ru); void feptx_prec(RU_t *ru); double cpuf; +#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +//#define MCS_COUNT 23//added for PHY abstraction +#include int otg_enabled=0; /*the following parameters are used to control the processing times calculations*/ @@ -82,30 +85,7 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */ int n_tx_dropped = 0; /*!< \brief initial max process time for tx */ int n_rx_dropped = 0; /*!< \brief initial max process time for rx */ -char *parallel_config = NULL; -char *worker_config = NULL; -static THREAD_STRUCT thread_struct; -void set_parallel_conf(char *parallel_conf) -{ - if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT; - printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf); -} -void set_worker_conf(char *worker_conf) -{ - if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE; - else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE; - printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf); -} -PARALLEL_CONF_t get_thread_parallel_conf(void) -{ - return thread_struct.parallel_conf; -} -WORKER_CONF_t get_thread_worker_conf(void) -{ - return thread_struct.worker_conf; -} +THREAD_STRUCT thread_struct; int emulate_rf = 0; @@ -369,6 +349,7 @@ fill_dlsch_config(nfapi_dl_config_request_body_t * dl_req, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = transmission_mode; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = num_bf_prb_per_subband; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = num_bf_vector; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; dl_req->number_pdu++; } @@ -399,6 +380,7 @@ void fill_DCI(PHY_VARS_eNB *eNB, nfapi_dl_config_request_body_t *dl_req=&sched_resp->DL_req->dl_config_request_body; nfapi_dl_config_request_pdu_t *dl_config_pdu; nfapi_tx_request_body_t *TX_req=&sched_resp->TX_req->tx_request_body; + int NB_RB4TBS = common_flag == 0 ? NB_RB : (2+TPC); dl_req->number_dci=0; dl_req->number_pdu=0; @@ -411,26 +393,24 @@ void fill_DCI(PHY_VARS_eNB *eNB, case 2: case 7: - if (common_flag == 0) { - dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu)); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = (common_flag == 0) ? NFAPI_DL_DCI_FORMAT_1 : NFAPI_DL_DCI_FORMAT_1A; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = n_rnti+k; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = (common_flag == 0) ? n_rnti+k : SI_RNTI; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (common_flag ==0 ) ? 1: 2; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = TPC; // dont adjust power when retransmitting - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = ndi; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = (common_flag == 0) ? ndi : 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs1; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rv; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = DLSCH_RB_ALLOC; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = (common_flag == 0) ? DLSCH_RB_ALLOC : computeRIV(eNB->frame_parms.N_RB_DL,0,NB_RB); //deactivate second codeword dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1; @@ -442,11 +422,12 @@ void fill_DCI(PHY_VARS_eNB *eNB, dl_req->number_pdu++; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; + AssertFatal(TPC>=0 && TPC<2, "TPC should be 0 or 1\n"); fill_dlsch_config(dl_req, - get_TBS_DL(mcs1,NB_RB), + get_TBS_DL(mcs1,NB_RB4TBS), (retrans > 0) ? -1 : 0, /* retransmission, no pdu_index */ - n_rnti, + (common_flag == 0) ? n_rnti : SI_RNTI, 0, // type 0 allocation from 7.1.6 in 36.213 0, // virtual_resource_block_assignment_flag, unused here DLSCH_RB_ALLOC, // resource_block_coding, @@ -469,13 +450,10 @@ void fill_DCI(PHY_VARS_eNB *eNB, ); fill_tx_req(TX_req, (frame * 10) + subframe, - get_TBS_DL(mcs1,NB_RB), + get_TBS_DL(mcs1,NB_RB4TBS), 0, input_buffer[k]); - } - else { - - } + break; @@ -535,23 +513,42 @@ void fill_DCI(PHY_VARS_eNB *eNB, } int n_users = 1; -sub_frame_t subframe=7; +int subframe=7; int num_common_dci=0,num_ue_spec_dci=0,num_dci=0,num_pdcch_symbols=1; uint16_t n_rnti=0x1234; - int nfapi_mode=0; +int nfapi_mode=0; +int abstx=0; +int Nid_cell=0; +int N_RB_DL=25; +int tdd_config=3; +int dci_flag=0; +int threequarter_fs=0; +double snr_step=1,input_snr_step=1, snr_int=30; +double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel +int test_perf=0; +int n_frames; +int n_ch_rlz = 1; +int rx_sample_offset = 0; +int xforms=0; +int dump_table=0; +int loglvl=OAILOG_WARNING; +int mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0; +int two_thread_flag=0; +int num_rounds = 4;//,fix_rounds=0; +int perfect_ce = 0; +int extended_prefix_flag=0; +int verbose=0, help=0; +double SNR,snr0=-2.0,snr1,rate = 0; +int print_perf=0; int main(int argc, char **argv) { - int c; int k,i,j,aa; int re; - int loglvl=OAILOG_DEBUG; int s,Kr,Kr_bytes; - double SNR,snr0=-2.0,snr1,rate = 0; - double snr_step=1,input_snr_step=1, snr_int=30; LTE_DL_FRAME_PARMS *frame_parms; double s_re0[30720*2],s_im0[30720*2],r_re0[30720*2],r_im0[30720*2]; @@ -560,18 +557,14 @@ int main(int argc, char **argv) double *s_im[2]={s_im0,s_im1}; double *r_re[2]={r_re0,r_re1}; double *r_im[2]={r_im0,r_im1}; - double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel - uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2; - uint16_t Nid_cell=0; + uint8_t transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2; int eNB_id = 0; - unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round; + unsigned char round; unsigned char i_mod = 2; - unsigned short NB_RB; - uint16_t tdd_config=3; - + int NB_RB; SCM_t channel_model=Rayleigh1; // unsigned char *input_data,*decoded_output; @@ -602,18 +595,13 @@ int main(int argc, char **argv) FILE *input_fd=NULL; unsigned char input_file=0; - int n_frames; - int n_ch_rlz = 1; channel_desc_t *eNB2UE[4]; //uint8_t num_pdcch_symbols_2=0; - uint8_t rx_sample_offset = 0; //char stats_buffer[4096]; //int len; - uint8_t num_rounds = 4;//,fix_rounds=0; //int u; int n=0; - int abstx=0; //int iii; int ch_realization; @@ -625,9 +613,8 @@ int main(int argc, char **argv) // int bler; double blerr[4]; short *uncoded_ber_bit=NULL; - uint8_t N_RB_DL=25,osf=1; + int osf=1; frame_t frame_type = FDD; - int xforms=0; FD_lte_phy_scope_ue *form_ue = NULL; char title[255]; @@ -640,16 +627,12 @@ int main(int argc, char **argv) // time_stats_t ts;//,sts,usts; int avg_iter,iter_trials; int rballocset=0; - int print_perf=0; - int test_perf=0; int test_passed=0; - int dump_table=0; double effective_rate=0.0; char channel_model_input[10]="I"; int TB0_active = 1; - uint32_t perfect_ce = 0; // LTE_DL_UE_HARQ_t *dlsch0_ue_harq; // LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq; @@ -657,20 +640,11 @@ int main(int argc, char **argv) uint8_t ue_category=4; uint32_t Nsoft; int sf; - - - int CCE_table[800]; - - int threequarter_fs=0; - - opp_enabled=1; // to enable the time meas FILE *csv_fd=NULL; - char csv_fname[32]; - int dci_flag=0; - int two_thread_flag=0; + char csv_fname[FILENAME_MAX]; int DLSCH_RB_ALLOC = 0; int dci_received; @@ -715,7 +689,7 @@ int main(int argc, char **argv) DL_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdu_list; TX_req.tx_request_body.tx_pdu_list = tx_pdu_list; - + set_parallel_conf("PARALLEL_SINGLE_THREAD"); cpuf = cpu_freq_GHz; //signal(SIGSEGV, handler); @@ -726,38 +700,98 @@ int main(int argc, char **argv) snr0 = 0; // num_layers = 1; perfect_ce = 0; + static paramdef_t options[] = { + { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, + { "Abstx", "Turns on calibration mode for abstraction.", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 }, + { "bTDD", "Set the tdd configuration mode",0, iptr:&tdd_config, defintval:3, TYPE_INT, 0 }, + { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 }, + { "cPdcch", "Number of PDCCH symbols",0, iptr:&num_pdcch_symbols, defintval:1, TYPE_INT, 0 }, + { "CnidCell", "The cell id ",0, iptr:&Nid_cell, defintval:0, TYPE_INT, 0 }, + { "dciFlag", "Transmit the DCI and compute its error statistics", PARAMFLAG_BOOL, iptr:&dci_flag, defintval:0, TYPE_INT, 0 }, + { "Dtdd", "Enable tdd", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, + { "eRounds", "Number of rounds",0, iptr:NULL, defintval:25, TYPE_INT, 0 }, + { "EsubSampling","three quarters sub-sampling",PARAMFLAG_BOOL, iptr:&threequarter_fs, defintval:0, TYPE_INT, 0 }, + { "f_snr_step", "step size of SNR, default value is 1.",0, dblptr:&input_snr_step, defdblval:1, TYPE_DOUBLE, 0 }, + { "Forgetting", "forgetting factor (0 new channel every trial, 1 channel constant)",0, dblptr:&forgetting_factor, defdblval:0.0, TYPE_DOUBLE, 0 }, + { "input_file", "input IQ data file",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "Input_file_trch", " Input filename for TrCH data (binary)",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "WtwoThreads", "two_thread_flag", PARAMFLAG_BOOL, iptr:&two_thread_flag, defintval:0, TYPE_INT, 0 }, + { "lMuMimo", "offset_mumimo_llr_drange_fix",0, u8ptr:&offset_mumimo_llr_drange_fix, defintval:0, TYPE_UINT8, 0 }, + { "mcs1", "The MCS for TB 1", 0, iptr:&mcs1, defintval:0, TYPE_INT, 0 }, + { "Mcs2", "The MCS for TB 2", 0, iptr:&mcs2, defintval:0, TYPE_INT, 0 }, + { "Operf", "Set the percenatge of effective rate to testbench the modem performance (typically 30 and 70, range 1-100)",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 }, + { "tmcs_i", "MCS of interfering UE",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "nb_frame", "number of frame in a test",0, iptr:&n_frames, defintval:1, TYPE_INT, 0 }, + { "offsetRxSample", "Sample offset for receiver", 0, iptr:&rx_sample_offset, defintval:0, TYPE_INT, 0 }, + { "rballocset", "ressource block allocation (see section 7.1.6.3 in 36.213)",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "snr", "Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated", dblptr:&snr0, defdblval:-2.0, TYPE_DOUBLE, 0 }, + { "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int, defdblval:30, TYPE_DOUBLE, 0 }, + { "N_ch_rlzN0", "Determines the number of Channel Realizations in Abstraction mode. Default value is 1",0, iptr:&n_ch_rlz, defintval:1, TYPE_INT, 0 }, + { "prefix_extended","Enable extended prefix", PARAMFLAG_BOOL, iptr:&extended_prefix_flag, defintval:0, TYPE_INT, 0 }, + { "RNumRound", "Number of HARQ rounds (fixed)",0, iptr:&num_rounds, defintval:4, TYPE_INT, 0 }, + { "Subframe", "subframe ",0, iptr:&subframe, defintval:7, TYPE_INT, 0 }, + { "Trnti", "rnti",0, u16ptr:&n_rnti, defuintval:0x1234, TYPE_UINT16, 0 }, + { "vi_mod", "i_mod",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "Qparallel", "Enable parallel execution",0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0 }, + { "Performance", "Display CPU perfomance of each L1 piece", PARAMFLAG_BOOL, iptr:&print_perf, defintval:0, TYPE_INT, 0 }, + { "q_tx_port", "Number of TX antennas ports used in eNB",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "uEdual", "Enables the Interference Aware Receiver for TM5 (default is normal receiver)",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + { "xTransmission","Transmission mode (1,2,6,7 for the moment)",0, iptr:NULL, defintval:25, TYPE_INT, 0 }, + { "yn_tx_phy","Number of TX antennas used in eNB",0, iptr:NULL, defintval:25, TYPE_INT, 0 }, + { "XForms", "Display the soft scope", PARAMFLAG_BOOL, iptr:&xforms, defintval:0, TYPE_INT, 0 }, + { "Yperfect_ce","Perfect CE", PARAMFLAG_BOOL, iptr:&perfect_ce, defintval:0, TYPE_INT, 0 }, + { "Zdump", "dump table",PARAMFLAG_BOOL, iptr:&dump_table, defintval:0, TYPE_INT, 0 }, + { "Loglvl", "log level",0, iptr:&loglvl, defintval:OAILOG_DEBUG, TYPE_INT, 0 }, + { "zn_rx", "Number of RX antennas used in UE",0, iptr:NULL, defintval:2, TYPE_INT, 0 }, + { "gchannel", "[A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')",0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0 }, + { "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 }, + { "help", "display help and exit", PARAMFLAG_BOOL, iptr:&help, defintval:0, TYPE_INT, 0 }, + { "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, + }; - while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:q:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:WXYL:")) != -1) { - switch (c) { + + struct option * long_options = parse_oai_options(options); + + + int option_index; + + int res; + + while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) { + if (options[option_index].voidptr != NULL ) { + if (long_options[option_index].has_arg==no_argument) + *(bool *)options[option_index].iptr=1; + else switch (options[option_index].type) { + case TYPE_INT: + *(int *)options[option_index].iptr=atoi(optarg); + break; + + case TYPE_DOUBLE: + *(double *)options[option_index].dblptr=atof(optarg); + break; + + case TYPE_UINT8: + *(uint8_t *)options[option_index].dblptr=atoi(optarg); + break; + + case TYPE_UINT16: + *(uint16_t *)options[option_index].dblptr=atoi(optarg); + break; + + default: + printf("not decoded type.\n"); + exit(1); + } + + continue; + } + + switch (long_options[option_index].name[0]) { case 'a': awgn_flag = 1; channel_model = AWGN; break; - case 'A': - abstx = 1; - break; - - case 'b': - tdd_config=atoi(optarg); - break; - - case 'B': - N_RB_DL=atoi(optarg); - break; - - case 'c': - num_pdcch_symbols=atoi(optarg); - break; - - case 'C': - Nid_cell = atoi(optarg); - break; - - case 'd': - dci_flag = 1; - break; - case 'D': frame_type=TDD; break; @@ -768,18 +802,6 @@ int main(int argc, char **argv) TPC = atoi(optarg); break; - case 'E': - threequarter_fs=1; - break; - - case 'f': - input_snr_step= atof(optarg); - break; - - case 'F': - forgetting_factor = atof(optarg); - break; - case 'i': input_fd = fopen(optarg,"r"); input_file=1; @@ -791,139 +813,51 @@ int main(int argc, char **argv) input_trch_file=1; break; - case 'W': - two_thread_flag = 1; - break; - case 'l': - offset_mumimo_llr_drange_fix=atoi(optarg); - break; - - case 'm': - mcs1 = atoi(optarg); - break; - - case 'M': - mcs2 = atoi(optarg); - break; - - case 'O': - test_perf=atoi(optarg); - //print_perf =1; - break; - case 't': mcs_i = atoi(optarg); i_mod = get_Qm(mcs_i); break; - case 'n': - n_frames = atoi(optarg); - break; - - - case 'o': - rx_sample_offset = atoi(optarg); - break; - case 'r': DLSCH_RB_ALLOC = atoi(optarg); rballocset = 1; break; - case 's': - snr0 = atof(optarg); - break; - - case 'w': - snr_int = atof(optarg); - break; - - - case 'N': - n_ch_rlz= atof(optarg); - break; - - case 'p': - extended_prefix_flag=1; - break; - case 'g': - memcpy(channel_model_input,optarg,10); + strncpy(channel_model_input,optarg,9); + struct tmp { + char opt; + int m; + int M; + } + tmp[]= { + {'A',SCM_A,2}, + {'B',SCM_B,3}, + {'C',SCM_C,4}, + {'D',SCM_D,5}, + {'E',EPA,6}, + {'F',EVA,6}, + {'G',ETU,8}, + {'H',Rayleigh8,9}, + {'I',Rayleigh1,10}, + {'J',Rayleigh1_corr,11}, + {'K',Rayleigh1_anticorr,12}, + {'L',Rice8,13}, + {'M',Rice1,14}, + {'N',AWGN,1}, + {0,0,0} + }; + struct tmp *ptr; - switch((char)*optarg) { - case 'A': - channel_model=SCM_A; + for (ptr=tmp; ptr->opt!=0; ptr++) + if ( ptr->opt == optarg[0] ) { + channel_model=ptr->m; + break; + } + + AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg ); break; - case 'B': - channel_model=SCM_B; - break; - - case 'C': - channel_model=SCM_C; - break; - - case 'D': - channel_model=SCM_D; - break; - - case 'E': - channel_model=EPA; - break; - - case 'F': - channel_model=EVA; - break; - - case 'G': - channel_model=ETU; - break; - - case 'H': - channel_model=Rayleigh8; - break; - - case 'I': - channel_model=Rayleigh1; - break; - - case 'J': - channel_model=Rayleigh1_corr; - break; - - case 'K': - channel_model=Rayleigh1_anticorr; - break; - - case 'L': - channel_model=Rice8; - break; - - case 'M': - channel_model=Rice1; - break; - - case 'N': - channel_model=AWGN; - break; - default: - printf("Unsupported channel model!\n"); - exit(-1); - } - - break; - case 'R': - num_rounds=atoi(optarg); - break; - - case 'S': - subframe=atoi(optarg); - break; - - case 'T': - n_rnti=atoi(optarg); - break; - case 'u': dual_stream_UE=1; UE->use_ia_receiver = 1; @@ -945,10 +879,6 @@ int main(int argc, char **argv) break; - case 'P': - print_perf=1; - break; - case 'q': n_tx_port=atoi(optarg); @@ -999,15 +929,6 @@ int main(int argc, char **argv) } break; - break; - - case 'X': - xforms=1; - break; - - case 'Y': - perfect_ce=1; - break; case 'z': n_rx=atoi(optarg); @@ -1019,91 +940,72 @@ int main(int argc, char **argv) break; - case 'Z': - dump_table=1; + case 'Q': + set_parallel_conf(optarg); break; - - case 'L': - loglvl = atoi(optarg); - break; - - case 'h': + default: - printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,5,6,7) -y TXant -z RXant -I trch_file\n",argv[0]); - printf("-h This message\n"); - printf("-a Use AWGN channel and not multipath\n"); - printf("-c Number of PDCCH symbols\n"); - printf("-m MCS1 for TB 1\n"); - printf("-M MCS2 for TB 2\n"); - printf("-d Transmit the DCI and compute its error statistics\n"); - printf("-p Use extended prefix mode\n"); - printf("-n Number of frames to simulate\n"); - printf("-o Sample offset for receiver\n"); - printf("-s Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated\n", snr_int, snr_step); - printf("-f step size of SNR, default value is 1.\n"); - printf("-C cell id\n"); - printf("-S subframe\n"); - printf("-D use TDD mode\n"); - printf("-b TDD config\n"); - printf("-B bandwidth configuration (in number of ressource blocks): 6, 25, 50, 100\n"); - printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n"); - printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); - printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); - printf("-x Transmission mode (1,2,6,7 for the moment)\n"); - printf("-q Number of TX antennas ports used in eNB\n"); - printf("-y Number of TX antennas used in eNB\n"); - printf("-z Number of RX antennas used in UE\n"); - printf("-t MCS of interfering UE\n"); - printf("-R Number of HARQ rounds (fixed)\n"); - printf("-A Turns on calibration mode for abstraction.\n"); - printf("-N Determines the number of Channel Realizations in Abstraction mode. Default value is 1. \n"); - printf("-O Set the percenatge of effective rate to testbench the modem performance (typically 30 and 70, range 1-100) \n"); - printf("-I Input filename for TrCH data (binary)\n"); - printf("-u Enables the Interference Aware Receiver for TM5 (default is normal receiver)\n"); + printf("Wrong option: %s\n",long_options[option_index].name); exit(1); break; } } - set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT"); - set_worker_conf("WORKER_ENABLE"); + + if ( res != -1 ) { + printf("A wrong option has been found\n"); + exit(1); + } + + if (help || verbose ) + display_options_values(options, true); + if (help) + exit(0); + + if (thread_struct.parallel_conf != PARALLEL_SINGLE_THREAD) + set_worker_conf("WORKER_ENABLE"); if (transmission_mode>1) pa=dBm3; printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa); - AssertFatal(load_configmodule(argc,argv) != NULL, + AssertFatal(load_configmodule(argc,argv, CONFIG_ENABLECMDLINEONLY) != NULL, "cannot load configuration module, exiting\n"); logInit(); + set_glog_onlinelog(true); // enable these lines if you need debug info set_glog(loglvl); + SET_LOG_DEBUG(UE_TIMING); // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); - if (common_flag == 0) { switch (N_RB_DL) { case 6: if (rballocset==0) DLSCH_RB_ALLOC = 0x3f; num_pdcch_symbols = 3; break; - + case 25: if (rballocset==0) DLSCH_RB_ALLOC = 0x1fff; break; - + case 50: if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffff; break; - + case 100: if (rballocset==0) DLSCH_RB_ALLOC = 0x1ffffff; break; } - - NB_RB=conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); - } else - NB_RB = 4; + + NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); + } + else { + if (rballocset==0) NB_RB = 8; + else NB_RB = DLSCH_RB_ALLOC; + AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB); + } if (xforms==1) { fl_initialize (&argc, argv, NULL, 0, 0); @@ -1159,11 +1061,7 @@ int main(int argc, char **argv) ru->do_precoding=1; eNB->mac_enabled=1; - if (two_thread_flag == 0) { - eNB->te = dlsch_encoding; - } - else { - eNB->te = dlsch_encoding_2threads; + if(get_thread_worker_conf() == WORKER_ENABLE) { extern void init_td_thread(PHY_VARS_eNB *); extern void init_te_thread(PHY_VARS_eNB *); init_td_thread(eNB); @@ -1443,7 +1341,7 @@ int main(int argc, char **argv) eNB->UE_stats[1].DL_pmi_single = 0; } - L1_rxtx_proc_t *proc_eNB = &eNB->proc.proc_rxtx[0];//UE->current_thread_id[subframe]]; + L1_rxtx_proc_t *proc_eNB = &eNB->proc.L1_proc; if (input_fd==NULL) { @@ -1522,9 +1420,19 @@ int main(int argc, char **argv) reset_meas(&eNB->dlsch_interleaving_stats); reset_meas(&eNB->dlsch_rate_matching_stats); reset_meas(&eNB->dlsch_turbo_encoding_stats); - - reset_meas(&UE->phy_proc_rx[UE->current_thread_id[subframe]]); // total UE rx + reset_meas(&eNB->dlsch_common_and_dci); + reset_meas(&eNB->dlsch_ue_specific); + for (int i=0; iphy_proc_rx[i]); // total UE rx + reset_meas(&UE->ue_front_end_stat[i]); + reset_meas(&UE->pdsch_procedures_stat[i]); + reset_meas(&UE->dlsch_procedures_stat[i]); + reset_meas(&UE->dlsch_decoding_stats[i]); + reset_meas(&UE->dlsch_llr_stats_parallelization[i][0]); + reset_meas(&UE->dlsch_llr_stats_parallelization[i][1]); + } reset_meas(&UE->ofdm_demod_stats); + reset_meas(&UE->crnti_procedures_stats); reset_meas(&UE->dlsch_channel_estimation_stats); reset_meas(&UE->dlsch_freq_offset_estimation_stats); reset_meas(&UE->rx_dft_stats); @@ -1541,25 +1449,21 @@ int main(int argc, char **argv) reset_meas(&UE->dlsch_tc_intl1_stats); reset_meas(&UE->dlsch_tc_intl2_stats); // initialization - struct list time_vector_tx; - initialize(&time_vector_tx); - struct list time_vector_tx_ifft; - initialize(&time_vector_tx_ifft); - struct list time_vector_tx_mod; - initialize(&time_vector_tx_mod); - struct list time_vector_tx_enc; - initialize(&time_vector_tx_enc); - - struct list time_vector_rx; - initialize(&time_vector_rx); - struct list time_vector_rx_fft; - initialize(&time_vector_rx_fft); - struct list time_vector_rx_demod; - initialize(&time_vector_rx_demod); - struct list time_vector_rx_dec; - initialize(&time_vector_rx_dec); - - + // initialization + varArray_t *table_tx=initVarArray(1000,sizeof(double)); + varArray_t *table_tx_ifft=initVarArray(1000,sizeof(double)); + varArray_t *table_tx_mod=initVarArray(1000,sizeof(double)); + varArray_t *table_tx_enc=initVarArray(1000,sizeof(double)); + varArray_t *table_rx=initVarArray(1000,sizeof(double)); + time_stats_t phy_proc_rx_tot; + time_stats_t pdsch_procedures_tot; + time_stats_t dlsch_procedures_tot; + time_stats_t dlsch_decoding_tot; + time_stats_t dlsch_llr_tot; + time_stats_t ue_front_end_tot; + varArray_t *table_rx_fft=initVarArray(1000,sizeof(double)); + varArray_t *table_rx_demod=initVarArray(1000,sizeof(double)); + varArray_t *table_rx_dec=initVarArray(1000,sizeof(double)); for (trials = 0; trialsframe_rx, proc->subframe_rx, (void *)&dci_alloc[0].dci_pdu, - n_rnti, + common_flag == 0 ? n_rnti : SI_RNTI, dci_alloc[0].format, UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id], UE->pdsch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id], @@ -1859,9 +1763,6 @@ int main(int argc, char **argv) } - - - if (UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->harq_ack[subframe].ack == 1) { avg_iter += UE->dlsch[UE->current_thread_id[subframe]][eNB_id][0]->last_iteration_cnt; @@ -2004,120 +1905,53 @@ int main(int argc, char **argv) /* calculate the total processing time for each packet, * get the max, min, and number of packets that exceed t>2000us */ - double t_tx = (double)eNB->phy_proc_tx.p_time/cpu_freq_GHz/1000.0; - double t_tx_ifft = (double)eNB->ofdm_mod_stats.p_time/cpu_freq_GHz/1000.0; - double t_tx_mod = (double)eNB->dlsch_modulation_stats.p_time/cpu_freq_GHz/1000.0; - double t_tx_enc = (double)eNB->dlsch_encoding_stats.p_time/cpu_freq_GHz/1000.0; + double t_tx = inMicroS(eNB->phy_proc_tx.p_time); + double t_tx_ifft = inMicroS(eNB->ofdm_mod_stats.p_time); + double t_rx = inMicroS(UE->phy_proc_rx[UE->current_thread_id[subframe]].p_time); + sumUpStats(&phy_proc_rx_tot, UE->phy_proc_rx, UE->current_thread_id[subframe]); + sumUpStats(&ue_front_end_tot, UE->ue_front_end_stat, UE->current_thread_id[subframe]); + sumUpStats(&pdsch_procedures_tot, UE->pdsch_procedures_stat, UE->current_thread_id[subframe]); + sumUpStats(&dlsch_procedures_tot, UE->dlsch_procedures_stat, UE->current_thread_id[subframe]); + sumUpStats(&dlsch_decoding_tot, UE->dlsch_decoding_stats, UE->current_thread_id[subframe]); + sumUpStatsSlot(&dlsch_llr_tot, UE->dlsch_llr_stats_parallelization, UE->current_thread_id[subframe]); - double t_rx = (double)UE->phy_proc_rx[UE->current_thread_id[subframe]].p_time/cpu_freq_GHz/1000.0; - double t_rx_fft = (double)UE->ofdm_demod_stats.p_time/cpu_freq_GHz/1000.0; - double t_rx_demod = (double)UE->dlsch_rx_pdcch_stats.p_time/cpu_freq_GHz/1000.0; - double t_rx_dec = (double)UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].p_time/cpu_freq_GHz/1000.0; + double t_rx_fft = inMicroS(UE->ofdm_demod_stats.p_time); + double t_rx_demod = inMicroS(UE->dlsch_rx_pdcch_stats.p_time); + double t_rx_dec = inMicroS(UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].p_time); - if (t_tx > t_tx_max) - t_tx_max = t_tx; - - if (t_tx < t_tx_min) - t_tx_min = t_tx; - - if (t_rx > t_rx_max) - t_rx_max = t_rx; - - if (t_rx < t_rx_min) - t_rx_min = t_rx; - - if (t_tx > 2000) + if (t_tx > 2000 )// 2ms is too much time for a subframe n_tx_dropped++; - - if (t_rx > 2000) + + if (t_rx > 2000 ) n_rx_dropped++; - - push_front(&time_vector_tx, t_tx); - push_front(&time_vector_tx_ifft, t_tx_ifft); - push_front(&time_vector_tx_mod, t_tx_mod); - push_front(&time_vector_tx_enc, t_tx_enc); - - push_front(&time_vector_rx, t_rx); - push_front(&time_vector_rx_fft, t_rx_fft); - push_front(&time_vector_rx_demod, t_rx_demod); - push_front(&time_vector_rx_dec, t_rx_dec); - + + appendVarArray(table_tx, &t_tx); + appendVarArray(table_tx_ifft, &t_tx_ifft); + appendVarArray(table_rx, &t_rx ); + appendVarArray(table_rx_fft, &t_rx_fft ); + appendVarArray(table_rx_demod, &t_rx_demod ); + appendVarArray(table_rx_dec, &t_rx_dec ); } //trials // round_trials[0]: number of code word : goodput the protocol - double table_tx[time_vector_tx.size]; - totable(table_tx, &time_vector_tx); - double table_tx_ifft[time_vector_tx_ifft.size]; - totable(table_tx_ifft, &time_vector_tx_ifft); - double table_tx_mod[time_vector_tx_mod.size]; - totable(table_tx_mod, &time_vector_tx_mod); - double table_tx_enc[time_vector_tx_enc.size]; - totable(table_tx_enc, &time_vector_tx_enc); - - double table_rx[time_vector_rx.size]; - totable(table_rx, &time_vector_rx); - double table_rx_fft[time_vector_rx_fft.size]; - totable(table_rx_fft, &time_vector_rx_fft); - double table_rx_demod[time_vector_rx_demod.size]; - totable(table_rx_demod, &time_vector_rx_demod); - double table_rx_dec[time_vector_rx_dec.size]; - totable(table_rx_dec, &time_vector_rx_dec); - - // sort table - qsort (table_tx, time_vector_tx.size, sizeof(double), &compare); - qsort (table_rx, time_vector_rx.size, sizeof(double), &compare); + qsort (dataArray(table_tx), table_tx->size, table_tx->atomSize, &cmpdouble); + qsort (dataArray(table_tx_ifft), table_tx_ifft->size, table_tx_ifft->atomSize, &cmpdouble); + qsort (dataArray(table_tx_mod), table_tx_mod->size, table_tx_mod->atomSize, &cmpdouble); + qsort (dataArray(table_tx_enc), table_tx_enc->size, table_tx_enc->atomSize, &cmpdouble); + qsort (dataArray(table_rx), table_rx->size, table_rx->atomSize, &cmpdouble); + qsort (dataArray(table_rx_fft), table_rx_fft->size, table_rx_fft->atomSize, &cmpdouble); + qsort (dataArray(table_rx_demod), table_rx_demod->size, table_rx_demod->atomSize, &cmpdouble); + qsort (dataArray(table_rx_dec), table_rx_dec->size, table_rx_dec->atomSize, &cmpdouble); if (dump_table == 1 ) { set_component_filelog(SIM); // file located in /tmp/usim.txt - LOG_UDUMPMSG(SIM,table_tx,time_vector_tx.size,LOG_DUMP_DOUBLE,"The transmitter raw data: \n"); - LOG_UDUMPMSG(SIM,table_rx,time_vector_rx.size,LOG_DUMP_DOUBLE,"Thereceiver raw data: \n"); + LOG_UDUMPMSG(SIM,table_tx,table_tx->size,LOG_DUMP_DOUBLE,"The transmitter raw data: \n"); + LOG_UDUMPMSG(SIM,table_rx,table_rx->size,LOG_DUMP_DOUBLE,"Thereceiver raw data: \n"); } - double tx_median = table_tx[time_vector_tx.size/2]; - double tx_q1 = table_tx[time_vector_tx.size/4]; - double tx_q3 = table_tx[3*time_vector_tx.size/4]; - - double tx_ifft_median = table_tx_ifft[time_vector_tx_ifft.size/2]; - double tx_ifft_q1 = table_tx_ifft[time_vector_tx_ifft.size/4]; - double tx_ifft_q3 = table_tx_ifft[3*time_vector_tx_ifft.size/4]; - - double tx_mod_median = table_tx_mod[time_vector_tx_mod.size/2]; - double tx_mod_q1 = table_tx_mod[time_vector_tx_mod.size/4]; - double tx_mod_q3 = table_tx_mod[3*time_vector_tx_mod.size/4]; - - double tx_enc_median = table_tx_enc[time_vector_tx_enc.size/2]; - double tx_enc_q1 = table_tx_enc[time_vector_tx_enc.size/4]; - double tx_enc_q3 = table_tx_enc[3*time_vector_tx_enc.size/4]; - - double rx_median = table_rx[time_vector_rx.size/2]; - double rx_q1 = table_rx[time_vector_rx.size/4]; - double rx_q3 = table_rx[3*time_vector_rx.size/4]; - - double rx_fft_median = table_rx_fft[time_vector_rx_fft.size/2]; - double rx_fft_q1 = table_rx_fft[time_vector_rx_fft.size/4]; - double rx_fft_q3 = table_rx_fft[3*time_vector_rx_fft.size/4]; - - double rx_demod_median = table_rx_demod[time_vector_rx_demod.size/2]; - double rx_demod_q1 = table_rx_demod[time_vector_rx_demod.size/4]; - double rx_demod_q3 = table_rx_demod[3*time_vector_rx_demod.size/4]; - - double rx_dec_median = table_rx_dec[time_vector_rx_dec.size/2]; - double rx_dec_q1 = table_rx_dec[time_vector_rx_dec.size/4]; - double rx_dec_q3 = table_rx_dec[3*time_vector_rx_dec.size/4]; - - double std_phy_proc_tx=0; - double std_phy_proc_tx_ifft=0; - double std_phy_proc_tx_mod=0; - double std_phy_proc_tx_enc=0; - - double std_phy_proc_rx=0; - double std_phy_proc_rx_fft=0; - double std_phy_proc_rx_demod=0; - double std_phy_proc_rx_dec=0; - effective_rate = 1.0-((double)(errs[0]+errs[1]+errs[2]+errs[3])/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3])); printf("\n**********************SNR = %f dB (tx_lev %f)**************************\n", @@ -2149,108 +1983,50 @@ int main(int argc, char **argv) (double)eNB->dlsch[0][0]->harq_processes[0]->TBS, (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])); + double timeBase=1/(1000*cpu_freq_GHz); if (print_perf==1) { - printf("eNB TX function statistics (per 1ms subframe)\n\n"); - std_phy_proc_tx = sqrt((double)eNB->phy_proc_tx.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/eNB->phy_proc_tx.trials - pow((double)eNB->phy_proc_tx.diff/eNB->phy_proc_tx.trials/cpu_freq_GHz/1000,2)); - std_phy_proc_tx_ifft = sqrt((double)eNB->ofdm_mod_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/eNB->ofdm_mod_stats.trials - pow((double)eNB->ofdm_mod_stats.diff/eNB->ofdm_mod_stats.trials/cpu_freq_GHz/1000,2)); - printf("OFDM_mod time :%f us (%d trials)\n",(double)eNB->ofdm_mod_stats.diff/eNB->ofdm_mod_stats.trials/cpu_freq_GHz/1000.0,eNB->ofdm_mod_stats.trials); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_tx_ifft, tx_ifft_median, tx_ifft_q1, tx_ifft_q3); - printf("Total PHY proc tx :%f us (%d trials)\n",(double)eNB->phy_proc_tx.diff/eNB->phy_proc_tx.trials/cpu_freq_GHz/1000.0,eNB->phy_proc_tx.trials); - printf("|__ Statistcs std: %fus max: %fus min: %fus median %fus q1 %fus q3 %fus n_dropped: %d packet \n",std_phy_proc_tx, t_tx_max, t_tx_min, tx_median, tx_q1, tx_q3, - n_tx_dropped); + printf("\neNB TX function statistics (per 1ms subframe)\n"); + printDistribution(&eNB->phy_proc_tx,table_tx,"PHY proc tx"); + printStatIndent(&eNB->dlsch_common_and_dci,"DL common channels and dci time"); + printStatIndent(&eNB->dlsch_ue_specific,"DL per ue part time"); + printStatIndent2(&eNB->dlsch_encoding_stats,"DLSCH encoding time"); + printStatIndent3(&eNB->dlsch_rate_matching_stats,"DLSCH rate matching time"); + printStatIndent3(&eNB->dlsch_turbo_encoding_stats,"DLSCH turbo encoding time"); + printStatIndent3(&eNB->dlsch_interleaving_stats,"DLSCH interleaving time"); + printStatIndent2(&eNB->dlsch_scrambling_stats, "DLSCH scrambling time"); + printStatIndent2(&eNB->dlsch_modulation_stats, "DLSCH modulation time"); + printDistribution(&eNB->ofdm_mod_stats,table_tx_ifft,"OFDM_mod (idft) time"); - std_phy_proc_tx_mod = sqrt((double)eNB->dlsch_modulation_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/eNB->dlsch_modulation_stats.trials - pow((double)eNB->dlsch_modulation_stats.diff/eNB->dlsch_modulation_stats.trials/cpu_freq_GHz/1000,2)); - printf("DLSCH modulation time :%f us (%d trials)\n",(double)eNB->dlsch_modulation_stats.diff/eNB->dlsch_modulation_stats.trials/cpu_freq_GHz/1000.0, - eNB->dlsch_modulation_stats.trials); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_tx_mod, tx_mod_median, tx_mod_q1, tx_mod_q3); - printf("DLSCH scrambling time :%f us (%d trials)\n",(double)eNB->dlsch_scrambling_stats.diff/eNB->dlsch_scrambling_stats.trials/cpu_freq_GHz/1000.0, - eNB->dlsch_scrambling_stats.trials); - std_phy_proc_tx_enc = sqrt((double)eNB->dlsch_encoding_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/eNB->dlsch_encoding_stats.trials - pow((double)eNB->dlsch_encoding_stats.diff/eNB->dlsch_encoding_stats.trials/cpu_freq_GHz/1000,2)); - printf("DLSCH encoding time :%f us (%d trials)\n",(double)eNB->dlsch_encoding_stats.diff/eNB->dlsch_encoding_stats.trials/cpu_freq_GHz/1000.0, - eNB->dlsch_modulation_stats.trials); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_tx_enc, tx_enc_median, tx_enc_q1, tx_enc_q3); - printf("|__ DLSCH turbo encoding time :%f us (%d trials)\n", - ((double)eNB->dlsch_turbo_encoding_stats.trials/eNB->dlsch_encoding_stats.trials)*(double) - eNB->dlsch_turbo_encoding_stats.diff/eNB->dlsch_turbo_encoding_stats.trials/cpu_freq_GHz/1000.0,eNB->dlsch_turbo_encoding_stats.trials); - printf("|__ DLSCH rate-matching time :%f us (%d trials)\n", - ((double)eNB->dlsch_rate_matching_stats.trials/eNB->dlsch_encoding_stats.trials)*(double) - eNB->dlsch_rate_matching_stats.diff/eNB->dlsch_rate_matching_stats.trials/cpu_freq_GHz/1000.0,eNB->dlsch_rate_matching_stats.trials); - printf("|__ DLSCH sub-block interleaving time :%f us (%d trials)\n", - ((double)eNB->dlsch_interleaving_stats.trials/eNB->dlsch_encoding_stats.trials)*(double) - eNB->dlsch_interleaving_stats.diff/eNB->dlsch_interleaving_stats.trials/cpu_freq_GHz/1000.0,eNB->dlsch_interleaving_stats.trials); + printf("\nUE RX function statistics (per 1ms subframe)\n"); + printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx"); + printStatIndent(&ue_front_end_tot,"Front end processing"); + printStatIndent(&dlsch_llr_tot,"rx_pdsch processing"); + printStatIndent2(&pdsch_procedures_tot,"pdsch processing"); + printStatIndent2(&dlsch_procedures_tot,"dlsch processing"); + printStatIndent2(&UE->crnti_procedures_stats,"C-RNTI processing"); + printStatIndent(&UE->ofdm_demod_stats,"ofdm demodulation"); + printStatIndent(&UE->dlsch_channel_estimation_stats,"DLSCH channel estimation time"); + printStatIndent(&UE->dlsch_freq_offset_estimation_stats,"DLSCH frequency offset estimation time"); + printStatIndent(&dlsch_decoding_tot, "DLSCH Decoding time "); + printStatIndent(&UE->dlsch_unscrambling_stats,"DLSCH unscrambling time"); + printStatIndent(&UE->dlsch_rate_unmatching_stats,"DLSCH Rate Unmatching"); + printf("|__ DLSCH Turbo Decoding(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n", + UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Cminus ? + UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kminus : + UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kplus, - printf("\n\nUE RX function statistics (per 1ms subframe)\n\n"); - std_phy_proc_rx = sqrt((double)UE->phy_proc_rx[UE->current_thread_id[subframe]].diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/UE->phy_proc_rx[UE->current_thread_id[subframe]].trials - pow((double)UE->phy_proc_rx[UE->current_thread_id[subframe]].diff/UE->phy_proc_rx[UE->current_thread_id[subframe]].trials/cpu_freq_GHz/1000,2)); - printf("Total PHY proc rx :%f us (%d trials)\n",(double)UE->phy_proc_rx[UE->current_thread_id[subframe]].diff/UE->phy_proc_rx[UE->current_thread_id[subframe]].trials/cpu_freq_GHz/1000.0, - UE->phy_proc_rx[UE->current_thread_id[subframe]].trials*2/3); - printf("|__Statistcs std: %fus max: %fus min: %fus median %fus q1 %fus q3 %fus n_dropped: %d packet \n", std_phy_proc_rx, t_rx_max, t_rx_min, rx_median, - rx_q1, rx_q3, n_rx_dropped); - std_phy_proc_rx_fft = sqrt((double)UE->ofdm_demod_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/UE->ofdm_demod_stats.trials - pow((double)UE->ofdm_demod_stats.diff/UE->ofdm_demod_stats.trials/cpu_freq_GHz/1000,2)); - printf("DLSCH OFDM demodulation and channel_estimation time :%f us (%d trials)\n",(nsymb)*(double)UE->ofdm_demod_stats.diff/UE->ofdm_demod_stats.trials/cpu_freq_GHz/1000.0, - UE->ofdm_demod_stats.trials*2/3); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_rx_fft, rx_fft_median, rx_fft_q1, rx_fft_q3); - printf("|__ DLSCH rx dft :%f us (%d trials)\n", - (nsymb*UE->frame_parms.nb_antennas_rx)*(double)UE->rx_dft_stats.diff/UE->rx_dft_stats.trials/cpu_freq_GHz/1000.0,UE->rx_dft_stats.trials*2/3); - printf("|__ DLSCH channel estimation time :%f us (%d trials)\n", - (4.0)*(double)UE->dlsch_channel_estimation_stats.diff/UE->dlsch_channel_estimation_stats.trials/cpu_freq_GHz/1000.0,UE->dlsch_channel_estimation_stats.trials*2/3); - printf("|__ DLSCH frequency offset estimation time :%f us (%d trials)\n", - (4.0)*(double)UE->dlsch_freq_offset_estimation_stats.diff/UE->dlsch_freq_offset_estimation_stats.trials/cpu_freq_GHz/1000.0, - UE->dlsch_freq_offset_estimation_stats.trials*2/3); - printf("DLSCH rx pdcch :%f us (%d trials)\n",(double)UE->dlsch_rx_pdcch_stats.diff/UE->dlsch_rx_pdcch_stats.trials/cpu_freq_GHz/1000.0, - UE->dlsch_rx_pdcch_stats.trials); - std_phy_proc_rx_demod = sqrt((double)UE->dlsch_llr_stats.diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/UE->dlsch_llr_stats.trials - pow((double)UE->dlsch_llr_stats.diff/UE->dlsch_llr_stats.trials/cpu_freq_GHz/1000,2)); - printf("DLSCH Channel Compensation and LLR generation time :%f us (%d trials)\n",(14-num_pdcch_symbols)*(double)UE->dlsch_llr_stats.diff/UE->dlsch_llr_stats.trials/cpu_freq_GHz/1000.0, - UE->dlsch_llr_stats.trials/3); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_rx_demod, rx_demod_median, rx_demod_q1, rx_demod_q3); - printf("DLSCH unscrambling time :%f us (%d trials)\n",(double)UE->dlsch_unscrambling_stats.diff/UE->dlsch_unscrambling_stats.trials/cpu_freq_GHz/1000.0, - UE->dlsch_unscrambling_stats.trials); - std_phy_proc_rx_dec = sqrt((double)UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].diff_square/pow(cpu_freq_GHz,2)/pow(1000, - 2)/UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials - pow((double)UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].diff/UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials/cpu_freq_GHz/1000,2)); - printf("DLSCH Decoding time (%02.2f Mbit/s, avg iter %1.2f) :%f us (%d trials, max %f)\n", - eNB->dlsch[0][0]->harq_processes[0]->TBS/1000.0,(double)avg_iter/iter_trials, - (double)UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].diff/UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials/cpu_freq_GHz/1000.0,UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials, - (double)UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].max/cpu_freq_GHz/1000.0); - printf("|__ Statistcs std: %fus median %fus q1 %fus q3 %fus \n",std_phy_proc_rx_dec, rx_dec_median, rx_dec_q1, rx_dec_q3); - printf("|__ DLSCH Rate Unmatching :%f us (%d trials)\n", - (double)UE->dlsch_rate_unmatching_stats.diff/UE->dlsch_rate_unmatching_stats.trials/cpu_freq_GHz/1000.0,UE->dlsch_rate_unmatching_stats.trials); - printf("|__ DLSCH Turbo Decoding(%d bits) :%f us (%d trials)\n", - UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Cminus ? UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kminus : UE->dlsch[UE->current_thread_id[subframe]][0][0]->harq_processes[0]->Kplus, - (double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials/cpu_freq_GHz/1000.0,UE->dlsch_turbo_decoding_stats.trials); - printf(" |__ init %f us (cycles/iter %f, %d trials)\n", - (double)UE->dlsch_tc_init_stats.diff/UE->dlsch_tc_init_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_init_stats.diff/UE->dlsch_tc_init_stats.trials/((double)avg_iter/iter_trials), - UE->dlsch_tc_init_stats.trials); - printf(" |__ alpha %f us (cycles/iter %f, %d trials)\n", - (double)UE->dlsch_tc_alpha_stats.diff/UE->dlsch_tc_alpha_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_alpha_stats.diff/UE->dlsch_tc_alpha_stats.trials*2, - UE->dlsch_tc_alpha_stats.trials); - printf(" |__ beta %f us (cycles/iter %f,%d trials)\n", - (double)UE->dlsch_tc_beta_stats.diff/UE->dlsch_tc_beta_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_beta_stats.diff/UE->dlsch_tc_beta_stats.trials*2, - UE->dlsch_tc_beta_stats.trials); - printf(" |__ gamma %f us (cycles/iter %f,%d trials)\n", - (double)UE->dlsch_tc_gamma_stats.diff/UE->dlsch_tc_gamma_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_gamma_stats.diff/UE->dlsch_tc_gamma_stats.trials*2, - UE->dlsch_tc_gamma_stats.trials); - printf(" |__ ext %f us (cycles/iter %f,%d trials)\n", - (double)UE->dlsch_tc_ext_stats.diff/UE->dlsch_tc_ext_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_ext_stats.diff/UE->dlsch_tc_ext_stats.trials*2, - UE->dlsch_tc_ext_stats.trials); - printf(" |__ intl1 %f us (cycles/iter %f,%d trials)\n", - (double)UE->dlsch_tc_intl1_stats.diff/UE->dlsch_tc_intl1_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_intl1_stats.diff/UE->dlsch_tc_intl1_stats.trials, - UE->dlsch_tc_intl1_stats.trials); - printf(" |__ intl2+HD+CRC %f us (cycles/iter %f,%d trials)\n", - (double)UE->dlsch_tc_intl2_stats.diff/UE->dlsch_tc_intl2_stats.trials/cpu_freq_GHz/1000.0, - (double)UE->dlsch_tc_intl2_stats.diff/UE->dlsch_tc_intl2_stats.trials, - UE->dlsch_tc_intl2_stats.trials); + UE->dlsch_tc_intl1_stats.trials/(double)UE->dlsch_tc_init_stats.trials, + (double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials*timeBase, + (int)((double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials), + UE->dlsch_turbo_decoding_stats.trials); + printStatIndent2(&UE->dlsch_tc_init_stats,"init"); + printStatIndent2(&UE->dlsch_tc_alpha_stats,"alpha"); + printStatIndent2(&UE->dlsch_tc_beta_stats,"beta"); + printStatIndent2(&UE->dlsch_tc_gamma_stats,"gamma"); + printStatIndent2(&UE->dlsch_tc_ext_stats,"ext"); + printStatIndent2(&UE->dlsch_tc_intl1_stats,"turbo internal interleaver"); + printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC"); + } if ((transmission_mode != 3) && (transmission_mode != 4)) { @@ -2399,7 +2175,7 @@ int main(int argc, char **argv) eNB->dlsch_modulation_stats.trials, eNB->dlsch_scrambling_stats.trials, eNB->dlsch_encoding_stats.trials, - UE->phy_proc_rx[UE->current_thread_id[subframe]].trials, + phy_proc_rx_tot.trials, UE->ofdm_demod_stats.trials, UE->dlsch_rx_pdcch_stats.trials, UE->dlsch_llr_stats.trials, @@ -2412,7 +2188,7 @@ int main(int argc, char **argv) get_time_meas_us(&eNB->dlsch_modulation_stats), get_time_meas_us(&eNB->dlsch_scrambling_stats), get_time_meas_us(&eNB->dlsch_encoding_stats), - get_time_meas_us(&UE->phy_proc_rx[UE->current_thread_id[subframe]]), + get_time_meas_us(&phy_proc_rx_tot), nsymb*get_time_meas_us(&UE->ofdm_demod_stats), get_time_meas_us(&UE->dlsch_rx_pdcch_stats), 3*get_time_meas_us(&UE->dlsch_llr_stats), @@ -2420,45 +2196,36 @@ int main(int argc, char **argv) get_time_meas_us(&UE->dlsch_decoding_stats[UE->current_thread_id[subframe]]) ); //fprintf(time_meas_fd,"eNB_PROC_TX_STD;eNB_PROC_TX_MAX;eNB_PROC_TX_MIN;eNB_PROC_TX_MED;eNB_PROC_TX_Q1;eNB_PROC_TX_Q3;eNB_PROC_TX_DROPPED;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;", std_phy_proc_tx, t_tx_max, t_tx_min, tx_median, tx_q1, tx_q3, n_tx_dropped); - + fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped); //fprintf(time_meas_fd,"IFFT;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;", std_phy_proc_tx_ifft, tx_ifft_median, tx_ifft_q1, tx_ifft_q3); - + fprintf(time_meas_fd,"%f;%f;%f;%f;", + squareRoot(&eNB->ofdm_mod_stats), + median(table_tx_ifft),q1(table_tx_ifft),q3(table_tx_ifft)); //fprintf(time_meas_fd,"MOD;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;", std_phy_proc_tx_mod, tx_mod_median, tx_mod_q1, tx_mod_q3); - + fprintf(time_meas_fd,"%f;%f;%f;%f;", + squareRoot(&eNB->dlsch_modulation_stats), + median(table_tx_mod), q1(table_tx_mod), q3(table_tx_mod)); //fprintf(time_meas_fd,"ENC;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;", std_phy_proc_tx_enc, tx_enc_median, tx_enc_q1, tx_enc_q3); - - - //fprintf(time_meas_fd,"UE_PROC_RX_STD;UE_PROC_RX_MAX;UE_PROC_RX_MIN;UE_PROC_RX_MED;UE_PROC_RX_Q1;UE_PROC_RX_Q3;UE_PROC_RX_DROPPED;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;", std_phy_proc_rx, t_rx_max, t_rx_min, rx_median, rx_q1, rx_q3, n_rx_dropped); - + fprintf(time_meas_fd,"%f;%f;%f;%f;", + squareRoot(&eNB->dlsch_encoding_stats), + median(table_tx_enc),q1(table_tx_enc),q3(table_tx_enc)); + //fprintf(time_meas_fd,"eNB_PROC_RX_STD;eNB_PROC_RX_MAX;eNB_PROC_RX_MIN;eNB_PROC_RX_MED;eNB_PROC_RX_Q1;eNB_PROC_RX_Q3;eNB_PROC_RX_DROPPED;\n"); + fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;", + squareRoot(&phy_proc_rx_tot), t_rx_max, t_rx_min, + median(table_rx), q1(table_rx), q3(table_rx), n_rx_dropped); //fprintf(time_meas_fd,"FFT;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;", std_phy_proc_rx_fft, rx_fft_median, rx_fft_q1, rx_fft_q3); - + fprintf(time_meas_fd,"%f;%f;%f;%f;", + squareRoot(&UE->ofdm_demod_stats), + median(table_rx_fft), q1(table_rx_fft), q3(table_rx_fft)); //fprintf(time_meas_fd,"DEMOD;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f;", std_phy_proc_rx_demod,rx_demod_median, rx_demod_q1, rx_demod_q3); - + fprintf(time_meas_fd,"%f;%f;%f;%f;", + squareRoot(&UE->dlsch_demodulation_stats), + median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod)); //fprintf(time_meas_fd,"DEC;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f\n", std_phy_proc_rx_dec, rx_dec_median, rx_dec_q1, rx_dec_q3); + fprintf(time_meas_fd,"%f;%f;%f;%f\n", + squareRoot(&UE->dlsch_decoding_stats[subframe]), + median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec)); - - /* - fprintf(time_meas_fd,"%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;", - eNB->phy_proc_tx.trials, - eNB->ofdm_mod_stats.trials, - eNB->dlsch_modulation_stats.trials, - eNB->dlsch_scrambling_stats.trials, - eNB->dlsch_encoding_stats.trials, - UE->phy_proc_rx[UE->current_thread_id[subframe]].trials, - UE->ofdm_demod_stats.trials, - UE->dlsch_rx_pdcch_stats.trials, - UE->dlsch_llr_stats.trials, - UE->dlsch_unscrambling_stats.trials, - UE->dlsch_decoding_stats[UE->current_thread_id[subframe]].trials); - */ printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate ); test_passed = 1; break; diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index ac442ae5e9..569d2226de 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -750,7 +750,7 @@ int main(int argc, char **argv) 0, 0); - eNB_rxtx_proc_t *proc_rxtx = &eNB->proc.proc_rxtx[subframe&1]; + L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx; eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0); UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 8c09da1daf..24338e1370 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -1,23 +1,23 @@ /* - 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 -*/ + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file ulsim.c \brief Top-level UL simulator @@ -60,32 +60,7 @@ double cpuf; #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction -static int cmpdouble(const void *p1, const void *p2) { - return *(double *)p1 > *(double *)p2; -} - -double median(varArray_t *input) { - return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize); -} - -double q1(varArray_t *input) { - return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize); -} - -double q3(varArray_t *input) { - return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize); -} - -void dumpVarArray(varArray_t *input) { - double *ptr=dataArray(input); - printf("dumping size=%ld\n", input->size); - - for (int i=0; i < input->size; i++) - printf("%.1f:", *ptr++); - - printf("\n"); -} - +#include channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX]; //Added for PHY abstractionopenair1/PHY/TOOLS/lte_phy_scope.h @@ -110,8 +85,8 @@ int nfapi_mode = 0; extern void fep_full(RU_t *ru); extern void ru_fep_full_2thread(RU_t *ru); -extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); -extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); +extern void eNB_fep_full(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc); +extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc); nfapi_dl_config_request_t DL_req; nfapi_ul_config_request_t UL_req; @@ -121,30 +96,7 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU]; nfapi_tx_request_t TX_req; Sched_Rsp_t sched_resp; -char *parallel_config = NULL; -char *worker_config = NULL; -static THREAD_STRUCT thread_struct; -void set_parallel_conf(char *parallel_conf) -{ - if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT; - printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf); -} -void set_worker_conf(char *worker_conf) -{ - if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE; - else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE; - printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf); -} -PARALLEL_CONF_t get_thread_parallel_conf(void) -{ - return thread_struct.parallel_conf; -} -WORKER_CONF_t get_thread_worker_conf(void) -{ - return thread_struct.worker_conf; -} +THREAD_STRUCT thread_struct; void fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu, @@ -348,48 +300,8 @@ void fill_ulsch_dci(PHY_VARS_eNB *eNB, ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; } -void printStatIndent(time_stats_t *ptr, char *txt) { - printf("|__ %-50s %.2f us (%d trials)\n", - txt, - inMicroS(ptr->diff/ptr->trials), - ptr->trials); -} - -void printStatIndent2(time_stats_t *ptr, char *txt, int turbo_iter) { - double timeBase=1/(1000*cpu_freq_GHz); - printf(" |__ %-45s %.2f us (cycles/block %7g, %5d trials)\n", - txt, - ((double)ptr->diff)/ptr->trials*timeBase, - round(((double)ptr->diff)/turbo_iter), - ptr->trials); -} - -double squareRoot(time_stats_t *ptr) { - double timeBase=1/(1000*cpu_freq_GHz); - return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials - - pow((double)ptr->diff/ptr->trials*timeBase,2)); -} - -void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); - printf("%-50s :%.2f us (%d trials)\n", - txt, - (double)ptr->diff/ptr->trials*timeBase, - ptr->trials); - printf("|__ Statistics std=%.2f, median=%.2f, q1=%.2f, q3=%.2f µs (on %ld trials)\n", - squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList), sortedList->size); -} - -void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dropped) { - fprintf(fd,"%f;%f;%f;%f;%f;%f;%d;", - squareRoot(ptr), - (double)ptr->max, *(double*)dataArray(sortedList), - median(sortedList),q1(sortedList),q3(sortedList), - dropped); -} - enum eTypes { eBool, eInt, eFloat, eText }; -static int verbose,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1; +static int verbose,help,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1; int main(int argc, char **argv) { int i,j,aa,u; @@ -475,7 +387,6 @@ int main(int argc, char **argv) { double effective_rate=0.0; char channel_model_input[10]= {0}; static int max_turbo_iterations=4; - static int parallel_flag=0; int nb_rb_set = 0; int sf; static int threequarter_fs=0; @@ -493,8 +404,10 @@ int main(int argc, char **argv) { TX_req.tx_request_body.tx_pdu_list = tx_pdu_list; cpu_freq_GHz = (double)get_cpu_freq_GHz(); cpuf = cpu_freq_GHz; + set_parallel_conf("PARALLEL_SINGLE_THREAD"); + printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz); - AssertFatal(load_configmodule(argc,argv) != NULL, + AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "cannot load configuration module, exiting\n"); logInit(); // enable these lines if you need debug info @@ -505,13 +418,13 @@ int main(int argc, char **argv) { //set_glog(LOG_DEBUG,LOG_MED); //hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF static paramdef_t options[] = { - { "awgn", "Additive white gaussian noise", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, + { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 }, { "mcs", "The MCS to use", 0, iptr:&mcs, defintval:10, TYPE_INT, 0 }, { "nb_frame", "number of frame in a test",0, iptr:&n_frames, defintval:1, TYPE_INT, 0 }, { "snr", "starting snr", 0, dblptr:&snr0, defdblval:-2.9, TYPE_DOUBLE, 0 }, { "wsnrInterrupt", "snr int ?", 0, dblptr:&snr_int, defdblval:30, TYPE_DOUBLE, 0 }, - { "e_snr_step", "step increasint snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 }, + { "e_snr_step", "step increasing snr",0, dblptr:&input_snr_step, defdblval:0.2, TYPE_DOUBLE, 0 }, { "rb_dynamic", "number of rb in dynamic allocation",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, { "first_rb", "first rb used in dynamic allocation",0, iptr:&first_rb, defintval:0, TYPE_INT, 0 }, { "osrs", "enable srs generation",PARAMFLAG_BOOL, iptr:&srs_flag, defintval:0, TYPE_INT, 0 }, @@ -520,7 +433,7 @@ int main(int argc, char **argv) { { "Doppler", "Maximum doppler shift",0, dblptr:&maxDoppler, defdblval:0.0, TYPE_DOUBLE, 0 }, { "Zdump", "dump table",PARAMFLAG_BOOL, iptr:&dump_table, defintval:0, TYPE_INT, 0 }, { "Forms", "Display the soft scope", PARAMFLAG_BOOL, iptr:&xforms, defintval:0, TYPE_INT, 0 }, - { "Lparallel", "Enable parallel execution", PARAMFLAG_BOOL, iptr:¶llel_flag, defintval:0, TYPE_INT, 0 }, + { "Lparallel", "Enable parallel execution",0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0 }, { "Iterations", "Number of iterations of turbo decoder", 0, iptr:&max_turbo_iterations, defintval:4, TYPE_INT, 0 }, { "Performance", "Display CPU perfomance of each L1 piece", PARAMFLAG_BOOL, iptr:NULL, defintval:0, TYPE_INT, 0 }, { "Q_cqi", "Enable CQI", PARAMFLAG_BOOL, iptr:&cqi_flag, defintval:0, TYPE_INT, 0 }, @@ -538,37 +451,12 @@ int main(int argc, char **argv) { { "bundling_disable", "bundling disable",PARAMFLAG_BOOL, iptr:&disable_bundling, defintval:0, TYPE_INT, 0 }, { "Y", "n_ch_rlz",0, iptr:&n_ch_rlz, defintval:1, TYPE_INT, 0 }, { "X", "abstx", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 }, - { "Operf", "test perf mode ?",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 }, + { "Operf", "Set the percentage of effective rate to testbench the modem performance (typically 30 and 70, range 1-100)",0, iptr:&test_perf, defintval:0, TYPE_INT, 0 }, { "verbose", "display debug text", PARAMFLAG_BOOL, iptr:&verbose, defintval:0, TYPE_INT, 0 }, + { "help", "display help and exit", PARAMFLAG_BOOL, iptr:&help, defintval:0, TYPE_INT, 0 }, { "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 }, }; - int l; - - for(l=0; options[l].optname[0]!=0; l++) {}; - - struct option *long_options=calloc(sizeof(struct option),l); - - for(int i=0; options[i].optname[0]!=0; i++) { - long_options[i].name=options[i].optname; - long_options[i].has_arg=options[i].paramflags==PARAMFLAG_BOOL?no_argument:required_argument; - - if ( options[i].voidptr) - switch (options[i].type) { - case TYPE_INT: - *options[i].iptr=options[i].defintval; - break; - - case TYPE_DOUBLE: - *options[i].dblptr=options[i].defdblval; - break; - - default: - printf("not parsed type for default value %s\n", options[i].optname ); - exit(1); - } - - continue; - }; + struct option * long_options = parse_oai_options(options); int option_index; @@ -579,113 +467,125 @@ int main(int argc, char **argv) { if (long_options[option_index].has_arg==no_argument) *(bool *)options[option_index].iptr=1; else switch (options[option_index].type) { - case TYPE_INT: - *(int *)options[option_index].iptr=atoi(optarg); - break; + case TYPE_INT: + *(int *)options[option_index].iptr=atoi(optarg); + break; - case TYPE_DOUBLE: - *(double *)options[option_index].dblptr=atof(optarg); - break; + case TYPE_DOUBLE: + *(double *)options[option_index].dblptr=atof(optarg); + break; - default: - printf("not decoded type.\n"); - exit(1); + case TYPE_UINT8: + *(uint8_t *)options[option_index].dblptr=atoi(optarg); + break; + + case TYPE_UINT16: + *(uint16_t *)options[option_index].dblptr=atoi(optarg); + break; + + default: + printf("not decoded type.\n"); + exit(1); } continue; } switch (long_options[option_index].name[0]) { - case 'T': - tdd_config=atoi(optarg); - frame_type=TDD; - break; + case 'T': + tdd_config=atoi(optarg); + frame_type=TDD; + break; - case 'a': - channel_model = AWGN; - chMod = 1; - break; + case 'a': + channel_model = AWGN; + chMod = 1; + break; - case 'g': - strncpy(channel_model_input,optarg,9); - struct tmp { - char opt; - int m; - int M; - } - tmp[]= { - {'A',SCM_A,2}, - {'B',SCM_B,3}, - {'C',SCM_C,4}, - {'D',SCM_D,5}, - {'E',EPA,6}, - {'G',ETU,8}, - {'H',Rayleigh8,9}, - {'I',Rayleigh1,10}, - {'J',Rayleigh1_corr,11}, - {'K',Rayleigh1_anticorr,12}, - {'L',Rice8,13}, - {'M',Rice1,14}, - {'N',AWGN,1}, - {0,0,0} - }; - struct tmp *ptr; + case 'g': + strncpy(channel_model_input,optarg,9); + struct tmp { + char opt; + int m; + int M; + } + tmp[]= { + {'A',SCM_A,2}, + {'B',SCM_B,3}, + {'C',SCM_C,4}, + {'D',SCM_D,5}, + {'E',EPA,6}, + {'G',ETU,8}, + {'H',Rayleigh8,9}, + {'I',Rayleigh1,10}, + {'J',Rayleigh1_corr,11}, + {'K',Rayleigh1_anticorr,12}, + {'L',Rice8,13}, + {'M',Rice1,14}, + {'N',AWGN,1}, + {0,0,0} + }; + struct tmp *ptr; - for (ptr=tmp; ptr->opt!=0; ptr++) - if ( ptr->opt == optarg[0] ) { - channel_model=ptr->m; - chMod=ptr->M; - break; - } + for (ptr=tmp; ptr->opt!=0; ptr++) + if ( ptr->opt == optarg[0] ) { + channel_model=ptr->m; + chMod=ptr->M; + break; + } - AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg ); - break; + AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg ); + break; - case 'x': - transmission_m=atoi(optarg); - AssertFatal(transmission_m==1 || transmission_m==2, - "Unsupported transmission mode %d\n",transmission_m); - break; + case 'x': + transmission_m=atoi(optarg); + AssertFatal(transmission_m==1 || transmission_m==2, + "Unsupported transmission mode %d\n",transmission_m); + break; - case 'r': - nb_rb = atoi(optarg); - nb_rb_set = 1; - break; + case 'r': + nb_rb = atoi(optarg); + nb_rb_set = 1; + break; //case 'c': // cyclic_shift = atoi(optarg); // break; - case 'i': - input_fdUL = fopen(optarg,"r"); - printf("Reading in %s (%p)\n",optarg,input_fdUL); - AssertFatal(input_fdUL != (FILE *)NULL,"Unknown file %s\n",optarg); - break; + case 'i': + input_fdUL = fopen(optarg,"r"); + printf("Reading in %s (%p)\n",optarg,input_fdUL); + AssertFatal(input_fdUL != (FILE *)NULL,"Unknown file %s\n",optarg); + break; - case 'A': - beta_ACK = atoi(optarg); - AssertFatal(beta_ACK>15,"beta_ack must be in (0..15)\n"); - break; + case 'A': + beta_ACK = atoi(optarg); + AssertFatal(beta_ACK>15,"beta_ack must be in (0..15)\n"); + break; - case 'C': - beta_CQI = atoi(optarg); - AssertFatal((beta_CQI>15)||(beta_CQI<2),"beta_cqi must be in (2..15)\n"); - break; + case 'C': + beta_CQI = atoi(optarg); + AssertFatal((beta_CQI>15)||(beta_CQI<2),"beta_cqi must be in (2..15)\n"); + break; - case 'R': - beta_RI = atoi(optarg); - AssertFatal((beta_RI>15)||(beta_RI<2),"beta_ri must be in (0..13)\n"); - break; + case 'R': + beta_RI = atoi(optarg); + AssertFatal((beta_RI>15)||(beta_RI<2),"beta_ri must be in (0..13)\n"); + break; - case 'P': - dump_perf=1; - opp_enabled=1; - break; + case 'P': + dump_perf=1; + opp_enabled=1; + break; - default: - printf("Wrong option\n"); - exit(1); - break; + case 'L': + set_parallel_conf(optarg); + break; + + default: + printf("Wrong option: %s\n",long_options[option_index].name); + exit(1); + break; } } @@ -694,36 +594,14 @@ int main(int argc, char **argv) { exit(1); } - paramdef_t *ptr=options ; - for( ptr=options; ptr->optname[0]!=0; ptr++) { - char varText[256]="need specific display"; - - if (ptr->voidptr != NULL) { - if ( (ptr->paramflags & PARAMFLAG_BOOL) ) - strcpy(varText, *(bool *)ptr->iptr ? "True": "False" ); - else switch (ptr->type) { - case TYPE_INT: - sprintf(varText,"%d",*ptr->iptr); - break; - - case TYPE_DOUBLE: - sprintf(varText,"%.2f",*ptr->dblptr); - break; - - default: - printf("not decoded type\n"); - exit(1); - } - } - - printf("Option: %20s set to %s\n",ptr->optname, varText); - - if (verbose) - printf("%s\n",ptr->helpstr); - } - set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT"); - set_worker_conf("WORKER_ENABLE"); + if (help || verbose ) + display_options_values(options, true); + if (help) + exit(0); + + if (thread_struct.parallel_conf != PARALLEL_SINGLE_THREAD) + set_worker_conf("WORKER_ENABLE"); RC.nb_L1_inst = 1; RC.nb_RU = 1; lte_param_init(&eNB,&UE,&ru, @@ -871,7 +749,7 @@ int main(int argc, char **argv) { UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); printf("ULSCH %p\n",UE->ulsch[0]); - if (parallel_flag == 1) { + if(get_thread_worker_conf() == WORKER_ENABLE) { extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *); extern void init_td_thread(PHY_VARS_eNB *); init_fep_thread(eNB,NULL); @@ -922,7 +800,7 @@ int main(int argc, char **argv) { UE->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; eNB->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; UE->mac_enabled=0; - eNB_rxtx_proc_t *proc_rxtx = &eNB->proc.proc_rxtx[subframe&1]; + L1_rxtx_proc_t *proc_rxtx = &eNB->proc.L1_proc; UE_rxtx_proc_t *proc_rxtx_ue = &UE->proc.proc_rxtx[subframe&1]; proc_rxtx->frame_rx=1; proc_rxtx->subframe_rx=subframe; @@ -1279,8 +1157,7 @@ int main(int argc, char **argv) { } start_meas(&eNB->phy_proc_rx); - ru->feprx = (parallel_flag == 1) ? ru_fep_full_2thread : fep_full; - eNB->td = (parallel_flag == 1) ? ulsch_decoding_data_2thread : ulsch_decoding_data; + ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full; ru->feprx(ru); phy_procedures_eNB_uespec_RX(eNB,proc_rxtx); stop_meas(&eNB->phy_proc_rx); @@ -1481,20 +1358,18 @@ int main(int argc, char **argv) { printStatIndent(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time"); printStatIndent(&UE->ulsch_interleaving_stats,"ULSCH sub-block interleaving"); printStatIndent(&UE->ulsch_multiplexing_stats,"ULSCH multiplexing time"); - printDistribution(&eNB->phy_proc_rx,table_rx,"\nTotal PHY proc rx subframe"); - printDistribution(&ru->ofdm_demod_stats,table_rx_fft,"OFDM_demod time"); - printDistribution(&eNB->ulsch_demodulation_stats,table_rx_demod,"ULSCH demodulation time"); - printf("ULSCH Decoding time (%.2f Mbit/s, avg iter %.2f) :%.2f us (%d trials, max %.2f)\n", - UE->ulsch[0]->harq_processes[harq_pid]->TBS/1000.0,(double)iter_trials, - (double)eNB->ulsch_decoding_stats.diff/eNB->ulsch_decoding_stats.trials*timeBase, - eNB->ulsch_decoding_stats.trials, - (double)eNB->ulsch_decoding_stats.max*timeBase); - printf("|__ Statistics std: %.2fus median %.2fus q1 %.2fus q3 %.2fus \n", - squareRoot(&eNB->ulsch_decoding_stats), - median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec)); - printStatIndent(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" ); - printStatIndent(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" ); - printStatIndent(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" ); + printf("\n"); + printDistribution(&eNB->phy_proc_rx,table_rx,"Total PHY proc rx subframe"); + printDistribution(&ru->ofdm_demod_stats,table_rx_fft,"|__ OFDM_demod time"); + printDistribution(&eNB->ulsch_demodulation_stats,table_rx_demod,"|__ ULSCH demodulation time"); + printDistribution(&eNB->ulsch_decoding_stats,table_rx_dec,"|__ ULSCH Decoding time"); + printf(" (%.2f Mbit/s, avg iter %.2f, max %.2f)\n", + UE->ulsch[0]->harq_processes[harq_pid]->TBS/1000.0, + (double)iter_trials, + (double)eNB->ulsch_decoding_stats.max*timeBase); + printStatIndent2(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" ); + printStatIndent2(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" ); + printStatIndent2(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" ); printf("|__ turbo_decoder(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n", eNB->ulsch[0]->harq_processes[harq_pid]->Cminus ? eNB->ulsch[0]->harq_processes[harq_pid]->Kminus : @@ -1503,13 +1378,13 @@ int main(int argc, char **argv) { (double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials*timeBase, (int)((double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials), eNB->ulsch_turbo_decoding_stats.trials); - printStatIndent2(&eNB->ulsch_tc_init_stats,"init", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_alpha_stats,"alpha", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_beta_stats,"beta", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_gamma_stats,"gamma", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_ext_stats,"ext", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_intl1_stats,"turbo internal interleaver", eNB->ulsch_tc_init_stats.trials); - printStatIndent2(&eNB->ulsch_tc_intl2_stats,"intl2+HardDecode+CRC", eNB->ulsch_tc_init_stats.trials); + printStatIndent3(&eNB->ulsch_tc_init_stats,"init"); + printStatIndent3(&eNB->ulsch_tc_alpha_stats,"alpha"); + printStatIndent3(&eNB->ulsch_tc_beta_stats,"beta"); + printStatIndent3(&eNB->ulsch_tc_gamma_stats,"gamma"); + printStatIndent3(&eNB->ulsch_tc_ext_stats,"ext"); + printStatIndent3(&eNB->ulsch_tc_intl1_stats,"turbo internal interleaver"); + printStatIndent3(&eNB->ulsch_tc_intl2_stats,"intl2+HardDecode+CRC"); } if(abstx) { //ABSTRACTION diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 0118a78f6d..c398b55e3e 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -22,10 +22,10 @@ #ifndef GTPV1_U_MESSAGES_TYPES_H_ #define GTPV1_U_MESSAGES_TYPES_H_ -#include "asn_constant.h" +#include "LTE_asn_constant.h" -#define GTPV1U_MAX_BEARERS_PER_UE max_val_DRB_Identity +#define GTPV1U_MAX_BEARERS_PER_UE max_val_LTE_DRB_Identity #define GTPV1U_ENB_UPDATE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelReq #define GTPV1U_ENB_UPDATE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelResp diff --git a/openair2/COMMON/intertask_interface_conf.h b/openair2/COMMON/intertask_interface_conf.h deleted file mode 100644 index 9c108f87e0..0000000000 --- a/openair2/COMMON/intertask_interface_conf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/* - * intertask_interface_conf.h - * - * Created on: Oct 21, 2013 - * Author: winckel - */ - -#ifndef INTERTASK_INTERFACE_CONF_H_ -#define INTERTASK_INTERFACE_CONF_H_ - -/******************************************************************************* - * Intertask Interface Constants - ******************************************************************************/ - -#define ITTI_PORT (10006) - -/* This is the queue size for signal dumper */ -#define ITTI_QUEUE_MAX_ELEMENTS (10 * 1000) -#define ITTI_DUMP_MAX_CON (5) /* Max connections in parallel */ - -#endif /* INTERTASK_INTERFACE_CONF_H_ */ diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index d902de15d9..0141220235 100644 --- a/openair2/COMMON/mac_rrc_primitives.h +++ b/openair2/COMMON/mac_rrc_primitives.h @@ -30,13 +30,13 @@ #include "COMMON/platform_types.h" #include "COMMON/platform_constants.h" -#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "MeasGapConfig.h" -#include "TDD-Config.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MBSFN-AreaInfoList-r9.h" -#include "MBSFN-SubframeConfigList.h" +#include "LTE_RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_MeasGapConfig.h" +#include "LTE_TDD-Config.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_MBSFN-AreaInfoList-r9.h" +#include "LTE_MBSFN-SubframeConfigList.h" #endif //#include "rrm_config_structs.h" //#include "platform_types.h" @@ -347,25 +347,25 @@ typedef struct { void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*); signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t ); int (*rrc_mac_config_req)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t UE_id,uint8_t eNB_index, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - struct PhysicalConfigDedicated *physicalConfigDedicated, - MAC_MainConfig_t *mac_MainConfig, + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, + LTE_MAC_MainConfig_t *mac_MainConfig, long logicalChannelIdentity, - LogicalChannelConfig_t *logicalChannelConfig, - MeasGapConfig_t *measGapConfig, - TDD_Config_t *tdd_Config, + LTE_LogicalChannelConfig_t *logicalChannelConfig, + LTE_MeasGapConfig_t *measGapConfig, + LTE_TDD_Config_t *tdd_Config, uint8_t *SIwindowsize, uint16_t *SIperiod -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , MBMS_flag_t MBMS_Flag, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList, - MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList, - struct PMCH_InfoList_r9 *pmch_InfoList + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList, + LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList, + struct LTE_PMCH_InfoList_r9 *pmch_InfoList #endif ); unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, const unsigned int,char* -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,uint32_t ,uint32_t #endif @@ -373,7 +373,7 @@ typedef struct { void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* ); mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, sub_frame_t subframeP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, logical_chan_id_t channel_idP, tb_size_t tb_sizeP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,uint32_t sourceL2Id ,uint32_t destinationL2Id #endif diff --git a/openair2/COMMON/messages_types.h b/openair2/COMMON/messages_types.h deleted file mode 100644 index 5e5fdadd2a..0000000000 --- a/openair2/COMMON/messages_types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/* - * messages_types.h - * - * Created on: Oct 14, 2013 - * Author: winckel - */ - -#ifndef MESSAGES_TYPES_H_ -#define MESSAGES_TYPES_H_ - -#include "intertask_messages_types.h" -#include "timer_messages_types.h" - -#include "phy_messages_types.h" -#include "mac_messages_types.h" -#include "rlc_messages_types.h" -#include "pdcp_messages_types.h" -#include "rrc_messages_types.h" -#include "nas_messages_types.h" -#if ENABLE_RAL -#include "ral_messages_types.h" -#endif -#include "s1ap_messages_types.h" -#include "x2ap_messages_types.h" -#include "sctp_messages_types.h" -#include "udp_messages_types.h" -#include "gtpv1_u_messages_types.h" - -#endif /* MESSAGES_TYPES_H_ */ diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 9aa912a01e..2b28b760a8 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -28,11 +28,7 @@ ***************************************************************************/ -#ifdef CMAKER -#include "asn_constant.h" -#else -#include "RRC/LTE/MESSAGES/asn1_constants.h" -#endif +#include "LTE_asn_constant.h" #ifndef __PLATFORM_CONSTANTS_H__ # define __PLATFORM_CONSTANTS_H__ @@ -68,6 +64,16 @@ # define MAX_MODULES NB_MODULES_MAX #ifndef UE_EXPANSION +// TODO:L2 FAPI simulator. +// UESIM_EXPANSION is used to be same value of MAX_MOBILES_PER_ENB +// in eNB and UE. +// now , if we use --mu option in UE, compiling error will occur. +// This problem will be fixed in the future. +# ifdef UESIM_EXPANSION +# define MAX_MOBILES_PER_ENB 256 +# define MAX_MOBILES_PER_ENB_NB_IoT 256 +# define MAX_eNB 2 +# else # ifdef LARGE_SCALE # define MAX_MOBILES_PER_ENB 128 # define MAX_MOBILES_PER_ENB_NB_IoT 128 @@ -77,6 +83,7 @@ # define MAX_MOBILES_PER_ENB_NB_IoT 16 # define MAX_eNB 2 # endif +#endif #else # define MAX_MOBILES_PER_ENB 256 # define MAX_MOBILES_PER_ENB_NB_IoT 256 @@ -87,19 +94,19 @@ #define MAX_MANAGED_ENB_PER_MOBILE 2 ///NB-IOT -#define NB_RB_MAX_NB_IOT (maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5 +#define NB_RB_MAX_NB_IOT (LTE_maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5 #define DEFAULT_RAB_ID 1 -#define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */ -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#define NB_RB_MBMS_MAX (maxSessionPerPMCH*maxServiceCount) +#define NB_RB_MAX (LTE_maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */ +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#define NB_RB_MBMS_MAX (LTE_maxSessionPerPMCH*LTE_maxServiceCount) #else // Do not allocate unused memory #define NB_RB_MBMS_MAX 1 #endif -#define NB_RAB_MAX maxDRB /* was 8, now 11 */ +#define NB_RAB_MAX LTE_maxDRB /* was 8, now 11 */ #define RAB_SHIFT1 9 #define RAB_SHIFT2 3 #define RAB_OFFSET 0x0007 diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 843f645816..d24be0575e 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -31,7 +31,7 @@ # define __PLATFORM_TYPES_H__ #if !defined(NAS_NETLINK) -#include + #include #endif //----------------------------------------------------------------------------- @@ -42,19 +42,19 @@ * let's protect potential redefinition */ #ifndef _BOOLEAN_T_DEFINED_ -#define _BOOLEAN_T_DEFINED_ + #define _BOOLEAN_T_DEFINED_ -typedef signed char boolean_t; + typedef signed char boolean_t; -#if !defined(TRUE) -#define TRUE (boolean_t)0x01 -#endif + #if !defined(TRUE) + #define TRUE (boolean_t)0x01 + #endif -#if !defined(FALSE) -#define FALSE (boolean_t)0x00 -#endif + #if !defined(FALSE) + #define FALSE (boolean_t)0x00 + #endif -#define BOOL_NOT(b) (b^TRUE) + #define BOOL_NOT(b) (b^TRUE) #endif /* _BOOLEAN_T_DEFINED_ */ @@ -65,7 +65,7 @@ typedef int32_t sdu_size_t; typedef uint32_t frame_t; typedef int32_t sframe_t; typedef uint32_t sub_frame_t; -typedef uint16_t module_id_t; +typedef uint16_t module_id_t; typedef uint8_t slice_id_t; typedef uint8_t eNB_index_t; typedef uint16_t ue_id_t; @@ -102,19 +102,19 @@ typedef enum rb_type_e { } rb_type_t; typedef enum { - CR_ROUND = 0, - CR_SRB12 = 1, - CR_HOL = 2, - CR_LC = 3, - CR_CQI = 4, - CR_LCP = 5, - CR_NUM = 6 + CR_ROUND = 0, + CR_SRB12 = 1, + CR_HOL = 2, + CR_LC = 3, + CR_CQI = 4, + CR_LCP = 5, + CR_NUM = 6 } sorting_criterion_t; typedef enum { - POL_FAIR = 0, - POL_GREEDY = 1, - POL_NUM = 2 + POL_FAIR = 0, + POL_GREEDY = 1, + POL_NUM = 2 } accounting_policy_t; //----------------------------------------------------------------------------- // PHY TYPES @@ -188,19 +188,19 @@ typedef uint32_t m_tmsi_t; //Random UE identity length = 40 bits #if ! defined(NOT_A_RANDOM_UE_IDENTITY) -#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF + #define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF #endif #if ! defined(NOT_A_RNTI) -#define NOT_A_RNTI (rnti_t)0 + #define NOT_A_RNTI (rnti_t)0 #endif #if ! defined(M_RNTI) -#define M_RNTI (rnti_t)0xFFFD + #define M_RNTI (rnti_t)0xFFFD #endif #if ! defined(P_RNTI) -#define P_RNTI (rnti_t)0xFFFE + #define P_RNTI (rnti_t)0xFFFE #endif #if ! defined(SI_RNTI) -#define SI_RNTI (rnti_t)0xFFFF + #define SI_RNTI (rnti_t)0xFFFF #endif typedef enum config_action_e { CONFIG_ACTION_NULL = 0, @@ -225,7 +225,7 @@ typedef uint8_t ebi_t; // eps bearer id //----------------------------------------------------------------------------- // may be ITTI not enabled, but type instance is useful also for OTG, #if !defined(instance_t) -typedef uint16_t instance_t; + typedef uint16_t instance_t; #endif typedef struct protocol_ctxt_s { module_id_t module_id; /*!< \brief Virtualized module identifier */ @@ -247,51 +247,51 @@ typedef struct protocol_ctxt_s { #define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \ - if(eNB_fLAG == ENB_FLAG_YES) \ - iNSTANCE = ENB_MODULE_ID_TO_INSTANCE(mODULE_iD); \ - else \ - iNSTANCE = UE_MODULE_ID_TO_INSTANCE(mODULE_iD) + if(eNB_fLAG == ENB_FLAG_YES) \ + iNSTANCE = ENB_MODULE_ID_TO_INSTANCE(mODULE_iD); \ + else \ + iNSTANCE = UE_MODULE_ID_TO_INSTANCE(mODULE_iD) #define INSTANCE_TO_MODULE_ID(iNSTANCE, mODULE_iD, eNB_fLAG) \ - if(eNB_fLAG == ENB_FLAG_YES) \ - mODULE_iD = ENB_INSTANCE_TO_MODULE_ID(iNSTANCE); \ - else \ - mODULE_iD = UE_INSTANCE_TO_MODULE_ID(iNSTANCE) + if(eNB_fLAG == ENB_FLAG_YES) \ + mODULE_iD = ENB_INSTANCE_TO_MODULE_ID(iNSTANCE); \ + else \ + mODULE_iD = UE_INSTANCE_TO_MODULE_ID(iNSTANCE) #define PROTOCOL_CTXT_COMPUTE_MODULE_ID(CtXt_h) \ - INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag ) + INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag ) #define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) \ - MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag ) + MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag ) #define PROTOCOL_CTXT_SET_BY_MODULE_ID(Ctxt_Pp, mODULE_iD, eNB_fLAG, rNTI, fRAME, sUBfRAME, eNB_iNDEX) \ - (Ctxt_Pp)->module_id = mODULE_iD; \ - (Ctxt_Pp)->enb_flag = eNB_fLAG; \ - (Ctxt_Pp)->rnti = rNTI; \ - (Ctxt_Pp)->frame = fRAME; \ - (Ctxt_Pp)->subframe = sUBfRAME; \ - (Ctxt_Pp)->eNB_index = eNB_iNDEX; \ - PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp) + (Ctxt_Pp)->module_id = mODULE_iD; \ + (Ctxt_Pp)->enb_flag = eNB_fLAG; \ + (Ctxt_Pp)->rnti = rNTI; \ + (Ctxt_Pp)->frame = fRAME; \ + (Ctxt_Pp)->subframe = sUBfRAME; \ + (Ctxt_Pp)->eNB_index = eNB_iNDEX; \ + PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp) #define PROTOCOL_CTXT_SET_BY_INSTANCE(Ctxt_Pp, iNSTANCE, eNB_fLAG, rNTI, fRAME, sUBfRAME) \ - (Ctxt_Pp)->instance = iNSTANCE; \ - (Ctxt_Pp)->enb_flag = eNB_fLAG; \ - (Ctxt_Pp)->rnti = rNTI; \ - (Ctxt_Pp)->frame = fRAME; \ - (Ctxt_Pp)->subframe = sUBfRAME; \ - PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp) + (Ctxt_Pp)->instance = iNSTANCE; \ + (Ctxt_Pp)->enb_flag = eNB_fLAG; \ + (Ctxt_Pp)->rnti = rNTI; \ + (Ctxt_Pp)->frame = fRAME; \ + (Ctxt_Pp)->subframe = sUBfRAME; \ + PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp) #define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02u][RNTI %" PRIx16 "]" #define PROTOCOL_CTXT_ARGS(CTXT_Pp) \ - (CTXT_Pp)->frame, \ - ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \ - (CTXT_Pp)->module_id, \ - (CTXT_Pp)->rnti + (CTXT_Pp)->frame, \ + ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \ + (CTXT_Pp)->module_id, \ + (CTXT_Pp)->rnti #define CHECK_CTXT_ARGS(CTXT_Pp) #define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg) -void exit_function(const char* file, const char* function, const int line, const char* s); +void exit_function(const char *file, const char *function, const int line, const char *s); #endif diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 12a06f7c65..9a47580dbc 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -32,34 +32,30 @@ #include "as_message.h" #include "rrc_types.h" #include "s1ap_messages_types.h" -#ifdef CMAKER -#include "SystemInformationBlockType2.h" -#else -#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h" -#endif -#include "SL-OffsetIndicator-r12.h" -#include "SubframeBitmapSL-r12.h" -#include "SL-CP-Len-r12.h" -#include "SL-PeriodComm-r12.h" -#include "SL-DiscResourcePool-r12.h" + #include "LTE_SystemInformationBlockType2.h" +#include "LTE_SL-OffsetIndicator-r12.h" +#include "LTE_SubframeBitmapSL-r12.h" +#include "LTE_SL-CP-Len-r12.h" +#include "LTE_SL-PeriodComm-r12.h" +#include "LTE_SL-DiscResourcePool-r12.h" //-------------------------------------------------------------------------------------------// // Messages for RRC logging #if defined(DISABLE_ITTI_XER_PRINT) -#include "BCCH-DL-SCH-Message.h" -#include "DL-CCCH-Message.h" -#include "DL-DCCH-Message.h" -#include "UE-EUTRA-Capability.h" -#include "UL-CCCH-Message.h" -#include "UL-DCCH-Message.h" + #include "LTE_BCCH-DL-SCH-Message.h" + #include "LTE_DL-CCCH-Message.h" + #include "LTE_DL-DCCH-Message.h" + #include "LTE_UE-EUTRA-Capability.h" + #include "LTE_UL-CCCH-Message.h" + #include "LTE_UL-DCCH-Message.h" -typedef BCCH_DL_SCH_Message_t RrcDlBcchMessage; -typedef DL_CCCH_Message_t RrcDlCcchMessage; -typedef DL_DCCH_Message_t RrcDlDcchMessage; -typedef UE_EUTRA_Capability_t RrcUeEutraCapability; -typedef UL_CCCH_Message_t RrcUlCcchMessage; -typedef UL_DCCH_Message_t RrcUlDcchMessage; + typedef BCCH_DL_SCH_Message_t RrcDlBcchMessage; + typedef DL_CCCH_Message_t RrcDlCcchMessage; + typedef DL_DCCH_Message_t RrcDlDcchMessage; + typedef UE_EUTRA_Capability_t RrcUeEutraCapability; + typedef UL_CCCH_Message_t RrcUlCcchMessage; + typedef UL_DCCH_Message_t RrcUlDcchMessage; #endif //-------------------------------------------------------------------------------------------// @@ -102,7 +98,8 @@ typedef struct RrcConfigurationReq_s { uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; - + uint32_t rrc_inactivity_timer_thres; // for testing, maybe change later + paging_drx_t default_drx; int16_t nb_cc; lte_frame_type_t frame_type[MAX_NUM_CCs]; @@ -124,9 +121,9 @@ typedef struct RrcConfigurationReq_s { long pucch_delta_shift[MAX_NUM_CCs]; long pucch_nRB_CQI[MAX_NUM_CCs]; long pucch_nCS_AN[MAX_NUM_CCs]; -//#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) + //#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) long pucch_n1_AN[MAX_NUM_CCs]; -//#endif + //#endif long pdsch_referenceSignalPower[MAX_NUM_CCs]; long pdsch_p_b[MAX_NUM_CCs]; long pusch_n_SB[MAX_NUM_CCs]; @@ -149,16 +146,16 @@ typedef struct RrcConfigurationReq_s { long pucch_p0_Nominal[MAX_NUM_CCs]; long msg3_delta_Preamble[MAX_NUM_CCs]; long ul_CyclicPrefixLength[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format1 pucch_deltaF_Format1[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format1b pucch_deltaF_Format1b[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2 pucch_deltaF_Format2[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2a pucch_deltaF_Format2a[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2b pucch_deltaF_Format2b[MAX_NUM_CCs]; + e_LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1 pucch_deltaF_Format1[MAX_NUM_CCs]; + e_LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b pucch_deltaF_Format1b[MAX_NUM_CCs]; + e_LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2 pucch_deltaF_Format2[MAX_NUM_CCs]; + e_LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a pucch_deltaF_Format2a[MAX_NUM_CCs]; + e_LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b pucch_deltaF_Format2b[MAX_NUM_CCs]; long rach_numberOfRA_Preambles[MAX_NUM_CCs]; BOOLEAN_t rach_preamblesGroupAConfig[MAX_NUM_CCs]; long rach_sizeOfRA_PreamblesGroupA[MAX_NUM_CCs]; long rach_messageSizeGroupA[MAX_NUM_CCs]; - e_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB rach_messagePowerOffsetGroupB[MAX_NUM_CCs]; + e_LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB rach_messagePowerOffsetGroupB[MAX_NUM_CCs]; long rach_powerRampingStep[MAX_NUM_CCs]; long rach_preambleInitialReceivedTargetPower[MAX_NUM_CCs]; long rach_preambleTransMax[MAX_NUM_CCs]; @@ -179,46 +176,46 @@ typedef struct RrcConfigurationReq_s { //TTN - for D2D //SIB18 - e_SL_CP_Len_r12 rxPool_sc_CP_Len[MAX_NUM_CCs]; - e_SL_PeriodComm_r12 rxPool_sc_Period[MAX_NUM_CCs]; - e_SL_CP_Len_r12 rxPool_data_CP_Len[MAX_NUM_CCs]; + e_LTE_SL_CP_Len_r12 rxPool_sc_CP_Len[MAX_NUM_CCs]; + e_LTE_SL_PeriodComm_r12 rxPool_sc_Period[MAX_NUM_CCs]; + e_LTE_SL_CP_Len_r12 rxPool_data_CP_Len[MAX_NUM_CCs]; long rxPool_ResourceConfig_prb_Num[MAX_NUM_CCs]; long rxPool_ResourceConfig_prb_Start[MAX_NUM_CCs]; long rxPool_ResourceConfig_prb_End[MAX_NUM_CCs]; - SL_OffsetIndicator_r12_PR rxPool_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; + LTE_SL_OffsetIndicator_r12_PR rxPool_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; long rxPool_ResourceConfig_offsetIndicator_choice[MAX_NUM_CCs]; - SubframeBitmapSL_r12_PR rxPool_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; - char* rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; + LTE_SubframeBitmapSL_r12_PR rxPool_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; + char *rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; long rxPool_ResourceConfig_subframeBitmap_choice_bs_size[MAX_NUM_CCs]; long rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[MAX_NUM_CCs]; //SIB19 //for discRxPool - SL_CP_Len_r12_t discRxPool_cp_Len[MAX_NUM_CCs]; - e_SL_DiscResourcePool_r12__discPeriod_r12 discRxPool_discPeriod[MAX_NUM_CCs]; + LTE_SL_CP_Len_r12_t discRxPool_cp_Len[MAX_NUM_CCs]; + e_LTE_SL_DiscResourcePool_r12__discPeriod_r12 discRxPool_discPeriod[MAX_NUM_CCs]; long discRxPool_numRetx[MAX_NUM_CCs]; long discRxPool_numRepetition[MAX_NUM_CCs]; long discRxPool_ResourceConfig_prb_Num[MAX_NUM_CCs]; long discRxPool_ResourceConfig_prb_Start[MAX_NUM_CCs]; long discRxPool_ResourceConfig_prb_End[MAX_NUM_CCs]; - SL_OffsetIndicator_r12_PR discRxPool_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; + LTE_SL_OffsetIndicator_r12_PR discRxPool_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; long discRxPool_ResourceConfig_offsetIndicator_choice[MAX_NUM_CCs]; - SubframeBitmapSL_r12_PR discRxPool_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; - char* discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; + LTE_SubframeBitmapSL_r12_PR discRxPool_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; + char *discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; long discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[MAX_NUM_CCs]; long discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[MAX_NUM_CCs]; //for discRxPoolPS - SL_CP_Len_r12_t discRxPoolPS_cp_Len[MAX_NUM_CCs]; - e_SL_DiscResourcePool_r12__discPeriod_r12 discRxPoolPS_discPeriod[MAX_NUM_CCs]; + LTE_SL_CP_Len_r12_t discRxPoolPS_cp_Len[MAX_NUM_CCs]; + e_LTE_SL_DiscResourcePool_r12__discPeriod_r12 discRxPoolPS_discPeriod[MAX_NUM_CCs]; long discRxPoolPS_numRetx[MAX_NUM_CCs]; long discRxPoolPS_numRepetition[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_prb_Num[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_prb_Start[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_prb_End[MAX_NUM_CCs]; - SL_OffsetIndicator_r12_PR discRxPoolPS_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; + LTE_SL_OffsetIndicator_r12_PR discRxPoolPS_ResourceConfig_offsetIndicator_present[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_offsetIndicator_choice[MAX_NUM_CCs]; - SubframeBitmapSL_r12_PR discRxPoolPS_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; - char* discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; + LTE_SubframeBitmapSL_r12_PR discRxPoolPS_ResourceConfig_subframeBitmap_present[MAX_NUM_CCs]; + char *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[MAX_NUM_CCs]; long discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[MAX_NUM_CCs]; } RrcConfigurationReq; @@ -230,69 +227,69 @@ typedef struct NbIoTRrcConfigurationReq_s { uint16_t tac; - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - lte_frame_type_t frame_type; + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + lte_frame_type_t frame_type; uint8_t tdd_config; uint8_t tdd_config_s; lte_prefix_type_t prefix_type; - lte_prefix_type_t prefix_type_UL; + lte_prefix_type_t prefix_type_UL; int16_t eutra_band; uint32_t downlink_frequency; int32_t uplink_frequency_offset; int16_t Nid_cell;// for testing, change later int16_t N_RB_DL;// for testing, change later //RACH - long rach_raResponseWindowSize_NB; - long rach_macContentionResolutionTimer_NB; - long rach_powerRampingStep_NB; - long rach_preambleInitialReceivedTargetPower_NB; - long rach_preambleTransMax_CE_NB; + long rach_raResponseWindowSize_NB; + long rach_macContentionResolutionTimer_NB; + long rach_powerRampingStep_NB; + long rach_preambleInitialReceivedTargetPower_NB; + long rach_preambleTransMax_CE_NB; //BCCH - long bcch_modificationPeriodCoeff_NB; + long bcch_modificationPeriodCoeff_NB; //PCCH - long pcch_defaultPagingCycle_NB; - long pcch_nB_NB; - long pcch_npdcch_NumRepetitionPaging_NB; + long pcch_defaultPagingCycle_NB; + long pcch_nB_NB; + long pcch_npdcch_NumRepetitionPaging_NB; //NPRACH - long nprach_CP_Length; - long nprach_rsrp_range; - long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS]; - long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS]; - long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS]; - long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS]; - long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS]; - long nprach_SubcarrierMSG3_RangeStart; - long maxNumPreambleAttemptCE_NB; - long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS]; - long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS]; - long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS]; + long nprach_CP_Length; + long nprach_rsrp_range; + long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS]; + long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS]; + long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS]; + long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS]; + long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS]; + long nprach_SubcarrierMSG3_RangeStart; + long maxNumPreambleAttemptCE_NB; + long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS]; + long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS]; + long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS]; //NPDSCH - long npdsch_nrs_Power; + long npdsch_nrs_Power; //NPUSCH - long npusch_ack_nack_numRepetitions_NB; - long npusch_srs_SubframeConfig_NB; - long npusch_threeTone_CyclicShift_r13; - long npusch_sixTone_CyclicShift_r13; - BOOLEAN_t npusch_groupHoppingEnabled; - long npusch_groupAssignmentNPUSCH_r13; + long npusch_ack_nack_numRepetitions_NB; + long npusch_srs_SubframeConfig_NB; + long npusch_threeTone_CyclicShift_r13; + long npusch_sixTone_CyclicShift_r13; + BOOLEAN_t npusch_groupHoppingEnabled; + long npusch_groupAssignmentNPUSCH_r13; //DL_GapConfig - long dl_GapThreshold_NB; - long dl_GapPeriodicity_NB; - long dl_GapDurationCoeff_NB; + long dl_GapThreshold_NB; + long dl_GapPeriodicity_NB; + long dl_GapDurationCoeff_NB; //Uplink power control Common - long npusch_p0_NominalNPUSCH; - long npusch_alpha; - long deltaPreambleMsg3; + long npusch_p0_NominalNPUSCH; + long npusch_alpha; + long deltaPreambleMsg3; //UE timers and constants - long ue_TimersAndConstants_t300_NB; - long ue_TimersAndConstants_t301_NB; - long ue_TimersAndConstants_t310_NB; - long ue_TimersAndConstants_t311_NB; - long ue_TimersAndConstants_n310_NB; - long ue_TimersAndConstants_n311_NB; + long ue_TimersAndConstants_t300_NB; + long ue_TimersAndConstants_t301_NB; + long ue_TimersAndConstants_t310_NB; + long ue_TimersAndConstants_t311_NB; + long ue_TimersAndConstants_n310_NB; + long ue_TimersAndConstants_n311_NB; } NbIoTRrcConfigurationReq; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index c74a826ff8..9b744ded6b 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -22,7 +22,7 @@ #ifndef X2AP_MESSAGES_TYPES_H_ #define X2AP_MESSAGES_TYPES_H_ -#include "PhysCellId.h" +#include "LTE_PhysCellId.h" //-------------------------------------------------------------------------------------------// // Defines to access message fields. @@ -122,7 +122,7 @@ typedef struct x2ap_lastvisitedcell_info_s { uint16_t mcc; uint16_t mnc; uint8_t mnc_len; - PhysCellId_t target_physCellId; + LTE_PhysCellId_t target_physCellId; cell_type_t cell_type; uint64_t time_UE_StayedInCell; }x2ap_lastvisitedcell_info_t; @@ -134,7 +134,7 @@ typedef struct x2ap_handover_req_s { unsigned old_eNB_ue_s1ap_id:24; - PhysCellId_t target_physCellId; + LTE_PhysCellId_t target_physCellId; x2ap_gummei_t ue_gummei; diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index b79ad88417..7d7f48a610 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -262,7 +262,7 @@ int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { } /* this is called by RRC as a part of rrc xface . The controller previously requested this*/ -void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t* measResults) { +void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t* measResults) { //int i; // int priority = 0; // Warning Preventing diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index 780976893e..b6cb674ce9 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -55,7 +55,7 @@ int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); // void flexran_agent_send_update_rrc_stats(mid_t mod_id); /* this is called by RRC as a part of rrc xface . The controller previously requested this*/ -void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *); +void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t *); /* Statistics reply protocol message constructor and destructor */ int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h index 8c336abef1..5f6432732f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h @@ -34,7 +34,7 @@ #include "flexran_agent_defs.h" #include "flexran.pb-c.h" #include "header.pb-c.h" -#include "MeasResults.h" +#include "LTE_MeasResults.h" #define RINGBUFFER_SIZE 100 @@ -62,7 +62,7 @@ typedef struct { void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, uint8_t state_change); - void (*flexran_trigger_rrc_measurements)(mid_t mod_id, MeasResults_t* measResults); + void (*flexran_trigger_rrc_measurements)(mid_t mod_id, LTE_MeasResults_t* measResults); } AGENT_RRC_xface; diff --git a/openair2/ENB_APP/Makefile.inc b/openair2/ENB_APP/Makefile.inc deleted file mode 100644 index e018d67610..0000000000 --- a/openair2/ENB_APP/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -ENB_APP_DIR = $(OPENAIR2_TOP)/ENB_APP - -ENB_APP_OBJS = $(ENB_APP_DIR)/enb_app.o \ - $(ENB_APP_DIR)/enb_config.o -ENB_APP_incl = \ - -I$(ENB_APP_DIR) -I$(OPENAIR2_TOP) - diff --git a/openair2/ENB_APP/RRC_config_tools.c b/openair2/ENB_APP/RRC_config_tools.c index c7c75c13d4..e778439d3d 100644 --- a/openair2/ENB_APP/RRC_config_tools.c +++ b/openair2/ENB_APP/RRC_config_tools.c @@ -40,11 +40,11 @@ # include "sctp_eNB_task.h" # endif #endif -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" #include "common/config/config_userapi.h" #include "RRC_config_tools.h" -#include "DL-GapConfig-NB-r13.h" -#include "NPRACH-Parameters-NB-r13.h" +#include "LTE_DL-GapConfig-NB-r13.h" +#include "LTE_NPRACH-Parameters-NB-r13.h" static const eutra_band_t eutra_bands[] = { { 1, 1920 * MHz, 1980 * MHz, 2110 * MHz, 2170 * MHz, FDD}, diff --git a/openair2/ENB_APP/RRC_paramsvalues.h b/openair2/ENB_APP/RRC_paramsvalues.h index 06fee0e172..cfab58b451 100644 --- a/openair2/ENB_APP/RRC_paramsvalues.h +++ b/openair2/ENB_APP/RRC_paramsvalues.h @@ -68,27 +68,27 @@ #define NRBDL_OKVALUES {6,15,25,50,75,100} #define UETIMER_T300_OKVALUES {100,200,300,400,600,1000,1500,2000} -#define UETT300(A) UE_TimersAndConstants__t300_ ## A +#define UETT300(A) LTE_UE_TimersAndConstants__t300_ ## A #define UETIMER_T300_MODVALUES { UETT300(ms100), UETT300(ms200),UETT300(ms300),UETT300(ms400),UETT300(ms600),UETT300(ms1000),UETT300(ms1500),UETT300(ms2000)} #define UETIMER_T301_OKVALUES {100,200,300,400,600,1000,1500,2000} -#define UETT301(A) UE_TimersAndConstants__t301_ ## A +#define UETT301(A) LTE_UE_TimersAndConstants__t301_ ## A #define UETIMER_T301_MODVALUES { UETT301(ms100), UETT301(ms200),UETT301(ms300),UETT301(ms400),UETT301(ms600),UETT301(ms1000),UETT301(ms1500),UETT301(ms2000)} #define UETIMER_T310_OKVALUES {0,50,100,200,500,1000,2000} -#define UETT310(A) UE_TimersAndConstants__t310_ ## A +#define UETT310(A) LTE_UE_TimersAndConstants__t310_ ## A #define UETIMER_T310_MODVALUES { UETT310(ms0), UETT310(ms50),UETT310(ms100),UETT310(ms200),UETT310(ms500),UETT310(ms1000),UETT310(ms2000)} #define UETIMER_T311_OKVALUES {1000,3110,5000,10000,15000,20000,31100} -#define UETT311(A) UE_TimersAndConstants__t311_ ## A +#define UETT311(A) LTE_UE_TimersAndConstants__t311_ ## A #define UETIMER_T311_MODVALUES { UETT311(ms1000), UETT311(ms3000),UETT311(ms5000),UETT311(ms10000),UETT311(ms15000),UETT311(ms20000),UETT311(ms30000)} #define UETIMER_N310_OKVALUES {1,2,3,4,6,8,10,20} -#define UETN310(A) UE_TimersAndConstants__n310_ ## A +#define UETN310(A) LTE_UE_TimersAndConstants__n310_ ## A #define UETIMER_N310_MODVALUES { UETN310(n1), UETN310(n2),UETN310(n3),UETN310(n4),UETN310(n6),UETN310(n8),UETN310(n10),UETN310(n20)} #define UETIMER_N311_OKVALUES {1,2,3,4,5,6,8,10} -#define UETN311(A) UE_TimersAndConstants__n311_ ## A +#define UETN311(A) LTE_UE_TimersAndConstants__n311_ ## A #define UETIMER_N311_MODVALUES { UETN311(n1), UETN311(n2),UETN311(n3),UETN311(n4),UETN311(n5),UETN311(n6),UETN311(n8),UETN311(n10)} #endif diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 37bcd36653..35871b15d2 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -43,10 +43,14 @@ # include "s1ap_eNB.h" # include "sctp_eNB_task.h" # include "gtpv1u_eNB_task.h" -# else -# define EPC_MODE_ENABLED 0 -# endif - +/* temporary warning removale while implementing noS1 */ +/* as config option */ +# else +# ifdef EPC_MODE_ENABLED +# undef EPC_MODE_ENABLED +# endif +# define EPC_MODE_ENABLED 0 +# endif # include "x2ap_eNB.h" # include "x2ap_messages_types.h" # define X2AP_ENB_REGISTER_RETRY_DELAY 10 diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 080b83f307..086009a563 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -40,16 +40,16 @@ # include "OCG_extern.h" #endif #if defined(ENABLE_ITTI) -#include "intertask_interface.h" -#if defined(ENABLE_USE_MME) -#include "s1ap_eNB.h" -#include "sctp_eNB_task.h" -#else -#define EPC_MODE_ENABLED 0 -#endif + #include "intertask_interface.h" + #if defined(ENABLE_USE_MME) + #include "s1ap_eNB.h" + #include "sctp_eNB_task.h" + #else + #define EPC_MODE_ENABLED 0 + #endif #endif #include "sctp_default_values.h" -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_proto.h" #include "PHY/phy_extern.h" @@ -64,6 +64,8 @@ #include "RRC_config_tools.h" #include "enb_paramdef.h" +#define RRC_INACTIVITY_THRESH 0 + extern uint16_t sf_ahead; extern void set_parallel_conf(char *parallel_conf); extern void set_worker_conf(char *worker_conf); @@ -71,6 +73,8 @@ extern PARALLEL_CONF_t get_thread_parallel_conf(void); extern WORKER_CONF_t get_thread_worker_conf(void); extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw); +extern char *parallel_config; +extern char *worker_config; void RCconfig_flexran() { uint16_t i; @@ -294,7 +298,7 @@ void RCconfig_L1(void) { } }// j=0..num_inst - printf("Initializing northbound interface for L1\n"); + LOG_I(ENB_APP,"Initializing northbound interface for L1\n"); l1_north_init_eNB(); } else { LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found"); @@ -365,16 +369,16 @@ void RCconfig_macrlc() { RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE; sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 - printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); + LOG_I(ENB_APP,"**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc); - printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); + LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc); } else { // other midhaul AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); } if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0) { global_scheduler_mode=SCHED_MODE_DEFAULT; - printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); + LOG_I(ENB_APP,"sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0) { global_scheduler_mode=SCHED_MODE_FAIR_RR; printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr)); @@ -414,7 +418,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { int32_t pucch_delta_shift = 0; int32_t pucch_nRB_CQI = 0; int32_t pucch_nCS_AN = 0; - //#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + //#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) int32_t pucch_n1_AN = 0; //#endif int32_t pdsch_referenceSignalPower = 0; @@ -555,7 +559,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr); } - printf("RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + LOG_I(ENB_APP,"RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { } else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { @@ -573,7 +577,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { // search if in active list for (k=0; k = MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (!pbch_repetition) AssertFatal (0, @@ -696,13 +701,13 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; - AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, + AssertFatal (tdd_config <= LTE_TDD_Config__subframeAssignment_sa6, "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", - RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); + RC.config_file_name, i, tdd_config, LTE_TDD_Config__subframeAssignment_sa6); RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; - AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, + AssertFatal (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)!", - RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); + RC.config_file_name, i, tdd_config_s, LTE_TDD_Config__specialSubframePatterns_ssp8); if (!prefix_type) AssertFatal (0, @@ -800,7 +805,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n", RC.config_file_name, i, pucch_nCS_AN); - //#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) + //#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[j] = pucch_n1_AN; if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047)) @@ -835,9 +840,9 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE); else if (strcmp(pusch_hoppingMode,"interSubFrame")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; } else if (strcmp(pusch_hoppingMode,"intraAndInterSubFrame")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame; + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = 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", @@ -904,22 +909,22 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, pusch_nDMRS1); if (strcmp(phich_duration,"NORMAL")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_normal; + RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = LTE_PHICH_Config__phich_Duration_normal; } else if (strcmp(phich_duration,"EXTENDED")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_extended; + RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = 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", RC.config_file_name, i, phich_duration); if (strcmp(phich_resource,"ONESIXTH")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_oneSixth ; + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = LTE_PHICH_Config__phich_Resource_oneSixth ; } else if (strcmp(phich_resource,"HALF")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_half; + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = LTE_PHICH_Config__phich_Resource_half; } else if (strcmp(phich_resource,"ONE")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_one; + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = LTE_PHICH_Config__phich_Resource_one; } else if (strcmp(phich_resource,"TWO")==0) { - RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_two; + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = 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", @@ -978,45 +983,45 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n", RC.config_file_name, i, pusch_p0_Nominal); -#if (RRC_VERSION <= MAKE_VERSION(12, 0, 0)) +#if (LTE_RRC_VERSION <= MAKE_VERSION(12, 0, 0)) if (strcmp(pusch_alpha,"AL0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al0; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al0; } else if (strcmp(pusch_alpha,"AL04")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al04; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al04; } else if (strcmp(pusch_alpha,"AL05")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al05; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al05; } else if (strcmp(pusch_alpha,"AL06")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al06; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al06; } else if (strcmp(pusch_alpha,"AL07")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al07; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al07; } else if (strcmp(pusch_alpha,"AL08")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al08; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al08; } else if (strcmp(pusch_alpha,"AL09")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al09; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al09; } else if (strcmp(pusch_alpha,"AL1")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al1; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_UplinkPowerControlCommon__alpha_al1; } #endif -#if (RRC_VERSION >= MAKE_VERSION(12, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(12, 0, 0)) if (strcmp(pusch_alpha,"AL0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al0; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al0; } else if (strcmp(pusch_alpha,"AL04")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al04; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al04; } else if (strcmp(pusch_alpha,"AL05")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al05; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al05; } else if (strcmp(pusch_alpha,"AL06")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al06; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al06; } else if (strcmp(pusch_alpha,"AL07")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al07; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al07; } else if (strcmp(pusch_alpha,"AL08")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al08; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al08; } else if (strcmp(pusch_alpha,"AL09")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al09; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al09; } else if (strcmp(pusch_alpha,"AL1")==0) { - RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al1; + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = LTE_Alpha_r12_al1; } #endif @@ -1040,57 +1045,57 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, msg3_delta_Preamble); if (strcmp(pucch_deltaF_Format1,"deltaF_2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2; } else if (strcmp(pucch_deltaF_Format1,"deltaF0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF0; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF0; } else if (strcmp(pucch_deltaF_Format1,"deltaF2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = 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", RC.config_file_name, i, pucch_deltaF_Format1); if (strcmp(pucch_deltaF_Format1b,"deltaF1")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF1; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF1; } else if (strcmp(pucch_deltaF_Format1b,"deltaF3")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; } else if (strcmp(pucch_deltaF_Format1b,"deltaF5")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF5; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = 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", RC.config_file_name, i, pucch_deltaF_Format1b); if (strcmp(pucch_deltaF_Format2,"deltaF_2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF_2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF_2; } else if (strcmp(pucch_deltaF_Format2,"deltaF0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; } else if (strcmp(pucch_deltaF_Format2,"deltaF1")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF1; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF1; } else if (strcmp(pucch_deltaF_Format2,"deltaF2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = 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", RC.config_file_name, i, pucch_deltaF_Format2); if (strcmp(pucch_deltaF_Format2a,"deltaF_2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF_2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF_2; } else if (strcmp(pucch_deltaF_Format2a,"deltaF0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; } else if (strcmp(pucch_deltaF_Format2a,"deltaF2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = 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", RC.config_file_name, i, pucch_deltaF_Format2a); if (strcmp(pucch_deltaF_Format2b,"deltaF_2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF_2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF_2; } else if (strcmp(pucch_deltaF_Format2b,"deltaF0")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; } else if (strcmp(pucch_deltaF_Format2b,"deltaF2")==0) { - RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2; + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = 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", @@ -1114,19 +1119,19 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (rach_messageSizeGroupA) { case 56: - RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b56; + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b56; break; case 144: - RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b144; + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b144; break; case 208: - RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b208; + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b208; break; case 256: - RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b256; + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b256; break; default: @@ -1137,21 +1142,21 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_minusinfinity; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_minusinfinity; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB0")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB0; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB0; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB5")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB5; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB5; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB8")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB8; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB8; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB10")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB10; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB10; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB12")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB12; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB12; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB15")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB15; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB15; } else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0) { - RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18; + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = 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", @@ -1178,95 +1183,95 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, rach_powerRampingStep); switch (rach_preambleTransMax) { -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0)) case 3: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3; break; case 4: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4; break; case 5: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5; break; case 6: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6; break; case 7: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7; break; case 8: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8; break; case 10: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; break; case 20: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20; break; case 50: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50; break; case 100: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100; break; case 200: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200; break; #else case 3: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n3; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n3; break; case 4: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n4; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n4; break; case 5: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n5; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n5; break; case 6: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n6; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n6; break; case 7: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n7; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n7; break; case 8: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n8; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n8; break; case 10: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n10; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n10; break; case 20: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n20; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n20; break; case 50: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n50; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n50; break; case 100: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n100; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n100; break; case 200: - RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n200; + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = LTE_PreambleTransMax_n200; break; #endif @@ -1300,19 +1305,19 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (pcch_defaultPagingCycle) { case 32: - RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf32; + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = LTE_PCCH_Config__defaultPagingCycle_rf32; break; case 64: - RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf64; + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = LTE_PCCH_Config__defaultPagingCycle_rf64; break; case 128: - RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf128; + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = LTE_PCCH_Config__defaultPagingCycle_rf128; break; case 256: - RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf256; + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = LTE_PCCH_Config__defaultPagingCycle_rf256; break; default: @@ -1323,21 +1328,21 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } if (strcmp(pcch_nB, "fourT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_fourT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_fourT; } else if (strcmp(pcch_nB, "twoT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_twoT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_twoT; } else if (strcmp(pcch_nB, "oneT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_oneT; } else if (strcmp(pcch_nB, "halfT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_halfT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_halfT; } else if (strcmp(pcch_nB, "quarterT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_quarterT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_quarterT; } else if (strcmp(pcch_nB, "oneEighthT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneEighthT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_oneEighthT; } else if (strcmp(pcch_nB, "oneSixteenthT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneSixteenthT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_oneSixteenthT; } else if (strcmp(pcch_nB, "oneThirtySecondT") == 0) { - RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneThirtySecondT; + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = LTE_PCCH_Config__nB_oneThirtySecondT; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_nB choice: fourT,twoT,oneT,halfT,quarterT,oneighthT,oneSixteenthT,oneThirtySecondT !\n", @@ -1345,19 +1350,19 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (bcch_modificationPeriodCoeff) { case 2: - RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n2; + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = LTE_BCCH_Config__modificationPeriodCoeff_n2; break; case 4: - RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n4; + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = LTE_BCCH_Config__modificationPeriodCoeff_n4; break; case 8: - RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n8; + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = LTE_BCCH_Config__modificationPeriodCoeff_n8; break; case 16: - RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n16; + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = LTE_BCCH_Config__modificationPeriodCoeff_n16; break; default: @@ -1376,31 +1381,31 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (ue_TransmissionMode) { case 1: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm1; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm1; break; case 2: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm2; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm2; break; case 3: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm3; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm3; break; case 4: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm4; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm4; break; case 5: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm5; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm5; break; case 6: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm6; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm6; break; case 7: - RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm7; + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = LTE_AntennaInfoDedicated__transmissionMode_tm7; break; default: @@ -1447,55 +1452,55 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { //TTN - for D2D //SIB18 if (strcmp(rxPool_sc_CP_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = LTE_SL_CP_Len_r12_normal; } else if (strcmp(rxPool_sc_CP_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_CP_Len[j] = LTE_SL_CP_Len_r12_extended; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_CP_Len choice: normal,extended!\n", RC.config_file_name, i, rxPool_sc_CP_Len); if (strcmp(rxPool_sc_Period,"sf40")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf40; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf40; } else if (strcmp(rxPool_sc_Period,"sf60")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf60; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf60; } else if (strcmp(rxPool_sc_Period,"sf70")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf70; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf70; } else if (strcmp(rxPool_sc_Period,"sf80")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf80; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf80; } else if (strcmp(rxPool_sc_Period,"sf120")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf120; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf120; } else if (strcmp(rxPool_sc_Period,"sf140")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf140; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf140; } else if (strcmp(rxPool_sc_Period,"sf160")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf160; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf160; } else if (strcmp(rxPool_sc_Period,"sf240")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf240; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf240; } else if (strcmp(rxPool_sc_Period,"sf280")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf280; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf280; } else if (strcmp(rxPool_sc_Period,"sf320")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_sf320; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_sf320; } else if (strcmp(rxPool_sc_Period,"spare6")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare6; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare6; } else if (strcmp(rxPool_sc_Period,"spare5")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare5; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare5; } else if (strcmp(rxPool_sc_Period,"spare4")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare4; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare4; } else if (strcmp(rxPool_sc_Period,"spare3")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare3; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare3; } else if (strcmp(rxPool_sc_Period,"spare2")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare2; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare2; } else if (strcmp(rxPool_sc_Period,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = SL_PeriodComm_r12_spare; + RRC_CONFIGURATION_REQ (msg_p).rxPool_sc_Period[j] = LTE_SL_PeriodComm_r12_spare; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_sc_Period choice: sf40,sf60,sf70,sf80,sf120,sf140,sf160,sf240,sf280,sf320,spare6,spare5,spare4,spare3,spare2,spare!\n", RC.config_file_name, i, rxPool_sc_Period); if (strcmp(rxPool_data_CP_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = LTE_SL_CP_Len_r12_normal; } else if (strcmp(rxPool_data_CP_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).rxPool_data_CP_Len[j] = LTE_SL_CP_Len_r12_extended; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_data_CP_Len choice: normal,extended!\n", @@ -1506,11 +1511,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_prb_End[j] = rxPool_ResourceConfig_prb_End; if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_NOTHING; } else if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_small_r12; } else if (strcmp(rxPool_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_large_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", @@ -1519,21 +1524,21 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_offsetIndicator_choice[j] = rxPool_ResourceConfig_offsetIndicator_choice; if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_NOTHING; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs4_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs8_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs12_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs16_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs30_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs40_r12; } else if (strcmp(rxPool_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + RRC_CONFIGURATION_REQ (msg_p).rxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs42_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", @@ -1545,30 +1550,30 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { //SIB19 - for discRxPool if (strcmp(discRxPool_cp_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = LTE_SL_CP_Len_r12_normal; } else if (strcmp(discRxPool_cp_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_cp_Len[j] = LTE_SL_CP_Len_r12_extended; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_cp_Len choice: normal,extended!\n", RC.config_file_name, i, discRxPool_cp_Len); if (strcmp(discRxPool_discPeriod,"rf32")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf32; } else if (strcmp(discRxPool_discPeriod,"rf64")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf64; } else if (strcmp(discRxPool_discPeriod,"rf128")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf128; } else if (strcmp(discRxPool_discPeriod,"rf256")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf256; } else if (strcmp(discRxPool_discPeriod,"rf512")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf512; } else if (strcmp(discRxPool_discPeriod,"rf1024")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf1024; } else if (strcmp(discRxPool_discPeriod,"rf16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; } else if (strcmp(discRxPool_discPeriod,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_spare; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", @@ -1581,11 +1586,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_prb_End[j] = discRxPool_ResourceConfig_prb_End; if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_NOTHING; } else if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_small_r12; } else if (strcmp(discRxPool_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_large_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", @@ -1594,21 +1599,21 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_offsetIndicator_choice[j] = discRxPool_ResourceConfig_offsetIndicator_choice; if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_NOTHING; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs4_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs8_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs12_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs16_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs30_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs40_r12; } else if (strcmp(discRxPool_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPool_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs42_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPool_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", @@ -1620,30 +1625,30 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { //SIB19 - For discRxPoolPS if (strcmp(discRxPoolPS_cp_Len,"normal")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_normal; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = LTE_SL_CP_Len_r12_normal; } else if (strcmp(discRxPoolPS_cp_Len,"extended")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = SL_CP_Len_r12_extended; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_cp_Len[j] = LTE_SL_CP_Len_r12_extended; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_cp_Len choice: normal,extended!\n", RC.config_file_name, i, discRxPoolPS_cp_Len); if (strcmp(discRxPoolPS_discPeriod,"rf32")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf32; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf32; } else if (strcmp(discRxPoolPS_discPeriod,"rf64")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf64; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf64; } else if (strcmp(discRxPoolPS_discPeriod,"rf128")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf128; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf128; } else if (strcmp(discRxPoolPS_discPeriod,"rf256")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf256; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf256; } else if (strcmp(discRxPoolPS_discPeriod,"rf512")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf512; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf512; } else if (strcmp(discRxPoolPS_discPeriod,"rf1024")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf1024; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf1024; } else if (strcmp(discRxPoolPS_discPeriod,"rf16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_rf16_v1310; } else if (strcmp(discRxPoolPS_discPeriod,"spare")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = SL_DiscResourcePool_r12__discPeriod_r12_spare; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_discPeriod[j] = LTE_SL_DiscResourcePool_r12__discPeriod_r12_spare; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_discPeriod choice: rf32,rf64,rf128,rf512,rf1024,rf16,spare!\n", @@ -1656,11 +1661,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_prb_End[j] = discRxPoolPS_ResourceConfig_prb_End; if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_NOTHING; } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prSmall")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_small_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_small_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_offsetIndicator_present,"prLarge")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = SL_OffsetIndicator_r12_PR_large_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_present[j] = LTE_SL_OffsetIndicator_r12_PR_large_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_offsetIndicator_present choice: prNothing,prSmal,prLarge!\n", @@ -1669,21 +1674,21 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_offsetIndicator_choice[j] = discRxPoolPS_ResourceConfig_offsetIndicator_choice; if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prNothing")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_NOTHING; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_NOTHING; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs4")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs4_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs4_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs8")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs8_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs8_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs12")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs12_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs12_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs16")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs16_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs16_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs30")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs30_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs30_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs40")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs40_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs40_r12; } else if (strcmp(discRxPoolPS_ResourceConfig_subframeBitmap_present,"prBs42")==0) { - RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = SubframeBitmapSL_r12_PR_bs42_r12; + RRC_CONFIGURATION_REQ (msg_p).discRxPoolPS_ResourceConfig_subframeBitmap_present[j] = LTE_SubframeBitmapSL_r12_PR_bs42_r12; } else AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for discRxPoolPS_ResourceConfig_subframeBitmap_present choice: prNothing,prBs4,prBs8,prBs12,prBs16,prBs30,prBs40,prBs42!\n", @@ -1702,35 +1707,35 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { if (npar == sizeof(SRB1Params)/sizeof(paramdef_t)) { switch (srb1_max_retx_threshold) { case 1: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t1; break; case 2: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t2; break; case 3: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t3; break; case 4: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t4; break; case 6: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t6; break; case 8: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; break; case 16: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t16; break; case 32: - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t32; break; default: @@ -1741,36 +1746,36 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (srb1_poll_pdu) { case 4: - rrc->srb1_poll_pdu = PollPDU_p4; + rrc->srb1_poll_pdu = LTE_PollPDU_p4; break; case 8: - rrc->srb1_poll_pdu = PollPDU_p8; + rrc->srb1_poll_pdu = LTE_PollPDU_p8; break; case 16: - rrc->srb1_poll_pdu = PollPDU_p16; + rrc->srb1_poll_pdu = LTE_PollPDU_p16; break; case 32: - rrc->srb1_poll_pdu = PollPDU_p32; + rrc->srb1_poll_pdu = LTE_PollPDU_p32; break; case 64: - rrc->srb1_poll_pdu = PollPDU_p64; + rrc->srb1_poll_pdu = LTE_PollPDU_p64; break; case 128: - rrc->srb1_poll_pdu = PollPDU_p128; + rrc->srb1_poll_pdu = LTE_PollPDU_p128; break; case 256: - rrc->srb1_poll_pdu = PollPDU_p256; + rrc->srb1_poll_pdu = LTE_PollPDU_p256; break; default: if (srb1_poll_pdu >= 10000) - rrc->srb1_poll_pdu = PollPDU_pInfinity; + 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", @@ -1781,64 +1786,64 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (srb1_poll_byte) { case 25: - rrc->srb1_poll_byte = PollByte_kB25; + rrc->srb1_poll_byte = LTE_PollByte_kB25; break; case 50: - rrc->srb1_poll_byte = PollByte_kB50; + rrc->srb1_poll_byte = LTE_PollByte_kB50; break; case 75: - rrc->srb1_poll_byte = PollByte_kB75; + rrc->srb1_poll_byte = LTE_PollByte_kB75; break; case 100: - rrc->srb1_poll_byte = PollByte_kB100; + rrc->srb1_poll_byte = LTE_PollByte_kB100; break; case 125: - rrc->srb1_poll_byte = PollByte_kB125; + rrc->srb1_poll_byte = LTE_PollByte_kB125; break; case 250: - rrc->srb1_poll_byte = PollByte_kB250; + rrc->srb1_poll_byte = LTE_PollByte_kB250; break; case 375: - rrc->srb1_poll_byte = PollByte_kB375; + rrc->srb1_poll_byte = LTE_PollByte_kB375; break; case 500: - rrc->srb1_poll_byte = PollByte_kB500; + rrc->srb1_poll_byte = LTE_PollByte_kB500; break; case 750: - rrc->srb1_poll_byte = PollByte_kB750; + rrc->srb1_poll_byte = LTE_PollByte_kB750; break; case 1000: - rrc->srb1_poll_byte = PollByte_kB1000; + rrc->srb1_poll_byte = LTE_PollByte_kB1000; break; case 1250: - rrc->srb1_poll_byte = PollByte_kB1250; + rrc->srb1_poll_byte = LTE_PollByte_kB1250; break; case 1500: - rrc->srb1_poll_byte = PollByte_kB1500; + rrc->srb1_poll_byte = LTE_PollByte_kB1500; break; case 2000: - rrc->srb1_poll_byte = PollByte_kB2000; + rrc->srb1_poll_byte = LTE_PollByte_kB2000; break; case 3000: - rrc->srb1_poll_byte = PollByte_kB3000; + rrc->srb1_poll_byte = LTE_PollByte_kB3000; break; default: if (srb1_poll_byte >= 10000) - rrc->srb1_poll_byte = PollByte_kBinfinity; + 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", @@ -1867,127 +1872,127 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { switch (srb1_timer_reordering) { case 0: - rrc->srb1_timer_reordering = T_Reordering_ms0; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms0; break; case 5: - rrc->srb1_timer_reordering = T_Reordering_ms5; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms5; break; case 10: - rrc->srb1_timer_reordering = T_Reordering_ms10; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms10; break; case 15: - rrc->srb1_timer_reordering = T_Reordering_ms15; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms15; break; case 20: - rrc->srb1_timer_reordering = T_Reordering_ms20; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms20; break; case 25: - rrc->srb1_timer_reordering = T_Reordering_ms25; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms25; break; case 30: - rrc->srb1_timer_reordering = T_Reordering_ms30; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms30; break; case 35: - rrc->srb1_timer_reordering = T_Reordering_ms35; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms35; break; case 40: - rrc->srb1_timer_reordering = T_Reordering_ms40; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms40; break; case 45: - rrc->srb1_timer_reordering = T_Reordering_ms45; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms45; break; case 50: - rrc->srb1_timer_reordering = T_Reordering_ms50; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms50; break; case 55: - rrc->srb1_timer_reordering = T_Reordering_ms55; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms55; break; case 60: - rrc->srb1_timer_reordering = T_Reordering_ms60; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms60; break; case 65: - rrc->srb1_timer_reordering = T_Reordering_ms65; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms65; break; case 70: - rrc->srb1_timer_reordering = T_Reordering_ms70; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms70; break; case 75: - rrc->srb1_timer_reordering = T_Reordering_ms75; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms75; break; case 80: - rrc->srb1_timer_reordering = T_Reordering_ms80; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms80; break; case 85: - rrc->srb1_timer_reordering = T_Reordering_ms85; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms85; break; case 90: - rrc->srb1_timer_reordering = T_Reordering_ms90; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms90; break; case 95: - rrc->srb1_timer_reordering = T_Reordering_ms95; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms95; break; case 100: - rrc->srb1_timer_reordering = T_Reordering_ms100; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms100; break; case 110: - rrc->srb1_timer_reordering = T_Reordering_ms110; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms110; break; case 120: - rrc->srb1_timer_reordering = T_Reordering_ms120; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms120; break; case 130: - rrc->srb1_timer_reordering = T_Reordering_ms130; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms130; break; case 140: - rrc->srb1_timer_reordering = T_Reordering_ms140; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms140; break; case 150: - rrc->srb1_timer_reordering = T_Reordering_ms150; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms150; break; case 160: - rrc->srb1_timer_reordering = T_Reordering_ms160; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms160; break; case 170: - rrc->srb1_timer_reordering = T_Reordering_ms170; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms170; break; case 180: - rrc->srb1_timer_reordering = T_Reordering_ms180; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms180; break; case 190: - rrc->srb1_timer_reordering = T_Reordering_ms190; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms190; break; case 200: - rrc->srb1_timer_reordering = T_Reordering_ms200; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms200; break; default: @@ -1996,12 +2001,12 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { RC.config_file_name, i, srb1_timer_reordering); } } else { - rrc->srb1_timer_poll_retransmit = T_PollRetransmit_ms80; - rrc->srb1_timer_reordering = T_Reordering_ms35; - rrc->srb1_timer_status_prohibit = T_StatusProhibit_ms0; - rrc->srb1_poll_pdu = PollPDU_p4; - rrc->srb1_poll_byte = PollByte_kBinfinity; - rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + rrc->srb1_timer_poll_retransmit = LTE_T_PollRetransmit_ms80; + rrc->srb1_timer_reordering = LTE_T_Reordering_ms35; + rrc->srb1_timer_status_prohibit = LTE_T_StatusProhibit_ms0; + rrc->srb1_poll_pdu = LTE_PollPDU_p4; + rrc->srb1_poll_byte = LTE_PollByte_kBinfinity; + rrc->srb1_max_retx_threshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; } break; @@ -2046,37 +2051,162 @@ int RCconfig_gtpu(void ) { return 0; } - -int RCconfig_S1(MessageDef *msg_p, uint32_t i) { - int j,k = 0; - int enb_id; - int32_t my_int; - const char *active_enb[MAX_ENB]; - char *address = NULL; - char *cidr = NULL; +//----------------------------------------------------------------------------- +/* +* Configure the s1ap_register_enb_req in itti message for future +* communications between eNB(s) and MME. +*/ +int RCconfig_S1( + MessageDef *msg_p, + uint32_t i) +//----------------------------------------------------------------------------- +{ + int enb_id = 0; + int32_t my_int = 0; + const char *active_enb[MAX_ENB]; + char *address = NULL; + char *cidr = NULL; + /*------------------------------------------------------------------------------*/ + /* + * the only reason for all these variables is, that they are "hard-encoded" into + * the CCPARAMS_DESC macro and we need it for the default_DRX value ... + */ + char *frame_type = NULL; + int32_t tdd_config = 0; + int32_t tdd_config_s = 0; + char *prefix_type = NULL; + char *pbch_repetition = NULL; + int32_t eutra_band = 0; + long long int downlink_frequency = 0; + int32_t uplink_frequency_offset = 0; + int32_t Nid_cell = 0; + int32_t Nid_cell_mbsfn = 0; + int32_t N_RB_DL = 0; + int32_t nb_antenna_ports = 0; + int32_t prach_root = 0; + int32_t prach_config_index = 0; + char *prach_high_speed = NULL; + int32_t prach_zero_correlation = 0; + int32_t prach_freq_offset = 0; + int32_t pucch_delta_shift = 0; + int32_t pucch_nRB_CQI = 0; + int32_t pucch_nCS_AN = 0; + int32_t pucch_n1_AN = 0; + int32_t pdsch_referenceSignalPower = 0; + int32_t pdsch_p_b = 0; + int32_t pusch_n_SB = 0; + char *pusch_hoppingMode = NULL; + int32_t pusch_hoppingOffset = 0; + char *pusch_enable64QAM = NULL; + char *pusch_groupHoppingEnabled = NULL; + int32_t pusch_groupAssignment = 0; + char *pusch_sequenceHoppingEnabled = NULL; + int32_t pusch_nDMRS1 = 0; + char *phich_duration = NULL; + char *phich_resource = NULL; + char *srs_enable = NULL; + int32_t srs_BandwidthConfig = 0; + int32_t srs_SubframeConfig = 0; + char *srs_ackNackST = NULL; + char *srs_MaxUpPts = NULL; + int32_t pusch_p0_Nominal = 0; + char *pusch_alpha = NULL; + int32_t pucch_p0_Nominal = 0; + int32_t msg3_delta_Preamble = 0; + char *pucch_deltaF_Format1 = NULL; + char *pucch_deltaF_Format1b = NULL; + char *pucch_deltaF_Format2 = NULL; + char *pucch_deltaF_Format2a = NULL; + char *pucch_deltaF_Format2b = NULL; + int32_t rach_numberOfRA_Preambles = 0; + char *rach_preamblesGroupAConfig = NULL; + int32_t rach_sizeOfRA_PreamblesGroupA = 0; + int32_t rach_messageSizeGroupA = 0; + char *rach_messagePowerOffsetGroupB = NULL; + int32_t rach_powerRampingStep = 0; + int32_t rach_preambleInitialReceivedTargetPower = 0; + int32_t rach_preambleTransMax = 0; + int32_t rach_raResponseWindowSize = 10; + int32_t rach_macContentionResolutionTimer = 0; + int32_t rach_maxHARQ_Msg3Tx = 0; + int32_t pcch_defaultPagingCycle = 0; + char *pcch_nB = NULL; + int32_t bcch_modificationPeriodCoeff = 0; + int32_t ue_TimersAndConstants_t300 = 0; + int32_t ue_TimersAndConstants_t301 = 0; + int32_t ue_TimersAndConstants_t310 = 0; + int32_t ue_TimersAndConstants_t311 = 0; + int32_t ue_TimersAndConstants_n310 = 0; + int32_t ue_TimersAndConstants_n311 = 0; + int32_t ue_TransmissionMode = 0; + int32_t ue_multiple_max = 0; + //TTN - for D2D + //SIB18 + const char *rxPool_sc_CP_Len = NULL; + const char *rxPool_sc_Period = NULL; + const char *rxPool_data_CP_Len = NULL; + libconfig_int rxPool_ResourceConfig_prb_Num = 0; + libconfig_int rxPool_ResourceConfig_prb_Start = 0; + libconfig_int rxPool_ResourceConfig_prb_End = 0; + const char *rxPool_ResourceConfig_offsetIndicator_present = NULL; + libconfig_int rxPool_ResourceConfig_offsetIndicator_choice = 0; + const char *rxPool_ResourceConfig_subframeBitmap_present = NULL; + char *rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = NULL; + libconfig_int rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 0; + libconfig_int rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + //SIB19 + //For discRxPool + const char *discRxPool_cp_Len = NULL; + const char *discRxPool_discPeriod = NULL; + libconfig_int discRxPool_numRetx = 0; + libconfig_int discRxPool_numRepetition = 0; + libconfig_int discRxPool_ResourceConfig_prb_Num = 0; + libconfig_int discRxPool_ResourceConfig_prb_Start = 0; + libconfig_int discRxPool_ResourceConfig_prb_End = 0; + const char *discRxPool_ResourceConfig_offsetIndicator_present = NULL; + libconfig_int discRxPool_ResourceConfig_offsetIndicator_choice = 0; + const char *discRxPool_ResourceConfig_subframeBitmap_present = NULL; + char *discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = NULL; + libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 0; + libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + //For discRxPoolPS + const char *discRxPoolPS_cp_Len = NULL; + const char *discRxPoolPS_discPeriod = NULL; + libconfig_int discRxPoolPS_numRetx = 0; + libconfig_int discRxPoolPS_numRepetition = 0; + libconfig_int discRxPoolPS_ResourceConfig_prb_Num = 0; + libconfig_int discRxPoolPS_ResourceConfig_prb_Start = 0; + libconfig_int discRxPoolPS_ResourceConfig_prb_End = 0; + const char *discRxPoolPS_ResourceConfig_offsetIndicator_present = NULL; + libconfig_int discRxPoolPS_ResourceConfig_offsetIndicator_choice = 0; + const char *discRxPoolPS_ResourceConfig_subframeBitmap_present = NULL; + char *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf = NULL; + libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size = 0; + libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + /*------------------------------------------------------------------------------*/ // for no gcc warnings (void)my_int; - memset((char *)active_enb, 0, MAX_ENB * sizeof(char *)); + memset((char *)active_enb, 0, MAX_ENB * sizeof(char *)); paramdef_t ENBSParams[] = ENBSPARAMS_DESC; - paramdef_t ENBParams[] = ENBPARAMS_DESC; - paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0}; + paramdef_t ENBParams[] = ENBPARAMS_DESC; + paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0}; /* get global parameters, defined outside any section in the config file */ - config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); - AssertFatal (i0) { + if (ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt > 0) { // Output a list of all eNBs. - config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); + config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t), NULL); if (ENBParamList.numelt > 0) { - for (k = 0; k < ENBParamList.numelt; k++) { + for (int k = 0; k < ENBParamList.numelt; k++) { if (ENBParamList.paramarray[k][ENB_ENB_ID_IDX].uptr == NULL) { // Calculate a default eNB ID if (EPC_MODE_ENABLED) { - uint32_t hash; - hash = s1ap_generate_eNB_id (); + uint32_t hash = 0; + hash = s1ap_generate_eNB_id(); enb_id = k + (hash & 0xFFFF8); } else { enb_id = k; @@ -2086,22 +2216,31 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { } // search if in active list - for (j=0; j < ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; j++) { + for (int j = 0; j < ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; j++) { if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[j], *(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)) == 0) { paramdef_t PLMNParams[] = PLMNPARAMS_DESC; paramlist_def_t PLMNParamList = {ENB_CONFIG_STRING_PLMN_LIST, NULL, 0}; + paramdef_t CCsParams[] = CCPARAMS_DESC; + /* map parameter checking array instances to parameter definition array instances */ + checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK; + + for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) { + CCsParams[I].chkPptr = &(config_check_CCparams[I]); + } + /* map parameter checking array instances to parameter definition array instances */ checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK; - for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) { PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); + } - paramdef_t S1Params[] = S1PARAMS_DESC; - paramlist_def_t S1ParamList = {ENB_CONFIG_STRING_MME_IP_ADDRESS,NULL,0}; - paramdef_t SCTPParams[] = SCTPPARAMS_DESC; - paramdef_t NETParams[] = NETPARAMS_DESC; + paramdef_t S1Params[] = S1PARAMS_DESC; + paramlist_def_t S1ParamList = {ENB_CONFIG_STRING_MME_IP_ADDRESS, NULL, 0}; + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + paramdef_t NETParams[] = NETPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k); + sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k); S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = enb_id; if (strcmp(*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) { @@ -2109,13 +2248,15 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { } else if (strcmp(*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr), "CELL_HOME_ENB") == 0) { S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_HOME_ENB; } else { - AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n", - RC.config_file_name, i, *(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr)); + AssertFatal(0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n", + RC.config_file_name, + i, + *(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr)); } - S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)); - S1AP_REGISTER_ENB_REQ(msg_p).tac = *ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].uptr; + S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)); + S1AP_REGISTER_ENB_REQ(msg_p).tac = *ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].uptr; AssertFatal(!ENBParamList.paramarray[k][ENB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr && !ENBParamList.paramarray[k][ENB_MOBILE_NETWORK_CODE_IDX_OLD].strptr, "It seems that you use an old configuration file. Please change the existing\n" @@ -2127,9 +2268,10 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { " plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n"); config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); - if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) + if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) { AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n", PLMNParamList.numelt); + } S1AP_REGISTER_ENB_REQ(msg_p).num_plmn = PLMNParamList.numelt; @@ -2143,8 +2285,48 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { S1AP_REGISTER_ENB_REQ(msg_p).mnc[l]); } - S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0; - config_getlist( &S1ParamList,S1Params,sizeof(S1Params)/sizeof(paramdef_t),aprefix); + /* Default DRX param */ + /* + * Here we get the config of the first CC, since the s1ap_register_enb_req_t doesn't support multiple CC. + * There is a unique value of defaultPagingCycle per eNB (same for multiple cells). + * Hence, it should be stated somewhere that the value should be the same for every CC, or put the value outside the CC + * in the conf file. + */ + sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0); + config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix); + + switch (pcch_defaultPagingCycle) { + case 32: { + S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0; + break; + } + + case 64: { + S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 1; + break; + } + + case 128: { + S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 2; + break; + } + + case 256: { + S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 3; + break; + } + + default: { + LOG_E(S1AP, "Default I-DRX value in conf file is invalid (%i). Should be 32, 64, 128 or 256. \ + Default DRX set to 32 in MME configuration\n", + pcch_defaultPagingCycle); + S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0; + } + } + + /* MME connection params */ + sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k); + config_getlist(&S1ParamList, S1Params, sizeof(S1Params)/sizeof(paramdef_t), aprefix); S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0; for (int l = 0; l < S1ParamList.numelt; l++) { @@ -2161,10 +2343,11 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1; } - if (S1ParamList.paramarray[l][ENB_MME_BROADCAST_PLMN_INDEX].iptr) + if (S1ParamList.paramarray[l][ENB_MME_BROADCAST_PLMN_INDEX].iptr) { S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1ParamList.paramarray[l][ENB_MME_BROADCAST_PLMN_INDEX].numelt; - else + } else { S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = 0; + } AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] <= S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, "List of broadcast PLMN to be sent to MME can not be longer than actual " @@ -2186,8 +2369,9 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { if (S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] == 0) { S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; - for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el) + for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el) { S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = el; + } } } @@ -2205,7 +2389,6 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); // NETWORK_INTERFACES config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); - // S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U); cidr = *(NETParams[ENB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr); address = strtok(cidr, "/"); S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0; @@ -2395,10 +2578,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { || X2AP_REGISTER_ENB_REQ(msg_p).mnc < 100, "MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n", X2AP_REGISTER_ENB_REQ(msg_p).mnc); - /* CC params */ config_getlist(&CCsParamList, NULL, 0, aprefix); - X2AP_REGISTER_ENB_REQ (msg_p).num_cc = CCsParamList.numelt; if (CCsParamList.numelt > 0) { @@ -2445,7 +2626,6 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { AssertFatal(X2ParamList.numelt <= X2AP_MAX_NB_ENB_IP_ADDRESS, "value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n", X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS); - X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 = 0; for (l = 0; l < X2ParamList.numelt; l++) { @@ -2499,29 +2679,33 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { int RCconfig_parallel(void) { char *parallel_conf = NULL; char *worker_conf = NULL; - extern char *parallel_config; - extern char *worker_config; + + paramdef_t ThreadParams[] = THREAD_CONF_DESC; paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0}; config_getlist( &THREADParamList,NULL,0,NULL); - if(THREADParamList.numelt>0) { - config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL); - parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr)); - } else { - parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT"); + if(parallel_config == NULL){ + if(THREADParamList.numelt>0) { + config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL); + parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr)); + } else { + parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT"); + } + set_parallel_conf(parallel_conf); } - if(THREADParamList.numelt>0) { - config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL); - worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_WORKER_IDX].strptr)); - } else { - worker_conf = strdup("WORKER_ENABLE"); + if(worker_config == NULL){ + if(THREADParamList.numelt>0) { + config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL); + worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_WORKER_IDX].strptr)); + } else { + worker_conf = strdup("WORKER_ENABLE"); + } + set_worker_conf(worker_conf); } - if(parallel_config == NULL) set_parallel_conf(parallel_conf); - if(worker_config == NULL) set_worker_conf(worker_conf); return 0; } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index ed1b4aeaa2..f5cf301828 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -40,12 +40,8 @@ #include "PHY/impl_defs_lte.h" #include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" -#ifdef CMAKER -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" #include "rrc_messages_types.h" -#else -#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h" -#endif #include "RRC/LTE/rrc_defs.h" #include diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index cd4bee4c07..63a346f9a1 100755 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -299,7 +299,7 @@ typedef enum { #define ENB_CONFIG_STRING_PUCCH_DELTA_SHIFT "pucch_delta_shift" #define ENB_CONFIG_STRING_PUCCH_NRB_CQI "pucch_nRB_CQI" #define ENB_CONFIG_STRING_PUCCH_NCS_AN "pucch_nCS_AN" -//#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +//#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #define ENB_CONFIG_STRING_PUCCH_N1_AN "pucch_n1_AN" //#endif #define ENB_CONFIG_STRING_PDSCH_RS_EPRE "pdsch_referenceSignalPower" diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 973d322a5f..20ab7cda50 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -157,7 +157,7 @@ rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logi frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -170,7 +170,7 @@ rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, lo frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -183,7 +183,7 @@ frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t chann frame_t frame = flexran_get_current_frame(mod_id); sub_frame_t subframe = flexran_get_current_subframe(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -719,7 +719,7 @@ uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id) */ -TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) +LTE_TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { if (!rrc_is_present(mod_id)) return -1; @@ -740,11 +740,11 @@ Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measGapConfig) return -1; - if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1; + if (ue_context_p->ue_context.measGapConfig->present != LTE_MeasGapConfig_PR_setup) return -1; switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) { - case MeasGapConfig__setup__gapOffset_PR_gp0: + case LTE_MeasGapConfig__setup__gapOffset_PR_gp0: return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; - case MeasGapConfig__setup__gapOffset_PR_gp1: + case LTE_MeasGapConfig__setup__gapOffset_PR_gp1: return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2; default: return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF; @@ -761,11 +761,11 @@ long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measGapConfig) return -1; - if (ue_context_p->ue_context.measGapConfig->present != MeasGapConfig_PR_setup) return -1; + if (ue_context_p->ue_context.measGapConfig->present != LTE_MeasGapConfig_PR_setup) return -1; switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) { - case MeasGapConfig__setup__gapOffset_PR_gp0: + case LTE_MeasGapConfig__setup__gapOffset_PR_gp0: return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; - case MeasGapConfig__setup__gapOffset_PR_gp1: + case LTE_MeasGapConfig__setup__gapOffset_PR_gp1: return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp1; default: return -1; @@ -804,7 +804,7 @@ int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id) if (!ue_context_p) return -1; if (!ue_context_p->ue_context.UE_Capability) return -1; - SupportedBandListEUTRA_t *bands = &ue_context_p->ue_context.UE_Capability->rf_Parameters.supportedBandListEUTRA; + LTE_SupportedBandListEUTRA_t *bands = &ue_context_p->ue_context.UE_Capability->rf_Parameters.supportedBandListEUTRA; for (int i = 0; i < bands->list.count; i++) { if (bands->list.array[i]->halfDuplex > 0) return 1; } @@ -976,7 +976,7 @@ BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uin return RC.rrc[mod_id]->carrier[cc_id].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) +LTE_CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { if (!rrc_is_present(mod_id)) return -1; @@ -1041,9 +1041,9 @@ int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1; switch (ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup) { - case AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop: + case LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop: return 2; - case AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop: + case LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop: return 1; default: return 0; @@ -1365,7 +1365,7 @@ uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, mid_t ue_id, lcid_t lcid) /******************** RRC *****************************/ -MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id) +LTE_MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id) { if (!rrc_is_present(mod_id)) return -1; @@ -1412,11 +1412,11 @@ int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id) if (!ue_context_p) return 0; if (!ue_context_p->ue_context.measResults) return 0; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return 0; - if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return 0; + if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return 0; return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count; } -PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id) +LTE_PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id) { if (!rrc_is_present(mod_id)) return -1; @@ -1426,7 +1426,7 @@ PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int ce if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; + if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1; return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->physCellId; } @@ -1441,7 +1441,7 @@ float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id) if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; + if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult) return 0; return RSRP_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult)]; @@ -1457,7 +1457,7 @@ float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id) if (!ue_context_p) return -1; if (!ue_context_p->ue_context.measResults) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - if (ue_context_p->ue_context.measResults->measResultNeighCells->present != MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; + if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult) return 0; return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)]; } diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 37bdaae170..4fa05fd2f6 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -308,7 +308,7 @@ PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id); /* Get timer in subframes. Controls the synchronization status of the UE, not the actual timing advance procedure. See TS 36.321 */ -TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +LTE_TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id); /* Get measurement gap configuration. See TS 36.133 */ Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id); @@ -365,7 +365,7 @@ BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id); /* Get aperiodic CQI report mode */ -CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +LTE_CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); /* Get ACK/NACK feedback mode. TDD only */ long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id); @@ -481,7 +481,7 @@ uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, mid_t ue_id, lcid_t lcid); /*********************RRC**********************/ /*Get primary cell measuremeant id flexRAN*/ -MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id); +LTE_MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id); /*Get primary cell RSRP measurement flexRAN*/ float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id); @@ -493,7 +493,7 @@ float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id); int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id); /*Get physical cell id*/ -PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id); +LTE_PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id); /*Get RSRP of neighbouring Cell*/ float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id); diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 0b4f05a56e..ac5c4a5de3 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -32,16 +32,16 @@ #include "COMMON/platform_types.h" #include "COMMON/platform_constants.h" -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) -#include "PRACH-ConfigSIB-v1310.h" +#include "LTE_RadioResourceConfigDedicated.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#include "LTE_PRACH-ConfigSIB-v1310.h" #endif -#include "MeasGapConfig.h" -#include "MeasObjectToAddModList.h" -#include "TDD-Config.h" -#include "MAC-MainConfig.h" +#include "LTE_MeasGapConfig.h" +#include "LTE_MeasObjectToAddModList.h" +#include "LTE_TDD-Config.h" +#include "LTE_MAC-MainConfig.h" #include "mac.h" #include "mac_proto.h" #include "mac_extern.h" @@ -49,11 +49,11 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "common/ran_context.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MBSFN-AreaInfoList-r9.h" -#include "MBSFN-AreaInfo-r9.h" -#include "MBSFN-SubframeConfigList.h" -#include "PMCH-InfoList-r9.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_MBSFN-AreaInfoList-r9.h" +#include "LTE_MBSFN-AreaInfo-r9.h" +#include "LTE_MBSFN-SubframeConfigList.h" +#include "LTE_PMCH-InfoList-r9.h" #endif extern RAN_CONTEXT_t RC; @@ -239,13 +239,13 @@ void config_mib(int Mod_idP, int CC_idP, int eutra_bandP, int dl_BandwidthP, - PHICH_Config_t *phich_configP, + LTE_PHICH_Config_t *phich_configP, int Nid_cellP, int NcpP, int p_eNBP, uint32_t dl_CarrierFreqP, uint32_t ul_CarrierFreqP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint32_t pbch_repetitionP #endif @@ -317,14 +317,14 @@ void config_mib(int Mod_idP, cfg->sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG; cfg->num_tlv++; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) cfg->emtc_config.pbch_repetitions_enable_r13.value = pbch_repetitionP; cfg->emtc_config.pbch_repetitions_enable_r13.tl.tag = NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG; cfg->num_tlv++; #endif LOG_I(MAC, "%s() NFAPI_CONFIG_REQUEST(num_tlv:%u) DL_BW:%u UL_BW:%u Ncp %d,p_eNB %d,earfcn %d,band %d,phich_resource %u phich_duration %u phich_power_offset %u PSS %d SSS %d PCI %d" -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) " PBCH repetition %d" #endif @@ -342,13 +342,13 @@ void config_mib(int Mod_idP, ,cfg->sch_config.primary_synchronization_signal_epre_eprers.value ,cfg->sch_config.secondary_synchronization_signal_epre_eprers.value ,cfg->sch_config.physical_cell_id.value -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,cfg->emtc_config.pbch_repetitions_enable_r13.value #endif ); } -void config_sib1(int Mod_idP, int CC_idP, TDD_Config_t * tdd_ConfigP) +void config_sib1(int Mod_idP, int CC_idP, LTE_TDD_Config_t * tdd_ConfigP) { @@ -380,14 +380,14 @@ int power_off_dB[6] = { 78, 118, 140, 170, 188, 200 }; void config_sib2(int Mod_idP, int CC_idP, - RadioResourceConfigCommonSIB_t * radioResourceConfigCommonP, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RadioResourceConfigCommonSIB_t * radioResourceConfigCommon_BRP, + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommonP, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon_BRP, #endif - ARFCN_ValueEUTRA_t *ul_CArrierFreqP, + LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreqP, long *ul_BandwidthP, - AdditionalSpectrumEmission_t *additionalSpectrumEmissionP, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { + LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmissionP, + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; @@ -474,7 +474,7 @@ config_sib2(int Mod_idP, // how to enable/disable SRS? - if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) { + if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present== LTE_SoundingRS_UL_ConfigCommon_PR_setup) { cfg->srs_config.bandwidth_configuration.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig; cfg->srs_config.bandwidth_configuration.tl.tag = NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG; cfg->num_tlv++; @@ -497,7 +497,7 @@ config_sib2(int Mod_idP, cfg->num_tlv++; } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0) { AssertFatal(radioResourceConfigCommon_BRP != NULL, "radioResource rou is missing\n"); AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL, "ext4 is missing\n"); @@ -513,11 +513,11 @@ config_sib2(int Mod_idP, cfg->emtc_config.prach_catm_high_speed_flag.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG; cfg->num_tlv++; - struct PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; + struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; - PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13; + LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13; - PRACH_ParametersCE_r13_t *p; + LTE_PRACH_ParametersCE_r13_t *p; cfg->emtc_config.prach_ce_level_0_enable.value = 0; cfg->emtc_config.prach_ce_level_0_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG; cfg->num_tlv++; @@ -664,18 +664,18 @@ config_sib2(int Mod_idP, cfg->num_tlv++; } - struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13; + struct LTE_FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13; if ((ext4_freqHoppingParameters) && (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)){ switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->present) { - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */ + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */ break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13: + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13: cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_FDD_r13; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG; cfg->num_tlv++; break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13: + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13: cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_TDD_r13; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG; cfg->num_tlv++; @@ -685,14 +685,14 @@ config_sib2(int Mod_idP, if ((ext4_freqHoppingParameters) && (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)){ switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->present) { - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */ + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */ break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13: + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13: cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_FDD_r13; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG; cfg->num_tlv++; break; - case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13: + case LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13: cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_TDD_r13; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG; cfg->num_tlv++; @@ -708,7 +708,7 @@ void config_dedicated(int Mod_idP, int CC_idP, uint16_t rnti, - struct PhysicalConfigDedicated *physicalConfigDedicated) + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated) { } @@ -716,7 +716,7 @@ config_dedicated(int Mod_idP, void config_dedicated_scell(int Mod_idP, uint16_t rnti, - SCellToAddMod_r10_t * sCellToAddMod_r10) + LTE_SCellToAddMod_r10_t * sCellToAddMod_r10) { } @@ -728,45 +728,45 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, int physCellId, int p_eNB, int Ncp, int eutra_band, uint32_t dl_CarrierFreq, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int pbch_repetition, #endif rnti_t rntiP, - BCCH_BCH_Message_t * mib, - RadioResourceConfigCommonSIB_t * + LTE_BCCH_BCH_Message_t * mib, + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RadioResourceConfigCommonSIB_t * +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon_BR, #endif - struct PhysicalConfigDedicated + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SCellToAddMod_r10_t * sCellToAddMod_r10, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SCellToAddMod_r10_t * sCellToAddMod_r10, + //struct LTE_PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, + LTE_MeasObjectToAddMod_t ** measObj, + LTE_MAC_MainConfig_t * mac_MainConfig, long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, - SchedulingInfoList_t * schedulingInfoList, + LTE_LogicalChannelConfig_t * logicalChannelConfig, + LTE_MeasGapConfig_t * measGapConfig, + LTE_TDD_Config_t * tdd_Config, + LTE_MobilityControlInfo_t * mobilityControlInfo, + LTE_SchedulingInfoList_t * schedulingInfoList, uint32_t ul_CarrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t * + LTE_AdditionalSpectrumEmission_t * additionalSpectrumEmission, - struct MBSFN_SubframeConfigList + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList + LTE_MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + LTE_PMCH_InfoList_r9_t * pmch_InfoList #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) , - SystemInformationBlockType1_v1310_IEs_t * + LTE_SystemInformationBlockType1_v1310_IEs_t * sib1_v13ext #endif ) { @@ -815,7 +815,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, p_eNB, dl_CarrierFreq, ul_CarrierFreq -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , pbch_repetition #endif ); @@ -827,7 +827,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, RC.mac[Mod_idP]->common_channels[CC_idP].schedulingInfoList = schedulingInfoList; config_sib1(Mod_idP,CC_idP,tdd_Config); } -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) if (sib1_v13ext != NULL) { RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext; } @@ -886,7 +886,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, dl_Bandwidth; config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) radioResourceConfigCommon_BR, #endif NULL, ul_Bandwidth, additionalSpectrumEmission, @@ -933,7 +933,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (sCellToAddMod_r10 != NULL) { UE_id = find_UE_id(Mod_idP, rntiP); @@ -966,11 +966,11 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP, subframeAllocation.choice.oneFrame.buf[0]); } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) RC.mac[Mod_idP]->common_channels[0].MBMS_flag = MBMS_Flag; #endif } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (mbsfn_AreaInfoList != NULL) { // One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index c38c32a4de..bec39aa8dc 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -33,16 +33,16 @@ #include "COMMON/platform_types.h" #include "COMMON/platform_constants.h" #include "SCHED_UE/sched_UE.h" -#include "SystemInformationBlockType2.h" +#include "LTE_SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) -#include "PRACH-ConfigSIB-v1310.h" +#include "LTE_RadioResourceConfigDedicated.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#include "LTE_PRACH-ConfigSIB-v1310.h" #endif -#include "MeasGapConfig.h" -#include "MeasObjectToAddModList.h" -#include "TDD-Config.h" -#include "MAC-MainConfig.h" +#include "LTE_MeasGapConfig.h" +#include "LTE_MeasObjectToAddModList.h" +#include "LTE_TDD-Config.h" +#include "LTE_MAC-MainConfig.h" #include "mac.h" #include "mac_proto.h" #include "mac_extern.h" @@ -51,11 +51,11 @@ #include "PHY/INIT/phy_init.h" #include "common/ran_context.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MBSFN-AreaInfoList-r9.h" -#include "MBSFN-AreaInfo-r9.h" -#include "MBSFN-SubframeConfigList.h" -#include "PMCH-InfoList-r9.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_MBSFN-AreaInfoList-r9.h" +#include "LTE_MBSFN-AreaInfo-r9.h" +#include "LTE_MBSFN-SubframeConfigList.h" +#include "LTE_PMCH-InfoList-r9.h" #endif extern void mac_init_cell_params(int Mod_idP,int CC_idP); @@ -107,38 +107,38 @@ int rrc_mac_config_req_ue(module_id_t Mod_idP, int CC_idP, uint8_t eNB_index, - RadioResourceConfigCommonSIB_t * + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon, - struct PhysicalConfigDedicated + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SCellToAddMod_r10_t * sCellToAddMod_r10, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SCellToAddMod_r10_t * sCellToAddMod_r10, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, + LTE_MeasObjectToAddMod_t ** measObj, + LTE_MAC_MainConfig_t * mac_MainConfig, long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, + LTE_LogicalChannelConfig_t * logicalChannelConfig, + LTE_MeasGapConfig_t * measGapConfig, + LTE_TDD_Config_t * tdd_Config, + LTE_MobilityControlInfo_t * mobilityControlInfo, uint8_t * SIwindowsize, uint16_t * SIperiod, - ARFCN_ValueEUTRA_t * ul_CarrierFreq, + LTE_ARFCN_ValueEUTRA_t * ul_CarrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t * + LTE_AdditionalSpectrumEmission_t * additionalSpectrumEmission, - struct MBSFN_SubframeConfigList + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList + LTE_MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + LTE_PMCH_InfoList_r9_t * pmch_InfoList #endif #ifdef CBA , uint8_t num_active_cba_groups, uint16_t cba_rnti #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,config_action_t config_action ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id @@ -219,11 +219,11 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, mac_MainConfig->ul_SCH_Config->periodicBSR_Timer; } else { UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = -#if (RRC_VERSION < MAKE_VERSION(12, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(12, 0, 0)) (uint16_t) - MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity + LTE_MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity #else - (uint16_t) PeriodicBSR_Timer_r12_infinity; + (uint16_t) LTE_PeriodicBSR_Timer_r12_infinity; #endif ; } @@ -234,7 +234,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, } else { UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = (uint16_t) - MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; } if(nfapi_mode!=3) phy_config_harq_ue(Mod_idP, 0, eNB_index, @@ -246,17 +246,17 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, (uint16_t) mac_MainConfig->ul_SCH_Config-> retxBSR_Timer; } else { -#if (RRC_VERSION < MAKE_VERSION(12, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(12, 0, 0)) UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = (uint16_t) - MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; + LTE_MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; #else UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) RetxBSR_Timer_r12_sf2560; + (uint16_t) LTE_RetxBSR_Timer_r12_sf2560; #endif } } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { @@ -326,13 +326,13 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, } else { UE_mac_inst[Mod_idP].PHR_reconfigured = 0; UE_mac_inst[Mod_idP].PHR_state = - MAC_MainConfig__phr_Config_PR_setup; + LTE_MAC_MainConfig__phr_Config_PR_setup; UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = - MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; + LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = - MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; + LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = - MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; + LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; } UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = @@ -362,7 +362,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, physicalConfigDedicated); UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (sCellToAddMod_r10 != NULL) { @@ -410,14 +410,14 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, rach_ConfigCommon, (void *) mobilityControlInfo-> radioResourceConfigCommon.rach_ConfigCommon, - sizeof(RACH_ConfigCommon_t)); + sizeof(LTE_RACH_ConfigCommon_t)); } memcpy((void *) &UE_mac_inst[Mod_idP]. radioResourceConfigCommon->prach_Config.prach_ConfigInfo, (void *) mobilityControlInfo-> radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - sizeof(PRACH_ConfigInfo_t)); + sizeof(LTE_PRACH_ConfigInfo_t)); UE_mac_inst[Mod_idP].radioResourceConfigCommon-> prach_Config.rootSequenceIndex = mobilityControlInfo->radioResourceConfigCommon. @@ -430,19 +430,19 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, pdsch_ConfigCommon, (void *) mobilityControlInfo-> radioResourceConfigCommon.pdsch_ConfigCommon, - sizeof(PDSCH_ConfigCommon_t)); + sizeof(LTE_PDSCH_ConfigCommon_t)); } // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon memcpy((void *) &UE_mac_inst[Mod_idP]. radioResourceConfigCommon->pusch_ConfigCommon, (void *) &mobilityControlInfo-> radioResourceConfigCommon.pusch_ConfigCommon, - sizeof(PUSCH_ConfigCommon_t)); + sizeof(LTE_PUSCH_ConfigCommon_t)); if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) { /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config, (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config, - sizeof(PHICH_Config_t)); */ + sizeof(LTE_PHICH_Config_t)); */ } if (mobilityControlInfo->radioResourceConfigCommon. @@ -452,7 +452,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, pucch_ConfigCommon, (void *) mobilityControlInfo-> radioResourceConfigCommon.pucch_ConfigCommon, - sizeof(PUCCH_ConfigCommon_t)); + sizeof(LTE_PUCCH_ConfigCommon_t)); } if (mobilityControlInfo-> @@ -462,7 +462,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, soundingRS_UL_ConfigCommon, (void *) mobilityControlInfo-> radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - sizeof(SoundingRS_UL_ConfigCommon_t)); + sizeof(LTE_SoundingRS_UL_ConfigCommon_t)); } if (mobilityControlInfo-> @@ -472,7 +472,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, uplinkPowerControlCommon, (void *) mobilityControlInfo-> radioResourceConfigCommon.uplinkPowerControlCommon, - sizeof(UplinkPowerControlCommon_t)); + sizeof(LTE_UplinkPowerControlCommon_t)); } //configure antennaInfoCommon somewhere here.. if (mobilityControlInfo->radioResourceConfigCommon.p_Max) { @@ -491,7 +491,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, ul_CyclicPrefixLength, (void *) mobilityControlInfo-> radioResourceConfigCommon.ul_CyclicPrefixLength, - sizeof(UL_CyclicPrefixLength_t)); + sizeof(LTE_UL_CyclicPrefixLength_t)); } // store the previous rnti in case of failure, and set thenew rnti UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti; @@ -532,7 +532,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, // UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]); } } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (mbsfn_AreaInfoList != NULL) { LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n", @@ -590,7 +590,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); //for D2D - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) switch (config_action) { case CONFIG_ACTION_ADD: if (sourceL2Id){ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 3cc20f9a9d..d6b23fb581 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -30,7 +30,7 @@ */ #include "assertions.h" - +#include "targets/RT/USER/lte-softmodem.h" #include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac_extern.h" @@ -64,7 +64,7 @@ #define DEBUG_eNB_SCHEDULER 1 extern RAN_CONTEXT_t RC; -extern int phy_test; + uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; @@ -79,8 +79,8 @@ schedule_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) nfapi_ul_config_request_body_t *ul_req; int CC_id, UE_id; COMMON_channels_t *cc = RC.mac[module_idP]->common_channels; - SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon; - struct SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated; + LTE_SoundingRS_UL_ConfigCommon_t *soundingRS_UL_ConfigCommon; + struct LTE_SoundingRS_UL_ConfigDedicated *soundingRS_UL_ConfigDedicated; uint8_t TSFC; uint16_t deltaTSFC; // bitmap uint8_t srs_SubframeConfig; @@ -119,7 +119,7 @@ schedule_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) UE_id); if ((soundingRS_UL_ConfigDedicated = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->soundingRS_UL_ConfigDedicated) != NULL) { - if (soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { + if (soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) { get_srs_pos(&cc[CC_id], soundingRS_UL_ConfigDedicated->choice. setup.srs_ConfigIndex, @@ -163,7 +163,7 @@ schedule_CSI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) COMMON_channels_t *cc; nfapi_ul_config_request_body_t *ul_req; int CC_id, UE_id; - struct CQI_ReportPeriodic *cqi_ReportPeriodic; + struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic; uint16_t Npd, N_OFFSET_CQI; int H; @@ -186,7 +186,7 @@ schedule_CSI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) if (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig) { if ((cqi_ReportPeriodic = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) != NULL - && (cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_release)) { + && (cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_release)) { //Rel8 Periodic CQI/PMI/RI reporting get_csi_params(cc, cqi_ReportPeriodic, &Npd, @@ -210,7 +210,7 @@ schedule_CSI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ul_req->number_of_pdus++; ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // PUT rel10-13 UCI options here #endif } else @@ -246,7 +246,7 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) nfapi_ul_config_request_body_t *ul_req_body; int CC_id; int UE_id; - SchedulingRequestConfig_t *SRconfig; + LTE_SchedulingRequestConfig_t *SRconfig; int skip_ue; int is_harq; nfapi_ul_config_sr_information sr; @@ -270,7 +270,7 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) UE_id); if ((SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig) != NULL) { - if (SRconfig->present == SchedulingRequestConfig_PR_setup) { + if (SRconfig->present == LTE_SchedulingRequestConfig_PR_setup) { if (SRconfig->choice.setup.sr_ConfigIndex <= 4) { // 5 ms SR period if ((subframeP % 5) != SRconfig->choice.setup.sr_ConfigIndex) continue; } else if (SRconfig->choice.setup.sr_ConfigIndex <= 14) { // 10 ms SR period @@ -313,7 +313,7 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) LOG_D(MAC,"Frame %d, Subframe %d : Scheduling SR for UE %d/%x is_harq:%d\n",frameP,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].rnti, is_harq); // check Rel10 or Rel8 SR -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if ((UE_list-> UE_template[CC_id][UE_id].physicalConfigDedicated->ext2) && (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020) && (UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->ext2->schedulingRequestConfig_v1020)) { @@ -519,7 +519,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, memset(cc[CC_id].vrb_map_UL, 0, 100); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) cc[CC_id].mcch_active = 0; #endif @@ -630,7 +630,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, rrc_rx_tx(&ctxt, CC_id); #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (cc[CC_id].MBMS_flag > 0) { @@ -662,7 +662,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, if ((subframeP == 0) && (frameP & 3) == 0) schedule_mib(module_idP, frameP, subframeP); - if (phy_test == 0){ + if (get_softmodem_params()->phy_test == 0){ // This schedules SI for legacy LTE and eMTC starting in subframeP schedule_SI(module_idP, frameP, subframeP); // This schedules Paging in subframeP diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index a0ad7177b1..4ebaa51cb0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -120,7 +120,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP, AssertFatal(ra->state != IDLE, "RA is not active for RA %X\n", ra->rnti); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (ra->rach_resource_type > 0) { LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n", @@ -272,16 +272,16 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int rmax = 0; int rep = 0; int reps = 0; int num_nb = 0; first_rb = 0; - struct PRACH_ConfigSIB_v1310 *ext4_prach; - PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13; - PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL }; + struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach; + LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13; + LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL }; uint16_t absSF = (10 * frameP) + subframeP; uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe; @@ -584,6 +584,11 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, ra->state = WAITMSG3; LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP); + T(T_ENB_MAC_UE_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), + T_INT(CC_idP), T_INT(ra->RA_rnti), T_INT(frameP), + T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ), + T_BUFFER(cc[CC_idP].RAR_pdu.payload, 7)); + // DL request mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP; TX_req = @@ -631,18 +636,18 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, uint8_t offset; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int rmax = 0; int rep = 0; int reps = 0; first_rb = 0; - struct PRACH_ConfigSIB_v1310 *ext4_prach; - struct PUCCH_ConfigCommon_v1310 *ext4_pucch; - PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13; - struct N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13; - PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL }; + struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach; + struct LTE_PUCCH_ConfigCommon_v1310 *ext4_pucch; + LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13; + struct LTE_N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13; + LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL }; int pucchreps[4] = { 1, 1, 1, 1 }; int n1pucchan[4] = { 0, 0, 0, 0 }; @@ -722,7 +727,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);*/ -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (ra->rach_resource_type > 0) { // Generate DCI + repetitions first @@ -1232,7 +1237,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, int round; /* - #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) COMMON_channels_t *cc = mac->common_channels; int rmax = 0; @@ -1285,7 +1290,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, if (round != 8) { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (ra->rach_resource_type > 0) { AssertFatal(1 == 0, "Msg4 Retransmissions not handled yet for BL/CE UEs\n"); @@ -1424,7 +1429,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) if (ra->state == MSG2) generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); - else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) + else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); else if (ra->state == WAITMSG4ACK) check_Msg4_retransmission(module_idP, CC_id, frameP, @@ -1453,7 +1458,7 @@ initiate_ra_proc(module_id_t module_idP, sub_frame_t subframeP, uint16_t preamble_index, int16_t timing_offset, uint16_t ra_rnti -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint8_t rach_resource_type #endif ) @@ -1464,10 +1469,10 @@ initiate_ra_proc(module_id_t module_idP, COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; RA_t *ra = &cc->ra[0]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - struct PRACH_ConfigSIB_v1310 *ext4_prach = NULL; - PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL; + struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL; + LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL; static uint8_t failure_cnt = 0; @@ -1477,12 +1482,12 @@ initiate_ra_proc(module_id_t module_idP, prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13; } -#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ +#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ LOG_I(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, subframeP, preamble_index); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d PRACH resource type %d\n", module_idP, CC_id, frameP, subframeP, rach_resource_type); @@ -1492,7 +1497,7 @@ initiate_ra_proc(module_id_t module_idP, uint16_t msg2_subframe = subframeP; int offset; -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) if (prach_ParametersListCE_r13 && prach_ParametersListCE_r13->list.count < rach_resource_type) { @@ -1503,7 +1508,7 @@ initiate_ra_proc(module_id_t module_idP, return; } -#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ +#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0); @@ -1516,7 +1521,7 @@ initiate_ra_proc(module_id_t module_idP, ra[i].state = MSG2; ra[i].timing_offset = timing_offset; ra[i].preamble_subframe = subframeP; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ra[i].rach_resource_type = rach_resource_type; ra[i].msg2_mpdcch_repetition_cnt = 0; ra[i].msg4_mpdcch_repetition_cnt = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index b2b59691f8..460e4f42c9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -59,7 +59,7 @@ extern RAN_CONTEXT_t RC; // NEED TO ADD schedule_SI_BR for SIB1_BR and SIB23_BR // CCE_allocation_infeasible to be done for EPDCCH/MPDCCH -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #define size_Sj25 2 int Sj25[size_Sj25] = { 0, 3 }; @@ -301,8 +301,8 @@ schedule_SIB1_BR(module_id_t module_idP, } } -int si_WindowLength_BR_r13tab[SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare] = { 20, 40, 60, 80, 120, 160, 200 }; -int si_TBS_r13tab[SchedulingInfo_BR_r13__si_TBS_r13_b936 + 1] = { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936 }; +int si_WindowLength_BR_r13tab[LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare] = { 20, 40, 60, 80, 120, 160, 200 }; +int si_TBS_r13tab[LTE_SchedulingInfo_BR_r13__si_TBS_r13_b936 + 1] = { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936 }; //------------------------------------------------------------------------------ void @@ -340,31 +340,31 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n"); - SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13; + LTE_SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13; AssertFatal(schedulingInfoList_BR_r13 != NULL, "sib_v13ext->schedulingInfoList_BR_r13 is null\n"); - SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList; + LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList; AssertFatal(schedulingInfoList_BR_r13->list.count == schedulingInfoList->list.count, "schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n", schedulingInfoList_BR_r13->list.count, schedulingInfoList->list.count); - AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200, + AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200, "si_WindowLength_BR_r13 %d > %d\n", (int) cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13, - SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200); + LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200); // check that SI frequency-hopping is disabled - AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13 == SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off, + AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13 == LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off, "Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n"); long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13]; long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13; - AssertFatal(si_RepetitionPattern_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF, + AssertFatal(si_RepetitionPattern_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF, "si_RepetitionPattern_r13 %d > %d\n", (int) si_RepetitionPattern_r13, - SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF); + LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF); // cycle through SIB list for (i = 0; i < schedulingInfoList_BR_r13->list.count; i++) { @@ -533,7 +533,7 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length); if ((frameP & 1023) < 40) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LOG_D(MAC, "[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n", module_idP, frameP, CC_id, mib_sdu_length, @@ -758,6 +758,9 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) module_idP, CC_id, frameP, 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], @@ -789,7 +792,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) } } } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) schedule_SIB1_BR(module_idP, frameP, subframeP); schedule_SI_BR(module_idP, frameP, subframeP); #endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index d4f7c04d03..9a26460fa3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -47,12 +47,12 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -#include "SIMULATION/TOOLS/sim.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus #include "assertions.h" #if defined(ENABLE_ITTI) -#include "intertask_interface.h" + #include "intertask_interface.h" #endif #include @@ -74,15 +74,12 @@ add_ue_dlsch_info(module_id_t module_idP, //------------------------------------------------------------------------------ { //LOG_D(MAC, "%s(module_idP:%d, CC_id:%d, UE_id:%d, subframeP:%d, status:%d) serving_num:%d rnti:%x\n", __FUNCTION__, module_idP, CC_id, UE_id, subframeP, status, eNB_dlsch_info[module_idP][CC_id][UE_id].serving_num, UE_RNTI(module_idP,UE_id)); - eNB_dlsch_info[module_idP][CC_id][UE_id].rnti = - UE_RNTI(module_idP, UE_id); + UE_RNTI(module_idP, UE_id); // eNB_dlsch_info[module_idP][CC_id][ue_mod_idP].weight = weight; eNB_dlsch_info[module_idP][CC_id][UE_id].subframe = subframeP; eNB_dlsch_info[module_idP][CC_id][UE_id].status = status; - eNB_dlsch_info[module_idP][CC_id][UE_id].serving_num++; - } //------------------------------------------------------------------------------ @@ -91,7 +88,6 @@ schedule_next_dlue(module_id_t module_idP, int CC_id, sub_frame_t subframeP) //------------------------------------------------------------------------------ { - int next_ue; UE_list_t *UE_list = &RC.mac[module_idP]->UE_list; @@ -111,7 +107,6 @@ schedule_next_dlue(module_id_t module_idP, int CC_id, } return (-1); //next_ue; - } //------------------------------------------------------------------------------ @@ -127,11 +122,9 @@ generate_dlsch_header(unsigned char *mac_header, unsigned short post_padding) //------------------------------------------------------------------------------ { - SCH_SUBHEADER_FIXED *mac_header_ptr = (SCH_SUBHEADER_FIXED *) mac_header; uint8_t first_element = 0, last_size = 0, i; uint8_t mac_header_control_elements[16], *ce_ptr; - ce_ptr = &mac_header_control_elements[0]; // compute header components @@ -194,10 +187,10 @@ generate_dlsch_header(unsigned char *mac_header, if (first_element > 0) { mac_header_ptr->E = 1; /* - printf("[eNB][MAC] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); + printf("[eNB][MAC] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); */ mac_header_ptr++; } else { @@ -208,16 +201,15 @@ generate_dlsch_header(unsigned char *mac_header, mac_header_ptr->E = 0; mac_header_ptr->LCID = UE_CONT_RES; last_size = 1; - LOG_T(MAC, "[eNB ][RAPROC] Generate contention resolution msg: %x.%x.%x.%x.%x.%x\n", ue_cont_res_id[0], ue_cont_res_id[1], ue_cont_res_id[2], ue_cont_res_id[3], ue_cont_res_id[4], ue_cont_res_id[5]); - memcpy(ce_ptr, ue_cont_res_id, 6); ce_ptr += 6; // msg("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements); } + //msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr); for (i = 0; i < num_sdus; i++) { @@ -227,9 +219,9 @@ generate_dlsch_header(unsigned char *mac_header, if (first_element > 0) { mac_header_ptr->E = 1; /*msg("last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); */ mac_header_ptr += last_size; //msg("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr); @@ -255,10 +247,10 @@ generate_dlsch_header(unsigned char *mac_header, last_size = 3; #ifdef DEBUG_HEADER_PARSING LOG_D(MAC, - "[eNB] generate long sdu, size %x (MSB %x, LSB %x)\n", - sdu_lengths[i], - ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB, - ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_LSB); + "[eNB] generate long sdu, size %x (MSB %x, LSB %x)\n", + sdu_lengths[i], + ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB, + ((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_LSB); #endif } } @@ -300,10 +292,10 @@ generate_dlsch_header(unsigned char *mac_header, memcpy((void *) mac_header_ptr, mac_header_control_elements, ce_ptr - mac_header_control_elements); mac_header_ptr += - (unsigned char) (ce_ptr - mac_header_control_elements); + (unsigned char) (ce_ptr - mac_header_control_elements); } - //msg("After CEs %d\n",(uint8_t*)mac_header_ptr - mac_header); + //msg("After CEs %d\n",(uint8_t*)mac_header_ptr - mac_header); return ((unsigned char *) mac_header_ptr - mac_header); } @@ -313,11 +305,11 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP, int subframeP) //------------------------------------------------------------------------------ { - eNB_MAC_INST *eNB = RC.mac[module_idP]; UE_list_t *UE_list = &eNB->UE_list; unsigned char DAI; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; + if (cc->tdd_Config != NULL) { //TDD DAI = (UE_list->UE_template[CC_idP][UE_idP].DAI - 1) & 3; LOG_D(MAC, @@ -332,24 +324,25 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP, case 1: switch (subframeP) { - case 0: - case 1: - UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI; - break; + case 0: + case 1: + UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI; + break; - case 4: - UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI; - break; + case 4: + UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI; + break; - case 5: - case 6: - UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI; - break; + case 5: + case 6: + UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI; + break; - case 9: - UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI; - break; + case 9: + UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI; + break; } + break; case 2: @@ -410,7 +403,6 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP, //------------------------------------------------------------------------------ void schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) { - int i = 0; slice_info_t *sli = &RC.mac[module_idP]->slice_info; memset(sli->rballoc_sub, 0, sizeof(sli->rballoc_sub)); @@ -419,7 +411,6 @@ schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, in // Run each enabled slice-specific schedulers one by one sli->dl[i].sched_cb(module_idP, i, frameP, subframeP, mbsfn_flag/*, dl_info*/); } - } // changes to pre-processor for eMTC @@ -445,7 +436,6 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, int harq_pid = 0; eNB_UE_STATS *eNB_UE_stats = NULL; int sdu_length_total = 0; - eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = eNB->common_channels; UE_list_t *UE_list = &eNB->UE_list; @@ -465,63 +455,79 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, int ta_update; int header_length_last; int header_length_total; - + rrc_eNB_ue_context_t *ue_contextP = NULL; start_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN); // for TDD: check that we have to act here, otherwise return if (cc[0].tdd_Config) { tdd_sfa = cc[0].tdd_Config->subframeAssignment; + switch (subframeP) { case 0: // always continue break; + case 1: return; break; + case 2: return; break; + case 3: if ((tdd_sfa != 2) && (tdd_sfa != 5)) return; + break; + case 4: if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4) && (tdd_sfa != 5)) return; + break; + case 5: break; + case 6: case 7: if ((tdd_sfa != 3) && (tdd_sfa != 4) && (tdd_sfa != 5)) return; + break; + case 8: if ((tdd_sfa != 2) && (tdd_sfa != 3) && (tdd_sfa != 4) && (tdd_sfa != 5)) return; + break; + case 9: if (tdd_sfa == 0) return; + break; } } + //weight = get_ue_weight(module_idP,UE_id); aggregation = 2; + for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth); min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id); // get number of PRBs less those used by common channels total_nb_available_rb[CC_id] = N_RB_DL[CC_id]; + for (i = 0; i < N_RB_DL[CC_id]; i++) if (cc[CC_id].vrb_map[i] != 0) total_nb_available_rb[CC_id]--; N_RBG[CC_id] = to_rbg(cc[CC_id].mib->message.dl_Bandwidth); - // store the global enb stats: eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; @@ -533,7 +539,6 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, // CALLING Pre_Processor for downlink scheduling // (Returns estimation of RBs required by each UE and the allocation on sub-band) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_IN); - start_meas(&eNB->schedule_dlsch_preprocessor); dlsch_scheduler_pre_processor(module_idP, slice_idxP, @@ -542,15 +547,14 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, mbsfn_flag, eNB->slice_info.rballoc_sub); stop_meas(&eNB->schedule_dlsch_preprocessor); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_OUT); //RC.mac[module_idP]->slice_info.slice_counter--; // Do the multiplexing and actual allocation only when all slices have been pre-processed. //if (RC.mac[module_idP]->slice_info.slice_counter > 0) { - //stop_meas(&eNB->schedule_dlsch); - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_OUT); - //return; + //stop_meas(&eNB->schedule_dlsch); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_OUT); + //return; //} if (RC.mac[module_idP]->slice_info.interslice_share_active) { @@ -562,7 +566,6 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n", CC_id); - dl_req = &eNB->DL_req[CC_id].dl_config_request_body; if (mbsfn_flag[CC_id] > 0) @@ -602,11 +605,13 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, ue_sched_ctl->dl_cqi[CC_id], format1); break; + case 3: aggregation = get_aggregation(get_bw_index(module_idP, CC_id), ue_sched_ctl->dl_cqi[CC_id], format2A); break; + default: LOG_W(MAC, "Unsupported transmission mode %d\n", get_tmode(module_idP, CC_id, UE_id)); aggregation = 2; @@ -614,13 +619,13 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } /* if (continue_flag != 1 */ - if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated - CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, - aggregation, rnti)) { - LOG_D(MAC, - "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", - module_idP, frameP, UE_id, CC_id); - continue_flag = 1; //to next user (there might be rbs availiable for other UEs in TM5 + if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated + CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, + aggregation, rnti)) { + LOG_D(MAC, + "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", + module_idP, frameP, UE_id, CC_id); + continue_flag = 1; //to next user (there might be rbs availiable for other UEs in TM5 } // If TDD @@ -640,10 +645,8 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; - harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP); - + harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); round = ue_sched_ctl->round[CC_id][harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti; UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; @@ -687,21 +690,20 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, /* process retransmission */ if (round != 8) { - // get freq_allocation nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; TBS = get_TBS_DL(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid], nb_rb); - if (nb_rb <= nb_available_rb) { - if (cc[CC_id].tdd_Config != NULL) { - UE_list->UE_template[CC_id][UE_id].DAI++; - update_ul_dci(module_idP, CC_id, rnti, - UE_list->UE_template[CC_id][UE_id].DAI, subframeP); - LOG_D(MAC, - "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", - CC_id, subframeP, UE_id, - UE_list->UE_template[CC_id][UE_id].DAI); - } + if (nb_rb <= nb_available_rb) { + if (cc[CC_id].tdd_Config != NULL) { + UE_list->UE_template[CC_id][UE_id].DAI++; + update_ul_dci(module_idP, CC_id, rnti, + UE_list->UE_template[CC_id][UE_id].DAI, subframeP); + LOG_D(MAC, + "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", + CC_id, subframeP, UE_id, + UE_list->UE_template[CC_id][UE_id].DAI); + } if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { for (j = 0; j < N_RBG[CC_id]; ++j) { // for indicating the rballoc for each sub-band @@ -715,6 +717,7 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { if (UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]) printf("WARN: rballoc_subband not free for retrans?\n"); + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; if ((j == N_RBG[CC_id] - 1) && ((N_RB_DL[CC_id] == 25) || (N_RB_DL[CC_id] == 50))) { @@ -744,7 +747,6 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, case 7: default: LOG_D(MAC, "retransmission DL_REQ: rnti:%x\n", rnti); - dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; @@ -752,13 +754,12 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = - get_aggregation(get_bw_index(module_idP, CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); + get_aggregation(get_bw_index(module_idP, CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format1); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI: see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // Don't adjust power when retransmitting dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; @@ -768,7 +769,7 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, // TDD if (cc[CC_id].tdd_Config != NULL) { dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = - (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3; + (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3; LOG_D(MAC, "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n", module_idP, CC_id, harq_pid, round, @@ -779,17 +780,15 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n", module_idP, CC_id, harq_pid, round, UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]); + } - } - if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, rnti)) { - dl_req->number_dci++; - dl_req->number_pdu++; - dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; - - eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; - eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; - + if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, rnti)) { + dl_req->number_dci++; + dl_req->number_pdu++; + dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; + eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; + eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; fill_nfapi_dlsch_config(eNB, dl_req, TBS, -1, /* retransmission, no pdu_index */ rnti, 0, // type 0 allocation from 7.1.6 in 36.213 @@ -802,7 +801,7 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme 1, // number of layers 1, // number of subbands - // uint8_t codebook_index, + // uint8_t codebook_index, 4, // UE category capacity UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0, // delta_power_offset for TM5 @@ -811,12 +810,10 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode 0, //number of PRBs treated as one subband, not used here 0 // number of beamforming vectors, not used here - ); - + ); LOG_D(MAC, "Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n", eNB->pdu_index[CC_id], round); - program_dlsch_acknak(module_idP, CC_id, UE_id, frameP, subframeP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); // No TX request for retransmission (check if null request for FAPI) @@ -828,32 +825,32 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } add_ue_dlsch_info(module_idP, CC_id, UE_id, subframeP, S_DL_SCHEDULED); + //eNB_UE_stats->dlsch_trials[round]++; + UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = eNB_UE_stats->dlsch_mcs1; + } else { + LOG_D(MAC, + "[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", + module_idP, frameP, CC_id, UE_id); + } + } else { /* This is a potentially new SDU opportunity */ + rlc_status.bytes_in_buffer = 0; + // Now check RLC information to compute number of required RBs + // get maximum TBS size for RLC request + TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); - //eNB_UE_stats->dlsch_trials[round]++; - UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = eNB_UE_stats->dlsch_mcs1; - } else { - LOG_D(MAC, - "[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", - module_idP, frameP, CC_id, UE_id); - } - } else { /* This is a potentially new SDU opportunity */ - rlc_status.bytes_in_buffer = 0; - - // Now check RLC information to compute number of required RBs - // get maximum TBS size for RLC request - TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); - - // add the length for all the control elements (timing adv, drx, etc) : header + payload + // add the length for all the control elements (timing adv, drx, etc) : header + payload if (ue_sched_ctl->ta_timer == 0) { ta_update = ue_sched_ctl->ta_update; + /* if we send TA then set timer to not send it for a while */ if (ta_update != 31) ue_sched_ctl->ta_timer = 20; + /* reset ta_update */ ue_sched_ctl->ta_update = 31; } else { @@ -862,44 +859,43 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, ta_len = (ta_update != 31) ? 2 : 0; - // RLC data on DCCH - if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { - rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, + // RLC data on DCCH + if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { + rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS - ta_len - header_length_total - sdu_length_total - 3 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); - + ); sdu_lengths[0] = 0; - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - module_idP, frameP, subframeP, CC_id, - TBS - ta_len - header_length_total - sdu_length_total - 3); - - sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + module_idP, frameP, subframeP, CC_id, + TBS - ta_len - header_length_total - sdu_length_total - 3); + sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used - (char *)&dlsch_buffer[0] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 + (char *)&dlsch_buffer[0] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); - + ); pthread_mutex_lock(&rrc_release_freelist); - if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){ + + if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) { uint16_t release_total = 0; - for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){ + + for(uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0) { release_total++; - }else{ + } else { continue; } - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){ - if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){ + if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1) { + if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]) { rrc_release_info.RRC_release_ctrl[release_num].flag = 3; LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 1->3\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num); break; @@ -907,10 +903,11 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } } } - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){ - if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){ + + if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2) { + if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]) { rrc_release_info.RRC_release_ctrl[release_num].flag = 4; LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num); break; @@ -918,17 +915,19 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } } } + if(release_total >= rrc_release_info.num_UEs) break; } } - pthread_mutex_unlock(&rrc_release_freelist); + pthread_mutex_unlock(&rrc_release_freelist); RA_t *ra = &eNB->common_channels[CC_id].ra[0]; + for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) { - if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]){ + if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]) { ra[ra_ii].crnti_harq_pid = harq_pid; ra[ra_ii].state = MSGCRNTI_ACK; break; @@ -941,26 +940,21 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH), T_INT(sdu_lengths[0])); - - LOG_D(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n", - module_idP, CC_id, sdu_lengths[0]); - - sdu_length_total = sdu_lengths[0]; - sdu_lcids[0] = DCCH; + LOG_D(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n", + module_idP, CC_id, sdu_lengths[0]); + sdu_length_total = sdu_lengths[0]; + sdu_lcids[0] = DCCH; UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[0] = DCCH; UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH] = sdu_lengths[0]; - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[0]; - + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[0]; header_length_last = 1 + 1 + (sdu_lengths[0] >= 128); header_length_total += header_length_last; - - num_sdus = 1; - + num_sdus = 1; #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC, - "[eNB %d][DCCH] CC_id %d Got %d bytes :", - module_idP, CC_id, sdu_lengths[0]); + "[eNB %d][DCCH] CC_id %d Got %d bytes :", + module_idP, CC_id, sdu_lengths[0]); for (j = 0; j < sdu_lengths[0]; ++j) { LOG_T(MAC, "%x ", dlsch_buffer[j]); @@ -968,55 +962,48 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, LOG_T(MAC, "\n"); #endif - } - } + } + } - // RLC data on DCCH1 - if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { - rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, + // RLC data on DCCH1 + if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { + rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, TBS - ta_len - header_length_total - sdu_length_total - 3 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif ); + // DCCH SDU + sdu_lengths[num_sdus] = 0; - // DCCH SDU - sdu_lengths[num_sdus] = 0; - - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - module_idP, frameP, CC_id, - TBS - ta_len - header_length_total - sdu_length_total - 3); - - sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, - TBS, //not used - (char *)&dlsch_buffer[sdu_length_total] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + module_idP, frameP, CC_id, + TBS - ta_len - header_length_total - sdu_length_total - 3); + sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, + TBS, //not used + (char *)&dlsch_buffer[sdu_length_total] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); - + ); T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH + 1), T_INT(sdu_lengths[num_sdus])); - - sdu_lcids[num_sdus] = DCCH1; - sdu_length_total += sdu_lengths[num_sdus]; + sdu_lcids[num_sdus] = DCCH1; + sdu_length_total += sdu_lengths[num_sdus]; UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = DCCH1; UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH1] = sdu_lengths[num_sdus]; - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] += sdu_lengths[num_sdus]; - + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] += sdu_lengths[num_sdus]; header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128); header_length_total += header_length_last; - - num_sdus++; - + num_sdus++; #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC, - "[eNB %d][DCCH1] CC_id %d Got %d bytes :", - module_idP, CC_id, sdu_lengths[num_sdus]); + "[eNB %d][DCCH1] CC_id %d Got %d bytes :", + module_idP, CC_id, sdu_lengths[num_sdus]); for (j = 0; j < sdu_lengths[num_sdus]; ++j) { LOG_T(MAC, "%x ", dlsch_buffer[j]); @@ -1024,79 +1011,92 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, LOG_T(MAC, "\n"); #endif + } + } - } - } - - // TODO: lcid has to be sorted before the actual allocation (similar struct as ue_list). - for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) { - // TODO: check if the lcid is active - - LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n", - module_idP, frameP, lcid, TBS, + // TODO: lcid has to be sorted before the actual allocation (similar struct as ue_list). + for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) { + // TODO: check if the lcid is active + LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n", + module_idP, + frameP, + lcid, + TBS, TBS - ta_len - header_length_total - sdu_length_total - 3); - if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { - rlc_status = mac_rlc_status_ind(module_idP, - rnti, - module_idP, - frameP, - subframeP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - TBS - ta_len - header_length_total - sdu_length_total - 3 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 + if (TBS - ta_len - header_length_total - sdu_length_total - 3 > 0) { + rlc_status = mac_rlc_status_ind(module_idP, + rnti, + module_idP, + frameP, + subframeP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + TBS - ta_len - header_length_total - sdu_length_total - 3 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + , 0, 0 #endif ); - - - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, - "[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n", - module_idP, frameP, + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, "[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n", + module_idP, + frameP, TBS - ta_len - header_length_total - sdu_length_total - 3, - lcid, - header_length_total); - - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, - TBS, //not used - (char *)&dlsch_buffer[sdu_length_total] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0, 0 + lcid, + header_length_total); + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + rnti, + module_idP, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + TBS, //not used + (char *)&dlsch_buffer[sdu_length_total] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + , 0, 0 #endif - ); - - T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), - T_INT(CC_id), T_INT(rnti), T_INT(frameP), - T_INT(subframeP), T_INT(harq_pid), - T_INT(lcid), T_INT(sdu_lengths[num_sdus])); - - LOG_D(MAC, - "[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", - module_idP, sdu_lengths[num_sdus], lcid); - - sdu_lcids[num_sdus] = lcid; - sdu_length_total += sdu_lengths[num_sdus]; - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++; + ); + T(T_ENB_MAC_UE_DL_SDU, + T_INT(module_idP), + T_INT(CC_id), + T_INT(rnti), + T_INT(frameP), + T_INT(subframeP), + T_INT(harq_pid), + T_INT(lcid), + T_INT(sdu_lengths[num_sdus])); + LOG_D(MAC, "[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", + module_idP, + sdu_lengths[num_sdus], + lcid); + sdu_lcids[num_sdus] = lcid; + sdu_length_total += sdu_lengths[num_sdus]; + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]++; UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid; UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus]; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus]; - + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus]; header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128); header_length_total += header_length_last; - - num_sdus++; - - UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; - } - } else { - // no TBS left - break; - } - } + num_sdus++; + UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; + // reset RRC inactivity timer after uplane activity + ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti); + if (ue_contextP != NULL) { + ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + } else { + LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", + module_idP, + CC_id, + rnti); + } + } // end if (rlc_status.bytes_in_buffer > 0) + } else { // no TBS left + break; // break for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) + } + } /* last header does not have length field */ if (header_length_total) { @@ -1104,13 +1104,11 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, header_length_total++; } - // there is at least one SDU or TA command - // if (num_sdus > 0 ){ - if (ta_len + sdu_length_total + header_length_total > 0) { - - // Now compute number of required RBs for total sdu length - // Assume RAH format 2 - + // there is at least one SDU or TA command + // if (num_sdus > 0 ){ + if (ta_len + sdu_length_total + header_length_total > 0) { + // Now compute number of required RBs for total sdu length + // Assume RAH format 2 mcs = eNB_UE_stats->dlsch_mcs1; if (mcs == 0) { @@ -1118,17 +1116,18 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } else { nb_rb = min_rb_unit[CC_id]; } + TBS = get_TBS_DL(mcs, nb_rb); - while (TBS < sdu_length_total + header_length_total + ta_len) { - nb_rb += min_rb_unit[CC_id]; // + while (TBS < sdu_length_total + header_length_total + ta_len) { + nb_rb += min_rb_unit[CC_id]; // - if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs - // (can happen if N_RB_DL is odd) - TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); - nb_rb = nb_available_rb; - break; - } + if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs + // (can happen if N_RB_DL is odd) + TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); + nb_rb = nb_available_rb; + break; + } TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_rb); } @@ -1156,41 +1155,40 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, } } - // decrease mcs until TBS falls below required length - while ((TBS > sdu_length_total + header_length_total + ta_len) && (mcs > 0)) { - mcs--; - TBS = get_TBS_DL(mcs, nb_rb); - } + // decrease mcs until TBS falls below required length + while ((TBS > sdu_length_total + header_length_total + ta_len) && (mcs > 0)) { + mcs--; + TBS = get_TBS_DL(mcs, nb_rb); + } - // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < sdu_length_total + header_length_total + ta_len) - && (((ue_sched_ctl->dl_pow_off[CC_id] > 0) - && (mcs < 28)) - || ((ue_sched_ctl->dl_pow_off[CC_id] == 0) - && (mcs <= 15)))) { - mcs++; - TBS = get_TBS_DL(mcs, nb_rb); - } + // if we have decreased too much or we don't have enough RBs, increase MCS + while ((TBS < sdu_length_total + header_length_total + ta_len) + && (((ue_sched_ctl->dl_pow_off[CC_id] > 0) + && (mcs < 28)) + || ((ue_sched_ctl->dl_pow_off[CC_id] == 0) + && (mcs <= 15)))) { + mcs++; + TBS = get_TBS_DL(mcs, nb_rb); + } LOG_D(MAC, "dlsch_mcs before and after the rate matching = (%d, %d)\n", eNB_UE_stats->dlsch_mcs1, mcs); - #ifdef DEBUG_eNB_SCHEDULER LOG_D(MAC, - "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n", - module_idP, CC_id, mcs, TBS, nb_rb); + "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n", + module_idP, CC_id, mcs, TBS, nb_rb); // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n", // TBS, sdu_length_total, offset, TBS-sdu_length_total-offset); #endif - if (TBS - header_length_total - sdu_length_total - ta_len <= 2) { - padding = TBS - header_length_total - sdu_length_total - ta_len; - post_padding = 0; - } else { - padding = 0; - post_padding = 1; - } + if (TBS - header_length_total - sdu_length_total - ta_len <= 2) { + padding = TBS - header_length_total - sdu_length_total - ta_len; + post_padding = 0; + } else { + padding = 0; + post_padding = 1; + } offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus @@ -1200,17 +1198,18 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, NULL, // contention res id padding, post_padding); - //#ifdef DEBUG_eNB_SCHEDULER - if (ta_update != 31) { - LOG_D(MAC, - "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_length %d\n", - module_idP, frameP, UE_id, CC_id, - sdu_length_total, num_sdus, sdu_lengths[0], - sdu_lcids[0], offset, ta_update, padding, - post_padding, mcs, TBS, nb_rb, - header_length_total); - } - //#endif + //#ifdef DEBUG_eNB_SCHEDULER + if (ta_update != 31) { + LOG_D(MAC, + "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_length %d\n", + module_idP, frameP, UE_id, CC_id, + sdu_length_total, num_sdus, sdu_lengths[0], + sdu_lcids[0], offset, ta_update, padding, + post_padding, mcs, TBS, nb_rb, + header_length_total); + } + + //#endif #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n"); @@ -1220,98 +1219,91 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, LOG_T(MAC, "\n"); #endif - // cycle through SDUs and place in dlsch_buffer memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total); // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); - // fill remainder of DLSCH with 0 - for (j = 0; j < (TBS - sdu_length_total - offset); j++) { - UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0; - } + // fill remainder of DLSCH with 0 + for (j = 0; j < (TBS - sdu_length_total - offset); j++) { + UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0; + } - 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_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); - } - - 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)); + 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_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); + } + 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; - add_ue_dlsch_info(module_idP, CC_id, UE_id, subframeP, S_DL_SCHEDULED); // store stats eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total; eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1; - - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].num_mac_sdu_tx = num_sdus; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = mcs; - UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = mcs; + UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes = TBS - sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes += sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes += TBS; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus += 1; - if (cc[CC_id].tdd_Config != NULL) { // TDD - UE_list->UE_template[CC_id][UE_id].DAI++; - update_ul_dci(module_idP, CC_id, rnti, - UE_list->UE_template[CC_id][UE_id].DAI, + if (cc[CC_id].tdd_Config != NULL) { // TDD + UE_list->UE_template[CC_id][UE_id].DAI++; + update_ul_dci(module_idP, CC_id, rnti, + UE_list->UE_template[CC_id][UE_id].DAI, subframeP); - } + } - // do PUCCH power control - // this is the normalized RX power - eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; + // do PUCCH power control + // this is the normalized RX power + eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; + /* unit is not dBm, it's special from nfapi */ + // converting to dBm: ToDo: Noise power hard coded to 30 + normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30; + target_rx_power= eNB->puCch10xSnr/10 + 30; + // 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_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; - /* unit is not dBm, it's special from nfapi */ - // converting to dBm: ToDo: Noise power hard coded to 30 - normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30; - target_rx_power= eNB->puCch10xSnr/10 + 30; - // 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_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; - if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || //normal case - ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) //frame wrap-around - if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { - ue_sched_ctl->pucch1_cqi_update[CC_id] = 0; + if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || //normal case + ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) //frame wrap-around + if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { + ue_sched_ctl->pucch1_cqi_update[CC_id] = 0; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP; + if (normalized_rx_power > (target_rx_power + 4)) { + tpc = 0; //-1 + } else if (normalized_rx_power < (target_rx_power - 4)) { + tpc = 2; //+1 + } else { + tpc = 1; //0 + } - if (normalized_rx_power > (target_rx_power + 4)) { - tpc = 0; //-1 - } else if (normalized_rx_power < (target_rx_power - 4)) { - tpc = 2; //+1 - } else { - tpc = 1; //0 - } - - LOG_D(MAC, - "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n", - module_idP, frameP, subframeP, harq_pid, tpc, - normalized_rx_power, target_rx_power); - - } // Po_PUCCH has been updated - else { - tpc = 1; //0 - } // time to do TPC update - else { - tpc = 1; //0 - } + LOG_D(MAC, + "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n", + module_idP, frameP, subframeP, harq_pid, tpc, + normalized_rx_power, target_rx_power); + } // Po_PUCCH has been updated + else { + tpc = 1; //0 + } // time to do TPC update + else { + tpc = 1; //0 + } dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); @@ -1319,16 +1311,15 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu)); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = - get_aggregation(get_bw_index(module_idP, CC_id), ue_sched_ctl->dl_cqi[CC_id], format1); + get_aggregation(get_bw_index(module_idP, CC_id), ue_sched_ctl->dl_cqi[CC_id], format1); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc; // dont adjust power when retransmitting dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = - 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; //deactivate second codeword @@ -1337,7 +1328,7 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, if (cc[CC_id].tdd_Config != NULL) { //TDD dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = - (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3; + (UE_list->UE_template[CC_id][UE_id].DAI - 1) & 3; LOG_D(MAC, "[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n", module_idP, CC_id, harq_pid, @@ -1347,115 +1338,102 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, LOG_D(MAC, "[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n", module_idP, CC_id, harq_pid, mcs); + } - } - - LOG_D(MAC, "Checking feasibility pdu %d (new sdu)\n", - dl_req->number_pdu); - - if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.aggregation_level, rnti)) { - ue_sched_ctl->round[CC_id][harq_pid] = 0; - dl_req->number_dci++; - dl_req->number_pdu++; - dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; + LOG_D(MAC, "Checking feasibility pdu %d (new sdu)\n", + dl_req->number_pdu); + if (!CCE_allocation_infeasible(module_idP, CC_id, 1, subframeP, + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.aggregation_level, rnti)) { + ue_sched_ctl->round[CC_id][harq_pid] = 0; + dl_req->number_dci++; + dl_req->number_pdu++; + dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; eNB->DL_req[CC_id].sfn_sf = frameP << 4 | subframeP; eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; - // Toggle NDI for next time LOG_D(MAC, "CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frameP, subframeP, UE_id, rnti, harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs; - UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0; - AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, - "physicalConfigDedicated is NULL\n"); - AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated != NULL, - "physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); - - fill_nfapi_dlsch_config(eNB, dl_req, TBS, eNB->pdu_index[CC_id], rnti, 0, // type 0 allocation from 7.1.6 in 36.213 - 0, // virtual_resource_block_assignment_flag, unused here - 0, // resource_block_coding, to be filled in later - getQm(mcs), 0, // redundancy version - 1, // transport blocks - 0, // transport block to codeword swap flag - cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme - 1, // number of layers - 1, // number of subbands - // uint8_t codebook_index, - 4, // UE category capacity - UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0, // delta_power_offset for TM5 - 0, // ngap - 0, // nprb - cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode - 0, //number of PRBs treated as one subband, not used here - 0 // number of beamforming vectors, not used here - ); - eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body, - (frameP * 10) + subframeP, - TBS, eNB->pdu_index[CC_id], - eNB->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0]); - - LOG_D(MAC, - "Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n", - eNB->pdu_index[CC_id]); - - eNB->pdu_index[CC_id]++; - program_dlsch_acknak(module_idP, CC_id, UE_id, - frameP, subframeP, - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); - } else { - LOG_W(MAC, - "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", - frameP, subframeP, UE_id, rnti); - } - } else { // There is no data from RLC or MAC header, so don't schedule - - } + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs; + UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0; + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, + "physicalConfigDedicated is NULL\n"); + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated != NULL, + "physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); + fill_nfapi_dlsch_config(eNB, dl_req, TBS, eNB->pdu_index[CC_id], rnti, 0, // type 0 allocation from 7.1.6 in 36.213 + 0, // virtual_resource_block_assignment_flag, unused here + 0, // resource_block_coding, to be filled in later + getQm(mcs), 0, // redundancy version + 1, // transport blocks + 0, // transport block to codeword swap flag + cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme + 1, // number of layers + 1, // number of subbands + // uint8_t codebook_index, + 4, // UE category capacity + UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0, // delta_power_offset for TM5 + 0, // ngap + 0, // nprb + cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode + 0, //number of PRBs treated as one subband, not used here + 0 // number of beamforming vectors, not used here + ); + eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body, + (frameP * 10) + subframeP, + TBS, eNB->pdu_index[CC_id], + eNB->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0]); + LOG_D(MAC, + "Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n", + eNB->pdu_index[CC_id]); + eNB->pdu_index[CC_id]++; + program_dlsch_acknak(module_idP, CC_id, UE_id, + frameP, subframeP, + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); + } else { + LOG_W(MAC, + "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", + frameP, subframeP, UE_id, rnti); + } + } else { // There is no data from RLC or MAC header, so don't schedule + } } if (cc[CC_id].tdd_Config != NULL) { // TDD set_ul_DAI(module_idP, UE_id, CC_id, frameP, subframeP); } - } // UE_id loop - } // CC_id loop + } // UE_id loop + } // CC_id loop fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_flag); - stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_OUT); } //------------------------------------------------------------------------------ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, - int frameP, - sub_frame_t subframeP, - uint8_t rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX]) + int frameP, + sub_frame_t subframeP, + uint8_t rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX]) //------------------------------------------------------------------------------ { // FIXME: I'm prototyping the algorithm, so there may be arrays and variables that carry redundant information here and in pre_processor_results struct. - int UE_id, CC_id, rbg, i; int N_RB_DL, min_rb_unit, tm; int owned, used; - UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; slice_info_t *sli = &RC.mac[Mod_id]->slice_info; UE_sched_ctrl *ue_sched_ctl; COMMON_channels_t *cc; int N_RBG[NFAPI_CC_MAX]; - int slice_sorted_list[MAX_NUM_SLICES]; int slice_idx; int8_t free_rbgs_map[NFAPI_CC_MAX][N_RBG_MAX]; int has_traffic[NFAPI_CC_MAX][MAX_NUM_SLICES]; uint8_t allocation_mask[NFAPI_CC_MAX][N_RBG_MAX]; - uint16_t (*nb_rbs_remaining)[MAX_MOBILES_PER_ENB]; uint16_t (*nb_rbs_required)[MAX_MOBILES_PER_ENB]; uint8_t (*MIMO_mode_indicator)[N_RBG_MAX]; @@ -1468,9 +1446,11 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; ++CC_id) { cc = &RC.mac[Mod_id]->common_channels[CC_id]; N_RBG[CC_id] = to_rbg(cc->mib->message.dl_Bandwidth); + for (rbg = 0; rbg < N_RBG[CC_id]; ++rbg) { for (i = 0; i < sli->n_dl; ++i) { owned = sli->pre_processor_results[i].slice_allocation_mask[CC_id][rbg]; + if (owned) { used = rballoc_sub[CC_id][rbg]; free_rbgs_map[CC_id][rbg] = used ? -1 : i; @@ -1485,6 +1465,7 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; ++CC_id) { for (i = 0; i < sli->n_dl; ++i) { has_traffic[CC_id][i] = 0; + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; ++UE_id) { if (sli->pre_processor_results[i].nb_rbs_remaining[CC_id][UE_id] > 0) { has_traffic[CC_id][i] = 1; @@ -1499,7 +1480,6 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, // MULTIPLEXING // This part is an adaptation of dlsch_scheduler_pre_processor_allocate() code for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; ++CC_id) { - N_RB_DL = to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth); min_rb_unit = get_min_rb_unit(Mod_id, CC_id); @@ -1515,11 +1495,13 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, allocation_mask[CC_id][rbg] = 0; continue; } + if (sli->dl[free_rbgs_map[CC_id][rbg]].isol == 1) { // RBG belongs to an isolated slice allocation_mask[CC_id][rbg] = 0; continue; } + // RBG is free allocation_mask[CC_id][rbg] = 1; } @@ -1528,7 +1510,6 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, // (UE list gets sorted every time pre_processor is called so it is probably dirty at this point) // FIXME: There is only one UE_list for all slices, so it must be sorted again each time we use it sort_UEs(Mod_id, slice_idx, frameP, subframeP); - nb_rbs_remaining = sli->pre_processor_results[slice_idx].nb_rbs_remaining; nb_rbs_required = sli->pre_processor_results[slice_idx].nb_rbs_required; MIMO_mode_indicator = sli->pre_processor_results[slice_idx].MIMO_mode_indicator; @@ -1539,13 +1520,17 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, tm = get_tmode(Mod_id, CC_id, UE_id); for (rbg = 0; rbg < N_RBG[CC_id]; ++rbg) { - // FIXME: I think that some of these checks are redundant if (allocation_mask[CC_id][rbg] == 0) continue; + if (rballoc_sub[CC_id][rbg] != 0) continue; + if (ue_sched_ctl->rballoc_sub_UE[CC_id][rbg] != 0) continue; + if (nb_rbs_remaining[CC_id][UE_id] <= 0) continue; + if (ue_sched_ctl->pre_nb_available_rbs[CC_id] >= nb_rbs_required[CC_id][UE_id]) continue; + if (ue_sched_ctl->dl_pow_off[CC_id] == 0) continue; if ((rbg == N_RBG[CC_id] - 1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) { @@ -1555,9 +1540,11 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, free_rbgs_map[CC_id][rbg] = -1; ue_sched_ctl->rballoc_sub_UE[CC_id][rbg] = 1; MIMO_mode_indicator[CC_id][rbg] = 1; + if (tm == 5) { ue_sched_ctl->dl_pow_off[CC_id] = 1; } + nb_rbs_remaining[CC_id][UE_id] = nb_rbs_remaining[CC_id][UE_id] - min_rb_unit + 1; ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit - 1; } @@ -1568,9 +1555,11 @@ void dlsch_scheduler_interslice_multiplexing(module_id_t Mod_id, free_rbgs_map[CC_id][rbg] = -1; ue_sched_ctl->rballoc_sub_UE[CC_id][rbg] = 1; MIMO_mode_indicator[CC_id][rbg] = 1; + if (tm == 5) { ue_sched_ctl->dl_pow_off[CC_id] = 1; } + nb_rbs_remaining[CC_id][UE_id] = nb_rbs_remaining[CC_id][UE_id] - min_rb_unit; ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit; } @@ -1592,14 +1581,12 @@ void dlsch_scheduler_qos_multiplexing(module_id_t Mod_id, int frameP, sub_frame_ for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; ++CC_id) { for (i = 0; i < sli->n_dl; ++i) { - // Sort UE again // FIXME: There is only one UE_list for all slices, so it must be sorted again each time we use it sort_UEs(Mod_id, (uint8_t)i, frameP, subframeP); for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { //ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - // TODO: Do something here // ue_sched_ctl->pre_nb_available_rbs[CC_id]; } @@ -1614,7 +1601,6 @@ fill_DLSCH_dci(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, int *mbsfn_flagP) //------------------------------------------------------------------------------ { - // loop over all allocated UEs and compute frequency allocations for PDSCH int UE_id = -1; uint8_t /* first_rb, */ nb_rb = 3; @@ -1622,7 +1608,6 @@ fill_DLSCH_dci(module_id_t module_idP, //unsigned char *vrb_map; uint8_t rballoc_sub[25]; //uint8_t number_of_subbands=13; - //unsigned char round; unsigned char harq_pid; int i; @@ -1632,7 +1617,6 @@ fill_DLSCH_dci(module_id_t module_idP, int N_RBG; int N_RB_DL; COMMON_channels_t *cc; - start_meas(&eNB->fill_DLSCH_dci); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI, VCD_FUNCTION_IN); @@ -1654,11 +1638,10 @@ fill_DLSCH_dci(module_id_t module_idP, eNB_dlsch_info[module_idP][CC_id][UE_id].status); if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) { - // clear scheduling flag eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING; rnti = UE_RNTI(module_idP, UE_id); - harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP); + harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; /// Synchronizing rballoc with rballoc_sub @@ -1673,22 +1656,22 @@ fill_DLSCH_dci(module_id_t module_idP, i < DL_req[CC_id].dl_config_request_body.number_pdu; i++) { dl_config_pdu = &DL_req[CC_id].dl_config_request_body.dl_config_pdu_list[i]; + if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) && (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti) && (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1)) { dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, - rballoc_sub); + rballoc_sub); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0; } else if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) && (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti) && (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type == 0)) { dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, - rballoc_sub); + rballoc_sub); } } } } - } stop_meas(&eNB->fill_DLSCH_dci); @@ -1701,20 +1684,17 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, uint8_t TBindex) //------------------------------------------------------------------------------ { - int UE_id; eNB_MAC_INST *eNB = RC.mac[module_idP]; if (rntiP == SI_RNTI) { LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n", module_idP, CC_id, frameP); - return ((unsigned char *) &eNB->common_channels[CC_id].BCCH_pdu.payload[0]); } if (rntiP == P_RNTI) { LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Get PCH sdu for PCCH \n", module_idP, CC_id, frameP); - return ((unsigned char *) &eNB->common_channels[CC_id].PCCH_pdu.payload[0]); } @@ -1731,34 +1711,29 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, module_idP, frameP, CC_id, rntiP); return NULL; } - } //------------------------------------------------------------------------------ void update_ul_dci(module_id_t module_idP, - uint8_t CC_idP, rnti_t rntiP, uint8_t daiP, sub_frame_t subframe) + uint8_t CC_idP, rnti_t rntiP, uint8_t daiP, sub_frame_t subframe) //------------------------------------------------------------------------------ { - nfapi_hi_dci0_request_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframe]; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = - &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0]; + &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0]; COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_idP]; int i; - - if (cc->tdd_Config != NULL) { // TDD + if (cc->tdd_Config != NULL) { // TDD for (i = 0; - i hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_hi; - i++) { - + i hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_hi; + i++) { if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) && (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP)) hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index = (daiP - 1) & 3; - } } } @@ -1864,7 +1839,6 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) uint8_t Lcrbs = 0; uint16_t rb_bit = 168; /* RB bit number value is unsure */ #endif - start_meas(&eNB->schedule_pch); for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { @@ -1872,10 +1846,12 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) vrb_map = (void *) &cc->vrb_map; n_rb_dl = to_prb(cc->mib->message.dl_Bandwidth); dl_req = &eNB->DL_req[CC_id].dl_config_request_body; + for (uint16_t i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_PF_PO[CC_id][i].enable_flag != TRUE) { continue; } + if (frameP % UE_PF_PO[CC_id][i].T == UE_PF_PO[CC_id][i].PF_min && subframeP == UE_PF_PO[CC_id][i].PO) { pcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, @@ -1883,140 +1859,166 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) PCCH, 1, &cc->PCCH_pdu.payload[0], i); // used for ue index + if (pcch_sdu_length == 0) { LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH not active(size = 0 byte)\n", module_idP, frameP, subframeP); continue; } + LOG_D(MAC, "[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n", module_idP, frameP, subframeP, CC_id, i, pcch_sdu_length); #ifdef FORMAT1C - //NO SIB - if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || - (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { - switch (n_rb_dl) { - case 25: - n_gap = GAP_MAP[3][0]; /* expect: 12 */ - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */ - first_rb = 10; - break; - case 50: - n_gap = GAP_MAP[6][gap_index]; /* expect: 27 or 9 */ - if (gap_index > 0) { - n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* 36 */ - } else { - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 46 */ - } - first_rb = 24; - break; - case 100: - n_gap = GAP_MAP[8][gap_index]; /* expect: 48 or 16 */ - if (gap_index > 0) { - n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* expect: 96 */ - } else { - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 96 */ - } - first_rb = 48; - break; - } - } else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging - switch (n_rb_dl) { - case 25: - n_gap = GAP_MAP[3][0]; /* expect: 12 */ - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */ - first_rb = 14; - break; - case 50: - n_gap = GAP_MAP[6][gap_index]; /* expect: 27 or 9 */ - if (gap_index > 0) { - n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* 36 */ - } else { - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 46 */ - } - first_rb = 28; - break; - case 100: - n_gap = GAP_MAP[8][gap_index]; /* expect: 48 or 16 */ - if (gap_index > 0) { - n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* expect: 96 */ - } else { - n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 96 */ - } - first_rb = 52; - break; - } - } - /* Get MCS for length of PCH */ - if (pcch_sdu_length <= TBStable1C[0]) { - mcs=0; - } else if (pcch_sdu_length <= TBStable1C[1]) { - mcs=1; - } else if (pcch_sdu_length <= TBStable1C[2]) { - mcs=2; - } else if (pcch_sdu_length <= TBStable1C[3]) { - mcs=3; - } else if (pcch_sdu_length <= TBStable1C[4]) { - mcs=4; - } else if (pcch_sdu_length <= TBStable1C[5]) { - mcs=5; - } else if (pcch_sdu_length <= TBStable1C[6]) { - mcs=6; - } else if (pcch_sdu_length <= TBStable1C[7]) { - mcs=7; - } else if (pcch_sdu_length <= TBStable1C[8]) { - mcs=8; - } else if (pcch_sdu_length <= TBStable1C[9]) { - mcs=9; - } else { - /* unexpected: pcch sdb size is over max value*/ - LOG_E(MAC,"[eNB %d] Frame %d : PCCH->PCH CC_id %d, Received %d bytes is over max length(256) \n", - module_idP, frameP,CC_id, pcch_sdu_length); - return; - } - rb_num = TBStable1C[mcs] / rb_bit + ( (TBStable1C[mcs] % rb_bit == 0)? 0: 1) + 1; - /* calculate N_RB_STEP and Lcrbs */ - if (n_rb_dl < 50) { - n_rb_step = 2; - Lcrbs = rb_num / 2 + ((rb_num % 2 == 0) ? 0:2); - } else { - n_rb_step = 4; - Lcrbs = rb_num / 4 + ((rb_num % 4 == 0) ? 0:4); - } - for(i = 0;i < Lcrbs ;i++){ - vrb_map[first_rb+i] = 1; - } + + //NO SIB + if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || + (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { + switch (n_rb_dl) { + case 25: + n_gap = GAP_MAP[3][0]; /* expect: 12 */ + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */ + first_rb = 10; + break; + + case 50: + n_gap = GAP_MAP[6][gap_index]; /* expect: 27 or 9 */ + + if (gap_index > 0) { + n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* 36 */ + } else { + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 46 */ + } + + first_rb = 24; + break; + + case 100: + n_gap = GAP_MAP[8][gap_index]; /* expect: 48 or 16 */ + + if (gap_index > 0) { + n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* expect: 96 */ + } else { + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 96 */ + } + + first_rb = 48; + break; + } + } else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging + switch (n_rb_dl) { + case 25: + n_gap = GAP_MAP[3][0]; /* expect: 12 */ + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */ + first_rb = 14; + break; + + case 50: + n_gap = GAP_MAP[6][gap_index]; /* expect: 27 or 9 */ + + if (gap_index > 0) { + n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* 36 */ + } else { + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 46 */ + } + + first_rb = 28; + break; + + case 100: + n_gap = GAP_MAP[8][gap_index]; /* expect: 48 or 16 */ + + if (gap_index > 0) { + n_vrb_dl = (n_rb_dl / (2*n_gap)) * (2*n_gap); /* expect: 96 */ + } else { + n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 96 */ + } + + first_rb = 52; + break; + } + } + + /* Get MCS for length of PCH */ + if (pcch_sdu_length <= TBStable1C[0]) { + mcs=0; + } else if (pcch_sdu_length <= TBStable1C[1]) { + mcs=1; + } else if (pcch_sdu_length <= TBStable1C[2]) { + mcs=2; + } else if (pcch_sdu_length <= TBStable1C[3]) { + mcs=3; + } else if (pcch_sdu_length <= TBStable1C[4]) { + mcs=4; + } else if (pcch_sdu_length <= TBStable1C[5]) { + mcs=5; + } else if (pcch_sdu_length <= TBStable1C[6]) { + mcs=6; + } else if (pcch_sdu_length <= TBStable1C[7]) { + mcs=7; + } else if (pcch_sdu_length <= TBStable1C[8]) { + mcs=8; + } else if (pcch_sdu_length <= TBStable1C[9]) { + mcs=9; + } else { + /* unexpected: pcch sdb size is over max value*/ + LOG_E(MAC,"[eNB %d] Frame %d : PCCH->PCH CC_id %d, Received %d bytes is over max length(256) \n", + module_idP, frameP,CC_id, pcch_sdu_length); + return; + } + + rb_num = TBStable1C[mcs] / rb_bit + ( (TBStable1C[mcs] % rb_bit == 0)? 0: 1) + 1; + + /* calculate N_RB_STEP and Lcrbs */ + if (n_rb_dl < 50) { + n_rb_step = 2; + Lcrbs = rb_num / 2 + ((rb_num % 2 == 0) ? 0:2); + } else { + n_rb_step = 4; + Lcrbs = rb_num / 4 + ((rb_num % 4 == 0) ? 0:4); + } + + for(i = 0; i < Lcrbs ; i++) { + vrb_map[first_rb+i] = 1; + } + #else - //NO SIB - if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || - (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { - switch (n_rb_dl) { - case 25: - first_rb = 10; - break; - case 50: - first_rb = 24; - break; - case 100: - first_rb = 48; - break; - } - } else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging - switch (n_rb_dl) { - case 25: - first_rb = 14; - break; - case 50: - first_rb = 28; - break; - case 100: - first_rb = 52; - break; - } - } + + //NO SIB + if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || + (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { + switch (n_rb_dl) { + case 25: + first_rb = 10; + break; + + case 50: + first_rb = 24; + break; + + case 100: + first_rb = 48; + break; + } + } else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging + switch (n_rb_dl) { + case 25: + first_rb = 14; + break; + + case 50: + first_rb = 28; + break; + + case 100: + first_rb = 52; + break; + } + } vrb_map[first_rb] = 1; vrb_map[first_rb + 1] = 1; vrb_map[first_rb + 2] = 1; vrb_map[first_rb + 3] = 1; + /* Get MCS for length of PCH */ if (pcch_sdu_length <= get_TBS_DL(0, 3)) { mcs = 0; @@ -2039,6 +2041,7 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) } else if (pcch_sdu_length <= get_TBS_DL(9, 3)) { mcs = 9; } + #endif dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); @@ -2063,20 +2066,19 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; - if (!CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, P_RNTI)) { - LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP); - dl_req->number_dci++; - dl_req->number_pdu++; + if (!CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, P_RNTI)) { + LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP); + dl_req->number_dci++; + dl_req->number_pdu++; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; - - dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; - memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; - dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu)); - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id]; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFE; + dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; + memset((void *)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; + dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu)); + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id]; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFE; #ifdef FORMAT1C dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 3; // format 1C dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_vrb_dl/n_rb_step, first_rb/n_rb_step, Lcrbs/n_rb_step); @@ -2085,86 +2087,83 @@ void schedule_PCH(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(n_rb_dl, first_rb, 4); dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized #endif - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 1; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB==1 ) ? 0 : 1; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1; - // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB==1 ) ? 1 : 2; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1; - // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; - - // Rel10 fields -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 1; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB==1 ) ? 0 : 1; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1; + // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB==1 ) ? 1 : 2; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1; + // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; + // Rel10 fields +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3; #endif - // Rel13 fields -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; + // Rel13 fields +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; #endif - - dl_req->number_pdu++; - - eNB->TX_req[CC_id].sfn_sf = (frameP<<4)+subframeP; - TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; - TX_req->pdu_length = pcch_sdu_length; - TX_req->pdu_index = eNB->pdu_index[CC_id]++; - TX_req->num_segments = 1; - TX_req->segments[0].segment_length = pcch_sdu_length; - TX_req->segments[0].segment_data = cc[CC_id].PCCH_pdu.payload; + dl_req->number_pdu++; + eNB->TX_req[CC_id].sfn_sf = (frameP<<4)+subframeP; + TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus]; + TX_req->pdu_length = pcch_sdu_length; + TX_req->pdu_index = eNB->pdu_index[CC_id]++; + TX_req->num_segments = 1; + TX_req->segments[0].segment_length = pcch_sdu_length; + TX_req->segments[0].segment_data = cc[CC_id].PCCH_pdu.payload; 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++; - } else { - LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP); - continue; - } + eNB->TX_req[CC_id].tx_request_body.number_of_pdus++; + } else { + LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP); + 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); - } - eNB->eNB_stats[CC_id].total_num_pcch_pdu+=1; - eNB->eNB_stats[CC_id].pcch_buffer=pcch_sdu_length; - eNB->eNB_stats[CC_id].total_pcch_buffer+=pcch_sdu_length; - eNB->eNB_stats[CC_id].pcch_mcs=mcs; - //paging first_rb log - LOG_D(MAC,"[eNB %d] Frame %d subframe %d PCH: paging_ue_index %d pcch_sdu_length %d mcs %d first_rb %d\n", - module_idP, frameP, subframeP, UE_PF_PO[CC_id][i].ue_index_value, pcch_sdu_length, mcs, first_rb); + 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); + } - pthread_mutex_lock(&ue_pf_po_mutex); - memset(&UE_PF_PO[CC_id][i], 0, sizeof(UE_PF_PO_t)); - pthread_mutex_unlock(&ue_pf_po_mutex); + eNB->eNB_stats[CC_id].total_num_pcch_pdu+=1; + eNB->eNB_stats[CC_id].pcch_buffer=pcch_sdu_length; + eNB->eNB_stats[CC_id].total_pcch_buffer+=pcch_sdu_length; + eNB->eNB_stats[CC_id].pcch_mcs=mcs; + //paging first_rb log + LOG_D(MAC,"[eNB %d] Frame %d subframe %d PCH: paging_ue_index %d pcch_sdu_length %d mcs %d first_rb %d\n", + module_idP, frameP, subframeP, UE_PF_PO[CC_id][i].ue_index_value, pcch_sdu_length, mcs, first_rb); + pthread_mutex_lock(&ue_pf_po_mutex); + memset(&UE_PF_PO[CC_id][i], 0, sizeof(UE_PF_PO_t)); + pthread_mutex_unlock(&ue_pf_po_mutex); } } } + /* this might be misleading when pcch is inactive */ stop_meas(&eNB->schedule_pch); return; } -static int slice_priority_compare(const void *_a, const void *_b, void *_c) -{ +static int slice_priority_compare(const void *_a, const void *_b, void *_c) { const int slice_id1 = *(const int *) _a; const int slice_id2 = *(const int *) _b; const module_id_t Mod_id = *(int *) _c; @@ -2173,12 +2172,13 @@ static int slice_priority_compare(const void *_a, const void *_b, void *_c) if (sli->dl[slice_id1].prio > sli->dl[slice_id2].prio) { return -1; } + return 1; } -void slice_priority_sort(module_id_t Mod_id, int slice_list[MAX_NUM_SLICES]) -{ +void slice_priority_sort(module_id_t Mod_id, int slice_list[MAX_NUM_SLICES]) { int i; + for (i = 0; i < RC.mac[Mod_id]->slice_info.n_dl; ++i) { slice_list[i] = i; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 9ab4306000..838995bdb4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -51,8 +51,8 @@ extern uint8_t nfapi_mode; #ifdef PHY_TX_THREAD -extern volatile int16_t phy_tx_txdataF_end; -extern int oai_exit; + extern volatile int16_t phy_tx_txdataF_end; + extern int oai_exit; #endif extern uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset); extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); @@ -63,11 +63,11 @@ int last_dlsch_ue_id[MAX_NUM_CCs] = {-1}; int last_ulsch_ue_id[MAX_NUM_CCs] = {-1}; #if defined(PRE_SCD_THREAD) -uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -uint8_t dlsch_ue_select_tbl_in_use; -uint8_t new_dlsch_ue_select_tbl_in_use; -boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; -eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint8_t dlsch_ue_select_tbl_in_use; + uint8_t new_dlsch_ue_select_tbl_in_use; + boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; + eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; #endif #define DEBUG_eNB_SCHEDULER 1 @@ -89,92 +89,92 @@ void set_dl_ue_select_msg4(int CC_idP, uint16_t nb_rb, int UE_id, rnti_t rnti) { dlsch_ue_select[CC_idP].ue_num++; } #if defined(PRE_SCD_THREAD) -inline uint16_t search_rbs_required(uint16_t mcs, uint16_t TBS,uint16_t NB_RB, uint16_t step_size){ +inline uint16_t search_rbs_required(uint16_t mcs, uint16_t TBS,uint16_t NB_RB, uint16_t step_size) { uint16_t nb_rb,i_TBS,tmp_TBS; i_TBS=get_I_TBS(mcs); - for(nb_rb=step_size;nb_rb>3; + if(TBScommon_channels[CC_id].mib->message.dl_Bandwidth); - if(N_RB_DL==50) step_size=3; - if(N_RB_DL==100) step_size=4; - memset(nb_rbs_required, 0, sizeof(uint16_t)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); - UE_list_t *UE_list = &RC.mac[module_idP]->UE_list; + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]) { + int CC_id=0,UE_id, lc_id, N_RB_DL; + UE_TEMPLATE UE_template; + eNB_UE_STATS *eNB_UE_stats; + rnti_t rnti; + mac_rlc_status_resp_t rlc_status; + uint16_t step_size=2; + N_RB_DL = to_prb(RC.mac[module_idP]->common_channels[CC_id].mib->message.dl_Bandwidth); - for (UE_id = 0; UE_id UE_list; - rnti = UE_RNTI(module_idP, UE_id); + for (UE_id = 0; UE_id = MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); - UE_template.dl_buffer_total += rlc_status.bytes_in_buffer; //storing the total dlsch buffer - } - // end of store dlsch buffer - - // assgin rbs required - // Calculate the number of RBs required by each UE on the basis of logical channel's buffer - //update CQI information across component carriers - eNB_UE_stats = &pre_scd_eNB_UE_stats[CC_id][UE_id]; - - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id]]; - - - if (UE_template.dl_buffer_total > 0) { - nb_rbs_required[CC_id][UE_id] = search_rbs_required(eNB_UE_stats->dlsch_mcs1, UE_template.dl_buffer_total, N_RB_DL, step_size); - } + ); + UE_template.dl_buffer_total += rlc_status.bytes_in_buffer; //storing the total dlsch buffer } + + // end of store dlsch buffer + // assgin rbs required + // Calculate the number of RBs required by each UE on the basis of logical channel's buffer + //update CQI information across component carriers + eNB_UE_stats = &pre_scd_eNB_UE_stats[CC_id][UE_id]; + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id]]; + + if (UE_template.dl_buffer_total > 0) { + nb_rbs_required[CC_id][UE_id] = search_rbs_required(eNB_UE_stats->dlsch_mcs1, UE_template.dl_buffer_total, N_RB_DL, step_size); + } + } } #endif -int cc_id_end(uint8_t *cc_id_flag ) -{ +int cc_id_end(uint8_t *cc_id_flag ) { int end_flag = 1; - for (int CC_id=0;CC_idcommon_channels; UE_list_t *UE_list = &eNB->UE_list; @@ -196,7 +196,6 @@ void dlsch_scheduler_pre_ue_select_fairRR( // Initialization for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { dlsch_ue_max_num[CC_id] = (uint16_t)RC.rrc[module_idP]->configuration.ue_multiple_max[CC_id]; - // save origin DL PDU number DL_req = &eNB->DL_req[CC_id].dl_config_request_body; saved_dlsch_dci[CC_id] = DL_req->number_pdu; @@ -209,60 +208,66 @@ void dlsch_scheduler_pre_ue_select_fairRR( } DL_req = &eNB->DL_req[CC_id].dl_config_request_body; + for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { if (UE_list->active[UE_id] == FALSE) { continue; } rnti = UE_RNTI(module_idP, UE_id); + if (rnti == NOT_A_RNTI) { continue; } - if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){ + if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) { continue; } ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - harq_pid = frame_subframe2_dl_harq_pid(cc[CC_id].tdd_Config,frameP ,subframeP); - + harq_pid = frame_subframe2_dl_harq_pid(cc[CC_id].tdd_Config,frameP,subframeP); round = ue_sched_ctl->round[CC_id][harq_pid]; + if (round != 8) { // retransmission - if(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] == 0){ + if(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] == 0) { continue; } + switch (get_tmode(module_idP, CC_id, UE_id)) { case 1: case 2: case 7: aggregation = get_aggregation(get_bw_index(module_idP, CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); + ue_sched_ctl->dl_cqi[CC_id], + format1); break; + case 3: aggregation = get_aggregation(get_bw_index(module_idP,CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format2A); + ue_sched_ctl->dl_cqi[CC_id], + format2A); break; + default: LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); aggregation = 2; break; } + format_flag = 1; + if (!CCE_allocation_infeasible(module_idP, - CC_id, - format_flag, - subframeP, - aggregation, - rnti)) { + CC_id, + format_flag, + subframeP, + aggregation, + rnti)) { dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (format_flag == 0)?2:1; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; DL_req->number_pdu++; - nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; // Insert DLSCH(retransmission) UE into selected UE list dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].UE_id = UE_id; @@ -270,6 +275,7 @@ void dlsch_scheduler_pre_ue_select_fairRR( dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].rnti = rnti; dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].nb_rb = nb_rbs_required[CC_id][UE_id]; dlsch_ue_select[CC_id].ue_num++; + if (dlsch_ue_select[CC_id].ue_num == dlsch_ue_max_num[CC_id]) { end_flag[CC_id] = 1; break; @@ -277,10 +283,10 @@ void dlsch_scheduler_pre_ue_select_fairRR( } else { if (cc[CC_id].tdd_Config != NULL) { //TDD set_ue_dai (subframeP, - UE_id, - CC_id, - cc[CC_id].tdd_Config->subframeAssignment, - UE_list); + UE_id, + CC_id, + cc[CC_id].tdd_Config->subframeAssignment, + UE_list); // update UL DAI after DLSCH scheduling set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); } @@ -296,227 +302,249 @@ void dlsch_scheduler_pre_ue_select_fairRR( } } } - if(cc_id_end(end_flag) == 1){ + + if(cc_id_end(end_flag) == 1) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { DL_req = &eNB->DL_req[CC_id].dl_config_request_body; DL_req->number_pdu = saved_dlsch_dci[CC_id]; } + return; } // Insert DLSCH(first transmission) UE into selected UE list (UE_id > last_dlsch_ue_id[CC_id]) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - if (mbsfn_flag[CC_id]>0) { + if (mbsfn_flag[CC_id]>0) { + continue; + } + + DL_req = &eNB->DL_req[CC_id].dl_config_request_body; + + for (UE_id = (last_dlsch_ue_id[CC_id]+1); UE_id active[UE_id] == FALSE) { continue; } - DL_req = &eNB->DL_req[CC_id].dl_config_request_body; - for (UE_id = (last_dlsch_ue_id[CC_id]+1); UE_id UE_sched_ctrl[UE_id]; + + for(i = 0; iactive[UE_id] == FALSE) { + if(i < dlsch_ue_select[CC_id].ue_num) + continue; + + harq_pid = frame_subframe2_dl_harq_pid(cc[CC_id].tdd_Config,frameP,subframeP); + round = ue_sched_ctl->round[CC_id][harq_pid]; + + if (round == 8) { + if (nb_rbs_required[CC_id][UE_id] == 0) { continue; } - rnti = UE_RNTI(module_idP,UE_id); - if (rnti == NOT_A_RNTI) - continue; + switch (get_tmode(module_idP, CC_id, UE_id)) { + case 1: + case 2: + case 7: + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format1); + break; - if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){ - continue; + case 3: + aggregation = get_aggregation(get_bw_index(module_idP,CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format2A); + break; + + default: + LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); + aggregation = 2; + break; } - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - for(i = 0;iround[CC_id][harq_pid]; - if (round == 8) { - if (nb_rbs_required[CC_id][UE_id] == 0) { - continue; - } - switch (get_tmode(module_idP, CC_id, UE_id)) { - case 1: - case 2: - case 7: - aggregation = get_aggregation(get_bw_index(module_idP, CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); - break; - case 3: - aggregation = get_aggregation(get_bw_index(module_idP,CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format2A); - break; - default: - LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); - aggregation = 2; - break; - } - format_flag = 1; - if (!CCE_allocation_infeasible(module_idP, - CC_id, - format_flag, - subframeP, - aggregation, - rnti)) { - dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (format_flag == 0)?2:1; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; - DL_req->number_pdu++; - - // Insert DLSCH(first transmission) UE into selected selected UE list - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].ue_priority = SCH_DL_FIRST; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].nb_rb = nb_rbs_required[CC_id][UE_id]; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].UE_id = UE_id; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].rnti = rnti; - dlsch_ue_select[CC_id].ue_num++; + if (!CCE_allocation_infeasible(module_idP, + CC_id, + format_flag, + subframeP, + aggregation, + rnti)) { + dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (format_flag == 0)?2:1; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; + DL_req->number_pdu++; + // Insert DLSCH(first transmission) UE into selected selected UE list + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].ue_priority = SCH_DL_FIRST; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].nb_rb = nb_rbs_required[CC_id][UE_id]; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].UE_id = UE_id; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].rnti = rnti; + dlsch_ue_select[CC_id].ue_num++; if (dlsch_ue_select[CC_id].ue_num == dlsch_ue_max_num[CC_id]) { - end_flag[CC_id] = 1; - break; - } - }else { - if (cc[CC_id].tdd_Config != NULL) { //TDD - set_ue_dai (subframeP, - UE_id, - CC_id, - cc[CC_id].tdd_Config->subframeAssignment, - UE_list); - // update UL DAI after DLSCH scheduling - set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); - } - add_ue_dlsch_info(module_idP, - CC_id, - UE_id, - subframeP, - S_DL_NONE); end_flag[CC_id] = 1; break; } - } - } - } - if(cc_id_end(end_flag) == 1){ - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - DL_req = &eNB->DL_req[CC_id].dl_config_request_body; - DL_req->number_pdu = saved_dlsch_dci[CC_id]; - } - return; - } - - // Insert DLSCH(first transmission) UE into selected UE list (UE_id <= last_dlsch_ue_id[CC_id]) - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - if (mbsfn_flag[CC_id]>0) { - continue; - } - - DL_req = &eNB->DL_req[CC_id].dl_config_request_body; - for (UE_id = 0; UE_id <= last_dlsch_ue_id[CC_id]; UE_id++) { - if(end_flag[CC_id] == 1){ - break; - } - - if (UE_list->active[UE_id] == FALSE) { - continue; - } - - rnti = UE_RNTI(module_idP,UE_id); - if (rnti == NOT_A_RNTI) - continue; - - if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){ - continue; - } - - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - for(i = 0;isubframeAssignment, + UE_list); + // update UL DAI after DLSCH scheduling + set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); } - } - if(i < dlsch_ue_select[CC_id].ue_num) - continue; - harq_pid = frame_subframe2_dl_harq_pid(cc[CC_id].tdd_Config,frameP ,subframeP); - - round = ue_sched_ctl->round[CC_id][harq_pid]; - if (round == 8) { - if (nb_rbs_required[CC_id][UE_id] == 0) { - continue; - } - switch (get_tmode(module_idP, CC_id, UE_id)) { - case 1: - case 2: - case 7: - aggregation = get_aggregation(get_bw_index(module_idP, CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); - break; - case 3: - aggregation = get_aggregation(get_bw_index(module_idP,CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format2A); - break; - default: - LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); - aggregation = 2; - break; - } - format_flag = 1; - if (!CCE_allocation_infeasible(module_idP, - CC_id, - format_flag, - subframeP, - aggregation, - rnti)) { - dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (format_flag == 0)?2:1; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; - DL_req->number_pdu++; - - // Insert DLSCH(first transmission) UE into selected selected UE list - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].ue_priority = SCH_DL_FIRST; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].nb_rb = nb_rbs_required[CC_id][UE_id]; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].UE_id = UE_id; - dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].rnti = rnti; - dlsch_ue_select[CC_id].ue_num++; - - if (dlsch_ue_select[CC_id].ue_num == dlsch_ue_max_num[CC_id]) { - end_flag[CC_id] = 1; - break; - } - } else { - if (cc[CC_id].tdd_Config != NULL) { //TDD - set_ue_dai (subframeP, - UE_id, - CC_id, - cc[CC_id].tdd_Config->subframeAssignment, - UE_list); - // update UL DAI after DLSCH scheduling - set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); - } add_ue_dlsch_info(module_idP, CC_id, UE_id, subframeP, S_DL_NONE); - end_flag[CC_id] = 1; - break; - } + end_flag[CC_id] = 1; + break; + } + } + } + } + + if(cc_id_end(end_flag) == 1) { + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + DL_req = &eNB->DL_req[CC_id].dl_config_request_body; + DL_req->number_pdu = saved_dlsch_dci[CC_id]; + } + + return; + } + + // Insert DLSCH(first transmission) UE into selected UE list (UE_id <= last_dlsch_ue_id[CC_id]) + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + if (mbsfn_flag[CC_id]>0) { + continue; + } + + DL_req = &eNB->DL_req[CC_id].dl_config_request_body; + + for (UE_id = 0; UE_id <= last_dlsch_ue_id[CC_id]; UE_id++) { + if(end_flag[CC_id] == 1) { + break; + } + + if (UE_list->active[UE_id] == FALSE) { + continue; + } + + rnti = UE_RNTI(module_idP,UE_id); + + if (rnti == NOT_A_RNTI) + continue; + + if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) { + continue; + } + + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + for(i = 0; iround[CC_id][harq_pid]; + + if (round == 8) { + if (nb_rbs_required[CC_id][UE_id] == 0) { + continue; + } + + switch (get_tmode(module_idP, CC_id, UE_id)) { + case 1: + case 2: + case 7: + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format1); + break; + + case 3: + aggregation = get_aggregation(get_bw_index(module_idP,CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format2A); + break; + + default: + LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); + aggregation = 2; + break; + } + + format_flag = 1; + + if (!CCE_allocation_infeasible(module_idP, + CC_id, + format_flag, + subframeP, + aggregation, + rnti)) { + dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = (format_flag == 0)?2:1; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; + DL_req->number_pdu++; + // Insert DLSCH(first transmission) UE into selected selected UE list + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].ue_priority = SCH_DL_FIRST; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].nb_rb = nb_rbs_required[CC_id][UE_id]; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].UE_id = UE_id; + dlsch_ue_select[CC_id].list[dlsch_ue_select[CC_id].ue_num].rnti = rnti; + dlsch_ue_select[CC_id].ue_num++; + + if (dlsch_ue_select[CC_id].ue_num == dlsch_ue_max_num[CC_id]) { + end_flag[CC_id] = 1; + break; + } + } else { + if (cc[CC_id].tdd_Config != NULL) { //TDD + set_ue_dai (subframeP, + UE_id, + CC_id, + cc[CC_id].tdd_Config->subframeAssignment, + UE_list); + // update UL DAI after DLSCH scheduling + set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); + } + + add_ue_dlsch_info(module_idP, + CC_id, + UE_id, + subframeP, + S_DL_NONE); + end_flag[CC_id] = 1; + break; + } } } } @@ -525,6 +553,7 @@ void dlsch_scheduler_pre_ue_select_fairRR( DL_req = &eNB->DL_req[CC_id].dl_config_request_body; DL_req->number_pdu = saved_dlsch_dci[CC_id]; } + return; } @@ -532,88 +561,75 @@ void dlsch_scheduler_pre_ue_select_fairRR( // This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, - frame_t frameP, - sub_frame_t subframeP, - int N_RBG[MAX_NUM_CCs], - int *mbsfn_flag) -{ - + frame_t frameP, + sub_frame_t subframeP, + int N_RBG[MAX_NUM_CCs], + int *mbsfn_flag) { unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],harq_pid=0,Round=0; uint16_t temp_total_rbs_count; unsigned char temp_total_ue_count; unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]; uint8_t slice_allocation[MAX_NUM_CCs][N_RBG_MAX]; - int UE_id, i; + int UE_id, i; uint16_t j,c; uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -// uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + // uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; uint16_t average_rbs_per_user[MAX_NUM_CCs] = {0}; rnti_t rnti; int min_rb_unit[MAX_NUM_CCs]; -// uint16_t r1=0; + // uint16_t r1=0; uint8_t CC_id; UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; - UE_sched_ctrl *ue_sched_ctl; // int rrc_status = RRC_IDLE; COMMON_channels_t *cc; - #ifdef TM5 - int harq_pid1 = 0; - int round1 = 0, round2 = 0; - int UE_id2; - uint16_t i1, i2, i3; - rnti_t rnti1, rnti2; - LTE_eNB_UE_stats *eNB_UE_stats1 = NULL; - LTE_eNB_UE_stats *eNB_UE_stats2 = NULL; - UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; + int harq_pid1 = 0; + int round1 = 0, round2 = 0; + int UE_id2; + uint16_t i1, i2, i3; + rnti_t rnti1, rnti2; + LTE_eNB_UE_stats *eNB_UE_stats1 = NULL; + LTE_eNB_UE_stats *eNB_UE_stats2 = NULL; + UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; #endif + memset(rballoc_sub[0],0,(MAX_NUM_CCs)*(N_RBG_MAX)*sizeof(unsigned char)); memset(min_rb_unit,0,sizeof(min_rb_unit)); + for (CC_id=0; CC_id 0) // If this CC is allocated for MBSFN skip it here + continue; - if (mbsfn_flag[CC_id] > 0) // If this CC is allocated for MBSFN skip it here - continue; + min_rb_unit[CC_id] = get_min_rb_unit(Mod_id, CC_id); + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if (UE_list->active[i] != TRUE) + continue; - - min_rb_unit[CC_id] = get_min_rb_unit(Mod_id, CC_id); - - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (UE_list->active[i] != TRUE) - continue; - - UE_id = i; - // Initialize scheduling information for all active UEs - - - - dlsch_scheduler_pre_processor_reset(Mod_id, - 0, - frameP, - subframeP, - min_rb_unit, - (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required, - rballoc_sub, - MIMO_mode_indicator, - mbsfn_flag); - - } + UE_id = i; + // Initialize scheduling information for all active UEs + dlsch_scheduler_pre_processor_reset(Mod_id, + 0, + frameP, + subframeP, + min_rb_unit, + (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required, + rballoc_sub, + MIMO_mode_indicator, + mbsfn_flag); } + } #if (!defined(PRE_SCD_THREAD)) - // Store the DLSCH buffer for each logical channel - store_dlsch_buffer(Mod_id,0, frameP, subframeP); - - - - // Calculate the number of RBs required by each UE on the basis of logical channel's buffer - assign_rbs_required(Mod_id, 0, frameP, subframeP, nb_rbs_required, - min_rb_unit); + // Store the DLSCH buffer for each logical channel + store_dlsch_buffer(Mod_id,0, frameP, subframeP); + // Calculate the number of RBs required by each UE on the basis of logical channel's buffer + assign_rbs_required(Mod_id, 0, frameP, subframeP, nb_rbs_required, + min_rb_unit); #else - memcpy(nb_rbs_required, pre_nb_rbs_required[dlsch_ue_select_tbl_in_use] , sizeof(uint16_t)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); + memcpy(nb_rbs_required, pre_nb_rbs_required[dlsch_ue_select_tbl_in_use], sizeof(uint16_t)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); #endif - dlsch_scheduler_pre_ue_select_fairRR(Mod_id,frameP,subframeP, mbsfn_flag,nb_rbs_required,dlsch_ue_select); for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { @@ -624,19 +640,21 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, temp_total_ue_count = dlsch_ue_select[CC_id].ue_num; for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2){ - temp_total_ue_count--; - continue; + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2) { + temp_total_ue_count--; + continue; } - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4){ - temp_total_ue_count--; - continue; + + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4) { + temp_total_ue_count--; + continue; } + UE_id = dlsch_ue_select[CC_id].list[i].UE_id; nb_rbs_required[CC_id][UE_id] = dlsch_ue_select[CC_id].list[i].nb_rb; - average_rbs_per_user[CC_id] = (uint16_t)round((double)temp_total_rbs_count/(double)temp_total_ue_count); - if( average_rbs_per_user[CC_id] < min_rb_unit[CC_id] ){ + + if( average_rbs_per_user[CC_id] < min_rb_unit[CC_id] ) { temp_total_ue_count--; dlsch_ue_select[CC_id].ue_num--; i--; @@ -644,9 +662,8 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, } rnti = dlsch_ue_select[CC_id].list[i].rnti; - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP); + harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); Round = ue_sched_ctl->round[CC_id][harq_pid]; //if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) { @@ -685,9 +702,11 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, dlsch_ue_select[CC_id].ue_num = i+1; break; } - LOG_D(MAC,"DLSCH UE Select: frame %d subframe %d pre_nb_available_rbs %d(i %d UE_id %d nb_rbs_required %d nb_rbs_required_remaining %d average_rbs_per_user %d (temp_total rbs_count %d ue_num %d) available_prbs %d)\n", - frameP,subframeP,ue_sched_ctl->pre_nb_available_rbs[CC_id],i,UE_id,nb_rbs_required[CC_id][UE_id],nb_rbs_required_remaining[CC_id][UE_id], - average_rbs_per_user[CC_id],temp_total_rbs_count,temp_total_ue_count,RC.mac[Mod_id]->eNB_stats[CC_id].available_prbs); + + LOG_D(MAC, + "DLSCH UE Select: frame %d subframe %d pre_nb_available_rbs %d(i %d UE_id %d nb_rbs_required %d nb_rbs_required_remaining %d average_rbs_per_user %d (temp_total rbs_count %d ue_num %d) available_prbs %d)\n", + frameP,subframeP,ue_sched_ctl->pre_nb_available_rbs[CC_id],i,UE_id,nb_rbs_required[CC_id][UE_id],nb_rbs_required_remaining[CC_id][UE_id], + average_rbs_per_user[CC_id],temp_total_rbs_count,temp_total_ue_count,RC.mac[Mod_id]->eNB_stats[CC_id].available_prbs); #ifdef TM5 // TODO: data channel TM5: to be re-visited #endif @@ -696,231 +715,240 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, #ifdef TM5 - // This has to be revisited!!!! - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - i1 = 0; - i2 = 0; - i3 = 0; - - for (j = 0; j < N_RBG[CC_id]; j++) { - if (MIMO_mode_indicator[CC_id][j] == 2) { - i1 = i1 + 1; - } else if (MIMO_mode_indicator[CC_id][j] == 1) { - i2 = i2 + 1; - } else if (MIMO_mode_indicator[CC_id][j] == 0) { - i3 = i3 + 1; - } - } - - if ((i1 < N_RBG[CC_id]) && (i2 > 0) && (i3 == 0)) { - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]-> - check_for_SUMIMO_transmissions + 1; - } - - if (i3 == N_RBG[CC_id] && i1 == 0 && i2 == 0) { - PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions + - 1; - } - - if((i1 < N_RBG[CC_id]) && (i3 > 0)) { - PHY_vars_eNB_g[Mod_id][CC_id]-> - check_for_MUMIMO_transmissions + 1; - } - - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions + - 1; + // This has to be revisited!!!! + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + i1 = 0; + i2 = 0; + i3 = 0; + for (j = 0; j < N_RBG[CC_id]; j++) { + if (MIMO_mode_indicator[CC_id][j] == 2) { + i1 = i1 + 1; + } else if (MIMO_mode_indicator[CC_id][j] == 1) { + i2 = i2 + 1; + } else if (MIMO_mode_indicator[CC_id][j] == 0) { + i3 = i3 + 1; + } } + if ((i1 < N_RBG[CC_id]) && (i2 > 0) && (i3 == 0)) { + PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions = + PHY_vars_eNB_g[Mod_id][CC_id]-> + check_for_SUMIMO_transmissions + 1; + } + + if (i3 == N_RBG[CC_id] && i1 == 0 && i2 == 0) { + PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions = + PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions + + 1; + } + + if((i1 < N_RBG[CC_id]) && (i3 > 0)) { + PHY_vars_eNB_g[Mod_id][CC_id]-> + check_for_MUMIMO_transmissions + 1; + } + + PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions = + PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions + + 1; + } + #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2){ - continue; + for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2) { + continue; + } + + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4) { + continue; + } + + UE_id = dlsch_ue_select[CC_id].list[i].UE_id; + ue_sched_ctl = &RC.mac[Mod_id]->UE_list.UE_sched_ctrl[UE_id]; + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id]; + + if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0) { + LOG_D(MAC, + "******************DL Scheduling Information for UE%d ************************\n", + UE_id); + LOG_D(MAC, "dl power offset UE%d = %d \n", UE_id, + ue_sched_ctl->dl_pow_off[CC_id]); + LOG_D(MAC, + "***********RB Alloc for every subband for UE%d ***********\n", + UE_id); + + for (j = 0; j < N_RBG[CC_id]; j++) { + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i]; + LOG_D(MAC, "RB Alloc for UE%d and Subband%d = %d\n", + UE_id, j, + ue_sched_ctl->rballoc_sub_UE[CC_id][j]); } - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4){ - continue; - } - UE_id = dlsch_ue_select[CC_id].list[i].UE_id; - ue_sched_ctl = &RC.mac[Mod_id]->UE_list.UE_sched_ctrl[UE_id]; - //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id]; - if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0) { - LOG_D(MAC, - "******************DL Scheduling Information for UE%d ************************\n", - UE_id); - LOG_D(MAC, "dl power offset UE%d = %d \n", UE_id, - ue_sched_ctl->dl_pow_off[CC_id]); - LOG_D(MAC, - "***********RB Alloc for every subband for UE%d ***********\n", - UE_id); - - for (j = 0; j < N_RBG[CC_id]; j++) { - //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i]; - LOG_D(MAC, "RB Alloc for UE%d and Subband%d = %d\n", - UE_id, j, - ue_sched_ctl->rballoc_sub_UE[CC_id][j]); - } - - //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id]; - LOG_D(MAC, "Total RBs allocated for UE%d = %d\n", UE_id, - ue_sched_ctl->pre_nb_available_rbs[CC_id]); - } - } + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id]; + LOG_D(MAC, "Total RBs allocated for UE%d = %d\n", UE_id, + ue_sched_ctl->pre_nb_available_rbs[CC_id]); + } } + } } //------------------------------------------------------------------------------ void schedule_ue_spec_fairRR(module_id_t module_idP, - frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) + frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) //------------------------------------------------------------------------------ { - - - uint8_t CC_id; - int UE_id; -// unsigned char aggregation; - mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch = 0, header_len_dcch_tmp = 0; - unsigned char header_len_dtch = 0, header_len_dtch_tmp = 0, header_len_dtch_last = 0; - unsigned char ta_len = 0; - unsigned char sdu_lcids[NB_RB_MAX], lcid, offset, num_sdus = 0; - uint16_t nb_rb, nb_rb_temp, nb_available_rb; - uint16_t TBS, j, sdu_lengths[NB_RB_MAX], rnti, padding = 0, post_padding = 0; - unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; - unsigned char round = 0; - unsigned char harq_pid = 0; - eNB_UE_STATS *eNB_UE_stats = NULL; - uint16_t sdu_length_total = 0; - - eNB_MAC_INST *eNB = RC.mac[module_idP]; - COMMON_channels_t *cc = eNB->common_channels; - UE_list_t *UE_list = &eNB->UE_list; - // int continue_flag = 0; - int32_t normalized_rx_power, target_rx_power; - int32_t tpc = 1; - static int32_t tpc_accumulated = 0; - UE_sched_ctrl *ue_sched_ctl; - int mcs; - int i; - int min_rb_unit[MAX_NUM_CCs]; - int N_RB_DL[MAX_NUM_CCs]; - int total_nb_available_rb[MAX_NUM_CCs]; - int N_RBG[MAX_NUM_CCs]; - nfapi_dl_config_request_body_t *dl_req; - nfapi_dl_config_request_pdu_t *dl_config_pdu; - int tdd_sfa; - int ta_update; + uint8_t CC_id; + int UE_id; + // unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch = 0, header_len_dcch_tmp = 0; + unsigned char header_len_dtch = 0, header_len_dtch_tmp = 0, header_len_dtch_last = 0; + unsigned char ta_len = 0; + unsigned char sdu_lcids[NB_RB_MAX], lcid, offset, num_sdus = 0; + uint16_t nb_rb, nb_rb_temp, nb_available_rb; + uint16_t TBS, j, sdu_lengths[NB_RB_MAX], rnti, padding = 0, post_padding = 0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + eNB_UE_STATS *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + eNB_MAC_INST *eNB = RC.mac[module_idP]; + COMMON_channels_t *cc = eNB->common_channels; + UE_list_t *UE_list = &eNB->UE_list; + // int continue_flag = 0; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc = 1; + static int32_t tpc_accumulated = 0; + UE_sched_ctrl *ue_sched_ctl; + int mcs; + int i; + int min_rb_unit[MAX_NUM_CCs]; + int N_RB_DL[MAX_NUM_CCs]; + int total_nb_available_rb[MAX_NUM_CCs]; + int N_RBG[MAX_NUM_CCs]; + nfapi_dl_config_request_body_t *dl_req; + nfapi_dl_config_request_pdu_t *dl_config_pdu; + int tdd_sfa; + int ta_update; #ifdef DEBUG_eNB_SCHEDULER - int k; + int k; #endif - - start_meas(&eNB->schedule_dlsch); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN); + start_meas(&eNB->schedule_dlsch); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN); + // for TDD: check that we have to act here, otherwise return + if (cc[0].tdd_Config) { + tdd_sfa = cc[0].tdd_Config->subframeAssignment; - // for TDD: check that we have to act here, otherwise return - if (cc[0].tdd_Config) { - tdd_sfa = cc[0].tdd_Config->subframeAssignment; - switch (subframeP) { - case 0: - // always continue - break; - case 1: - return; - break; - case 2: - return; - break; - case 3: - if ((tdd_sfa != 2) && (tdd_sfa != 5)) - return; - break; - case 4: - if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4) - && (tdd_sfa != 5)) - return; - break; - case 5: - break; - case 6: - case 7: - if ((tdd_sfa != 3)&& (tdd_sfa != 4) && (tdd_sfa != 5)) - return; - break; - case 8: - if ((tdd_sfa != 2) && (tdd_sfa != 3) && (tdd_sfa != 4) - && (tdd_sfa != 5)) - return; - break; - case 9: - if (tdd_sfa == 0) - return; - break; + switch (subframeP) { + case 0: + // always continue + break; - } + case 1: + return; + break; + + case 2: + return; + break; + + case 3: + if ((tdd_sfa != 2) && (tdd_sfa != 5)) + return; + + break; + + case 4: + if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4) + && (tdd_sfa != 5)) + return; + + break; + + case 5: + break; + + case 6: + case 7: + if ((tdd_sfa != 3)&& (tdd_sfa != 4) && (tdd_sfa != 5)) + return; + + break; + + case 8: + if ((tdd_sfa != 2) && (tdd_sfa != 3) && (tdd_sfa != 4) + && (tdd_sfa != 5)) + return; + + break; + + case 9: + if (tdd_sfa == 0) + return; + + break; } + } - //weight = get_ue_weight(module_idP,UE_id); -// aggregation = 2; - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth); - min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id); - // get number of PRBs less those used by common channels - total_nb_available_rb[CC_id] = N_RB_DL[CC_id]; - for (i = 0; i < N_RB_DL[CC_id]; i++) - if (cc[CC_id].vrb_map[i] != 0) - total_nb_available_rb[CC_id]--; + //weight = get_ue_weight(module_idP,UE_id); + // aggregation = 2; + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth); + min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id); + // get number of PRBs less those used by common channels + total_nb_available_rb[CC_id] = N_RB_DL[CC_id]; - N_RBG[CC_id] = to_rbg(cc[CC_id].mib->message.dl_Bandwidth); + for (i = 0; i < N_RB_DL[CC_id]; i++) + if (cc[CC_id].vrb_map[i] != 0) + total_nb_available_rb[CC_id]--; - // store the global enb stats: - eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; - eNB->eNB_stats[CC_id].available_prbs = - total_nb_available_rb[CC_id]; - eNB->eNB_stats[CC_id].total_available_prbs += - total_nb_available_rb[CC_id]; - eNB->eNB_stats[CC_id].dlsch_bytes_tx = 0; - eNB->eNB_stats[CC_id].dlsch_pdus_tx = 0; - } + N_RBG[CC_id] = to_rbg(cc[CC_id].mib->message.dl_Bandwidth); + // store the global enb stats: + eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; + eNB->eNB_stats[CC_id].available_prbs = + total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].total_available_prbs += + total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].dlsch_bytes_tx = 0; + eNB->eNB_stats[CC_id].dlsch_pdus_tx = 0; + } /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band) - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN); start_meas(&eNB->schedule_dlsch_preprocessor); dlsch_scheduler_pre_processor_fairRR(module_idP, - frameP, - subframeP, - N_RBG, - mbsfn_flag); + frameP, + subframeP, + N_RBG, + mbsfn_flag); stop_meas(&eNB->schedule_dlsch_preprocessor); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); - for (CC_id=0; CC_idDL_req[CC_id].dl_config_request_body; if (mbsfn_flag[CC_id]>0) continue; for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2){ + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2) { continue; } - if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4){ + + if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4) { continue; } + UE_id = dlsch_ue_select[CC_id].list[i].UE_id; rnti = UE_RNTI(module_idP,UE_id); + if (rnti==NOT_A_RNTI) { LOG_E(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); continue; @@ -928,387 +956,377 @@ schedule_ue_spec_fairRR(module_id_t module_idP, eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; -/* - switch(get_tmode(module_idP,CC_id,UE_id)){ - case 1: - case 2: - case 7: - aggregation = get_aggregation(get_bw_index(module_idP,CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); - break; - case 3: - aggregation = get_aggregation(get_bw_index(module_idP,CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format2A); - break; - default: - LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); - aggregation = 2; - break; - } -*/ + + /* + switch(get_tmode(module_idP,CC_id,UE_id)){ + case 1: + case 2: + case 7: + aggregation = get_aggregation(get_bw_index(module_idP,CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format1); + break; + case 3: + aggregation = get_aggregation(get_bw_index(module_idP,CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format2A); + break; + default: + LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id)); + aggregation = 2; + break; + } + */ if (cc[CC_id].tdd_Config != NULL) { //TDD set_ue_dai (subframeP, UE_id, CC_id, - cc[CC_id].tdd_Config->subframeAssignment, + cc[CC_id].tdd_Config->subframeAssignment, UE_list); // update UL DAI after DLSCH scheduling set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); } - nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; + nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; + harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); + round = ue_sched_ctl->round[CC_id][harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status = + mac_eNB_get_rrc_status(module_idP, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP); + if (UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status < + RRC_CONNECTED) + continue; - round = ue_sched_ctl->round[CC_id][harq_pid]; + sdu_length_total = 0; + num_sdus = 0; - UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti; - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status = - mac_eNB_get_rrc_status(module_idP, rnti); - UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + /* + DevCheck(((eNB_UE_stats->dl_cqi < MIN_CQI_VALUE) || (eNB_UE_stats->dl_cqi > MAX_CQI_VALUE)), + eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE); + */ + if (nfapi_mode) { + eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; + } else { + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; + } + eNB_UE_stats->dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); - if (UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status < - RRC_CONNECTED) - continue; + // store stats + //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->dl_cqi; - sdu_length_total = 0; - num_sdus = 0; + // initializing the rb allocation indicator for each UE + for (j = 0; j < N_RBG[CC_id]; j++) { + UE_list-> + UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] + = 0; + } - /* - DevCheck(((eNB_UE_stats->dl_cqi < MIN_CQI_VALUE) || (eNB_UE_stats->dl_cqi > MAX_CQI_VALUE)), - eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE); - */ - if (nfapi_mode) { - eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; + LOG_D(MAC, + "[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", + module_idP, frameP, UE_id, CC_id, rnti, harq_pid, round, + nb_available_rb, ue_sched_ctl->dl_cqi[CC_id], + eNB_UE_stats->dlsch_mcs1, + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + + /* process retransmission */ + + if (round != 8) { + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + TBS = + get_TBS_DL(UE_list-> + UE_template[CC_id][UE_id].oldmcs1[harq_pid], + nb_rb); + + if (nb_rb <= nb_available_rb) { + if (cc[CC_id].tdd_Config != NULL) { + UE_list->UE_template[CC_id][UE_id].DAI++; + update_ul_dci(module_idP, CC_id, rnti, + UE_list->UE_template[CC_id][UE_id]. + DAI,subframeP); + LOG_D(MAC, + "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", + CC_id, subframeP, UE_id, + UE_list->UE_template[CC_id][UE_id].DAI); + } + + if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id]. + rballoc_subband[harq_pid][j] = + ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } - else { - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; + } else { + nb_rb_temp = nb_rb; + j = 0; + + while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) { + if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == + 1) { + if (UE_list-> + UE_template[CC_id] + [UE_id].rballoc_subband[harq_pid][j]) + printf + ("WARN: rballoc_subband not free for retrans?\n"); + + UE_list-> + UE_template[CC_id] + [UE_id].rballoc_subband[harq_pid][j] = + ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + + if ((j == N_RBG[CC_id] - 1) && + ((N_RB_DL[CC_id] == 25) || + (N_RB_DL[CC_id] == 50))) { + nb_rb_temp = + nb_rb_temp - min_rb_unit[CC_id] + + 1; + } else { + nb_rb_temp = + nb_rb_temp - min_rb_unit[CC_id]; + } + } + + j = j + 1; } - eNB_UE_stats->dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + } + nb_available_rb -= nb_rb; + /* + eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; + eNB->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - // store stats - //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->dl_cqi; + for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + } + */ - // initializing the rb allocation indicator for each UE - for (j = 0; j < N_RBG[CC_id]; j++) { - UE_list-> - UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] - = 0; - } + switch (get_tmode(module_idP, CC_id, UE_id)) { + case 1: + case 2: + case 7: + default: + LOG_D(MAC,"retransmission DL_REQ: rnti:%x\n",rnti); + dl_config_pdu = + &dl_req->dl_config_pdu_list[dl_req-> + number_pdu]; + memset((void *) dl_config_pdu, 0, + sizeof(nfapi_dl_config_request_pdu_t)); + dl_config_pdu->pdu_type = + NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->pdu_size = + (uint8_t) (2 + + sizeof(nfapi_dl_config_dci_dl_pdu)); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8. + dci_format = NFAPI_DL_DCI_FORMAT_1; + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.aggregation_level = + get_aggregation(get_bw_index + (module_idP, CC_id), + ue_sched_ctl->dl_cqi[CC_id], + format1); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = + rnti; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8. + harq_process = harq_pid; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // dont adjust power when retransmitting + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.new_data_indicator_1 = + UE_list->UE_template[CC_id][UE_id]. + oldNDI[harq_pid]; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = + UE_list->UE_template[CC_id][UE_id]. + oldmcs1[harq_pid]; + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.redundancy_version_1 = + round & 3; - LOG_D(MAC, - "[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", - module_idP, frameP, UE_id, CC_id, rnti, harq_pid, round, - nb_available_rb, ue_sched_ctl->dl_cqi[CC_id], - eNB_UE_stats->dlsch_mcs1, - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + if (cc[CC_id].tdd_Config != NULL) { //TDD + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.downlink_assignment_index = + (UE_list->UE_template[CC_id][UE_id].DAI - + 1) & 3; + LOG_D(MAC, + "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n", + module_idP, CC_id, harq_pid, round, + (UE_list->UE_template[CC_id][UE_id].DAI - + 1), + UE_list-> + UE_template[CC_id][UE_id].oldmcs1 + [harq_pid]); + } else { + LOG_D(MAC, + "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n", + module_idP, CC_id, harq_pid, round, + UE_list-> + UE_template[CC_id][UE_id].oldmcs1 + [harq_pid]); + } + if (!CCE_allocation_infeasible + (module_idP, CC_id, 1, subframeP, + dl_config_pdu->dci_dl_pdu. + dci_dl_pdu_rel8.aggregation_level, rnti)) { + dl_req->number_dci++; + dl_req->number_pdu++; + dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; + eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; + eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; + fill_nfapi_dlsch_config(eNB, dl_req, TBS, -1 + /* retransmission, no pdu_index */ + , rnti, 0, // type 0 allocation from 7.1.6 in 36.213 + 0, // virtual_resource_block_assignment_flag, unused here + 0, // resource_block_coding, to be filled in later + getQm(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]), round & 3, // redundancy version + 1, // transport blocks + 0, // transport block to codeword swap flag + cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme + 1, // number of layers + 1, // number of subbands + // uint8_t codebook_index, + 4, // UE category capacity + UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0, // delta_power_offset for TM5 + 0, // ngap + 0, // nprb + cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode + 0, //number of PRBs treated as one subband, not used here + 0 // number of beamforming vectors, not used here + ); + LOG_D(MAC, + "Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n", + eNB->pdu_index[CC_id], round); + program_dlsch_acknak(module_idP, CC_id, UE_id, + frameP, subframeP, + dl_config_pdu-> + dci_dl_pdu.dci_dl_pdu_rel8. + cce_idx); + // No TX request for retransmission (check if null request for FAPI) + } else { + LOG_W(MAC, + "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d\%x, infeasible CCE allocation\n", + frameP, subframeP, UE_id, rnti); + } + } + add_ue_dlsch_info(module_idP, + CC_id, UE_id, subframeP, + S_DL_SCHEDULED); + //eNB_UE_stats->dlsch_trials[round]++; + UE_list->eNB_UE_stats[CC_id][UE_id]. + num_retransmission += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = + nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id]. + total_rbs_used_retx += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = + eNB_UE_stats->dlsch_mcs1; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = + eNB_UE_stats->dlsch_mcs1; + } else { + LOG_D(MAC, + "[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", + module_idP, frameP, CC_id, UE_id); + } + } else { /* This is a potentially new SDU opportunity */ + rlc_status.bytes_in_buffer = 0; + // Now check RLC information to compute number of required RBs + // get maximum TBS size for RLC request + TBS = + get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); + // check first for RLC data on DCCH + // add the length for all the control elements (timing adv, drx, etc) : header + payload - /* process retransmission */ + if (ue_sched_ctl->ta_timer == 0) { + ta_update = ue_sched_ctl->ta_update; - if (round != 8) { + /* if we send TA then set timer to not send it for a while */ + if (ta_update != 31) + ue_sched_ctl->ta_timer = 20; - // get freq_allocation - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - TBS = - get_TBS_DL(UE_list-> - UE_template[CC_id][UE_id].oldmcs1[harq_pid], - nb_rb); + /* reset ta_update */ + ue_sched_ctl->ta_update = 31; + } else { + ta_update = 31; + } - if (nb_rb <= nb_available_rb) { - if (cc[CC_id].tdd_Config != NULL) { - UE_list->UE_template[CC_id][UE_id].DAI++; - update_ul_dci(module_idP, CC_id, rnti, - UE_list->UE_template[CC_id][UE_id]. - DAI,subframeP); - LOG_D(MAC, - "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", - CC_id, subframeP, UE_id, - UE_list->UE_template[CC_id][UE_id].DAI); - } + ta_len = (ta_update != 31) ? 2 : 0; + header_len_dcch = 2; // 2 bytes DCCH SDU subheader - if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band - UE_list->UE_template[CC_id][UE_id]. - rballoc_subband[harq_pid][j] = - ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - } - } else { - nb_rb_temp = nb_rb; - j = 0; - - while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) { - if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == - 1) { - if (UE_list-> - UE_template[CC_id] - [UE_id].rballoc_subband[harq_pid][j]) - printf - ("WARN: rballoc_subband not free for retrans?\n"); - UE_list-> - UE_template[CC_id] - [UE_id].rballoc_subband[harq_pid][j] = - ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - - if ((j == N_RBG[CC_id] - 1) && - ((N_RB_DL[CC_id] == 25) || - (N_RB_DL[CC_id] == 50))) { - nb_rb_temp = - nb_rb_temp - min_rb_unit[CC_id] + - 1; - } else { - nb_rb_temp = - nb_rb_temp - min_rb_unit[CC_id]; - } - } - - j = j + 1; - } - } - - nb_available_rb -= nb_rb; - /* - eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; - eNB->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - - for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; - } - */ - - switch (get_tmode(module_idP, CC_id, UE_id)) { - case 1: - case 2: - case 7: - default: - LOG_D(MAC,"retransmission DL_REQ: rnti:%x\n",rnti); - - dl_config_pdu = - &dl_req->dl_config_pdu_list[dl_req-> - number_pdu]; - memset((void *) dl_config_pdu, 0, - sizeof(nfapi_dl_config_request_pdu_t)); - dl_config_pdu->pdu_type = - NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; - dl_config_pdu->pdu_size = - (uint8_t) (2 + - sizeof(nfapi_dl_config_dci_dl_pdu)); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8. - dci_format = NFAPI_DL_DCI_FORMAT_1; - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.aggregation_level = - get_aggregation(get_bw_index - (module_idP, CC_id), - ue_sched_ctl->dl_cqi[CC_id], - format1); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = - rnti; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power - - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8. - harq_process = harq_pid; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // dont adjust power when retransmitting - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.new_data_indicator_1 = - UE_list->UE_template[CC_id][UE_id]. - oldNDI[harq_pid]; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = - UE_list->UE_template[CC_id][UE_id]. - oldmcs1[harq_pid]; - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.redundancy_version_1 = - round & 3; - - if (cc[CC_id].tdd_Config != NULL) { //TDD - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.downlink_assignment_index = - (UE_list->UE_template[CC_id][UE_id].DAI - - 1) & 3; - LOG_D(MAC, - "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d, mcs %d\n", - module_idP, CC_id, harq_pid, round, - (UE_list->UE_template[CC_id][UE_id].DAI - - 1), - UE_list-> - UE_template[CC_id][UE_id].oldmcs1 - [harq_pid]); - } else { - LOG_D(MAC, - "[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, mcs %d\n", - module_idP, CC_id, harq_pid, round, - UE_list-> - UE_template[CC_id][UE_id].oldmcs1 - [harq_pid]); - - } - if (!CCE_allocation_infeasible - (module_idP, CC_id, 1, subframeP, - dl_config_pdu->dci_dl_pdu. - dci_dl_pdu_rel8.aggregation_level, rnti)) { - dl_req->number_dci++; - dl_req->number_pdu++; - dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; - - eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; - eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; - - fill_nfapi_dlsch_config(eNB, dl_req, TBS, -1 - /* retransmission, no pdu_index */ - , rnti, 0, // type 0 allocation from 7.1.6 in 36.213 - 0, // virtual_resource_block_assignment_flag, unused here - 0, // resource_block_coding, to be filled in later - getQm(UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]), round & 3, // redundancy version - 1, // transport blocks - 0, // transport block to codeword swap flag - cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme - 1, // number of layers - 1, // number of subbands - // uint8_t codebook_index, - 4, // UE category capacity - UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, 0, // delta_power_offset for TM5 - 0, // ngap - 0, // nprb - cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode - 0, //number of PRBs treated as one subband, not used here - 0 // number of beamforming vectors, not used here - ); - - LOG_D(MAC, - "Filled NFAPI configuration for DCI/DLSCH %d, retransmission round %d\n", - eNB->pdu_index[CC_id], round); - - program_dlsch_acknak(module_idP, CC_id, UE_id, - frameP, subframeP, - dl_config_pdu-> - dci_dl_pdu.dci_dl_pdu_rel8. - cce_idx); - // No TX request for retransmission (check if null request for FAPI) - } else { - LOG_W(MAC, - "Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d\%x, infeasible CCE allocation\n", - frameP, subframeP, UE_id, rnti); - } - } - - - add_ue_dlsch_info(module_idP, - CC_id, UE_id, subframeP, - S_DL_SCHEDULED); - - //eNB_UE_stats->dlsch_trials[round]++; - UE_list->eNB_UE_stats[CC_id][UE_id]. - num_retransmission += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = - nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id]. - total_rbs_used_retx += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = - eNB_UE_stats->dlsch_mcs1; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = - eNB_UE_stats->dlsch_mcs1; - } else { - LOG_D(MAC, - "[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", - module_idP, frameP, CC_id, UE_id); - } - } else { /* This is a potentially new SDU opportunity */ - - rlc_status.bytes_in_buffer = 0; - // Now check RLC information to compute number of required RBs - // get maximum TBS size for RLC request - TBS = - get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb); - // check first for RLC data on DCCH - // add the length for all the control elements (timing adv, drx, etc) : header + payload - - if (ue_sched_ctl->ta_timer == 0) { - ta_update = ue_sched_ctl->ta_update; - /* if we send TA then set timer to not send it for a while */ - if (ta_update != 31) - ue_sched_ctl->ta_timer = 20; - /* reset ta_update */ - ue_sched_ctl->ta_update = 31; - } else { - ta_update = 31; - } - - ta_len = (ta_update != 31) ? 2 : 0; - - header_len_dcch = 2; // 2 bytes DCCH SDU subheader - - if (TBS - ta_len - header_len_dcch > 0) { - rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, (TBS - ta_len - header_len_dcch) -#ifdef Rel14 - ,0, 0 + if (TBS - ta_len - header_len_dcch > 0) { + rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, (TBS - ta_len - header_len_dcch) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); // transport block set size + ); // transport block set size + sdu_lengths[0] = 0; - sdu_lengths[0] = 0; - - if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit - LOG_D(MAC, - "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - module_idP, frameP, subframeP, CC_id, - TBS - header_len_dcch); - sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used - (char *) - &dlsch_buffer - [0] -#ifdef Rel14 - ,0, 0 + if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit + LOG_D(MAC, + "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + module_idP, frameP, subframeP, CC_id, + TBS - header_len_dcch); + sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used + (char *) + &dlsch_buffer + [0] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); + ); pthread_mutex_lock(&rrc_release_freelist); - if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){ + + if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)) { uint16_t release_total = 0; - for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){ + + for(uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0) { release_total++; - }else{ + } else { continue; } - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){ - if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){ + if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1) { + if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]) { rrc_release_info.RRC_release_ctrl[release_num].flag = 3; LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 1->3\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num); break; - } - } - } - } - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){ - if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){ - rrc_release_info.RRC_release_ctrl[release_num].flag = 4; - LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num); - break; } } } } + + if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2) { + if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]) { + rrc_release_info.RRC_release_ctrl[release_num].flag = 4; + LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num); + break; + } + } + } + } + if(release_total >= rrc_release_info.num_UEs) break; } } - pthread_mutex_unlock(&rrc_release_freelist); + pthread_mutex_unlock(&rrc_release_freelist); RA_t *ra = &eNB->common_channels[CC_id].ra[0]; + for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) { - if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)){ - for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){ - if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]){ + if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)) { + for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) { + if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]) { ra[ra_ii].crnti_harq_pid = harq_pid; ra[ra_ii].state = MSGCRNTI_ACK; break; @@ -1316,337 +1334,339 @@ schedule_ue_spec_fairRR(module_id_t module_idP, } } } - T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), - T_INT(CC_id), T_INT(rnti), T_INT(frameP), - T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH), - T_INT(sdu_lengths[0])); - LOG_D(MAC, - "[eNB %d][DCCH] CC_id %d frame %d subframe %d UE_id %d/%x Got %d bytes bytes_in_buffer %d from release_num %d\n", - module_idP, CC_id, frameP, subframeP, UE_id, rnti, sdu_lengths[0],rlc_status.bytes_in_buffer,rrc_release_info.num_UEs); - - sdu_length_total = sdu_lengths[0]; - sdu_lcids[0] = DCCH; - UE_list->eNB_UE_stats[CC_id][UE_id]. - num_pdu_tx[DCCH] += 1; - UE_list-> - eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] - += sdu_lengths[0]; - num_sdus = 1; + + T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), + T_INT(CC_id), T_INT(rnti), T_INT(frameP), + T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH), + T_INT(sdu_lengths[0])); + LOG_D(MAC, + "[eNB %d][DCCH] CC_id %d frame %d subframe %d UE_id %d/%x Got %d bytes bytes_in_buffer %d from release_num %d\n", + module_idP, CC_id, frameP, subframeP, UE_id, rnti, sdu_lengths[0],rlc_status.bytes_in_buffer,rrc_release_info.num_UEs); + sdu_length_total = sdu_lengths[0]; + sdu_lcids[0] = DCCH; + UE_list->eNB_UE_stats[CC_id][UE_id]. + num_pdu_tx[DCCH] += 1; + UE_list-> + eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] + += sdu_lengths[0]; + num_sdus = 1; #ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC, - "[eNB %d][DCCH] CC_id %d Got %d bytes :", - module_idP, CC_id, sdu_lengths[0]); + LOG_T(MAC, + "[eNB %d][DCCH] CC_id %d Got %d bytes :", + module_idP, CC_id, sdu_lengths[0]); - for (k = 0; k < sdu_lengths[0]; k++) { - LOG_T(MAC, "%x ", dlsch_buffer[k]); - } + for (k = 0; k < sdu_lengths[0]; k++) { + LOG_T(MAC, "%x ", dlsch_buffer[k]); + } - LOG_T(MAC, "\n"); + LOG_T(MAC, "\n"); #endif - } else { - header_len_dcch = 0; - sdu_length_total = 0; - } - } - // check for DCCH1 and update header information (assume 2 byte sub-header) - if (TBS - ta_len - header_len_dcch - sdu_length_total > 0) { - rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, (TBS - ta_len - header_len_dcch - sdu_length_total) -#ifdef Rel14 - ,0, 0 + } else { + header_len_dcch = 0; + sdu_length_total = 0; + } + } + + // check for DCCH1 and update header information (assume 2 byte sub-header) + if (TBS - ta_len - header_len_dcch - sdu_length_total > 0) { + rlc_status = mac_rlc_status_ind(module_idP, rnti, module_idP, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, (TBS - ta_len - header_len_dcch - sdu_length_total) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); // transport block set size less allocations for timing advance and - // DCCH SDU - sdu_lengths[num_sdus] = 0; + ); // transport block set size less allocations for timing advance and + // DCCH SDU + sdu_lengths[num_sdus] = 0; - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, - "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - module_idP, frameP, CC_id, - TBS - header_len_dcch - sdu_length_total); - sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, TBS, //not used - (char *) - &dlsch_buffer - [sdu_length_total] -#ifdef Rel14 - ,0, 0 + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, + "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + module_idP, frameP, CC_id, + TBS - header_len_dcch - sdu_length_total); + sdu_lengths[num_sdus] += mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH + 1, TBS, //not used + (char *) + &dlsch_buffer + [sdu_length_total] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0, 0 #endif - ); - - T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), - T_INT(CC_id), T_INT(rnti), T_INT(frameP), - T_INT(subframeP), T_INT(harq_pid), - T_INT(DCCH + 1), T_INT(sdu_lengths[num_sdus])); - - sdu_lcids[num_sdus] = DCCH1; - sdu_length_total += sdu_lengths[num_sdus]; - header_len_dcch += 2; - UE_list->eNB_UE_stats[CC_id][UE_id]. - num_pdu_tx[DCCH1] += 1; - UE_list-> - eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] - += sdu_lengths[num_sdus]; - num_sdus++; + ); + T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), + T_INT(CC_id), T_INT(rnti), T_INT(frameP), + T_INT(subframeP), T_INT(harq_pid), + T_INT(DCCH + 1), T_INT(sdu_lengths[num_sdus])); + sdu_lcids[num_sdus] = DCCH1; + sdu_length_total += sdu_lengths[num_sdus]; + header_len_dcch += 2; + UE_list->eNB_UE_stats[CC_id][UE_id]. + num_pdu_tx[DCCH1] += 1; + UE_list-> + eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] + += sdu_lengths[num_sdus]; + num_sdus++; #ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC, - "[eNB %d][DCCH1] CC_id %d Got %d bytes :", - module_idP, CC_id, sdu_lengths[num_sdus]); + LOG_T(MAC, + "[eNB %d][DCCH1] CC_id %d Got %d bytes :", + module_idP, CC_id, sdu_lengths[num_sdus]); - for (k = 0; k < sdu_lengths[num_sdus]; k++) { - LOG_T(MAC, "%x ", dlsch_buffer[k]); - } + for (k = 0; k < sdu_lengths[num_sdus]; k++) { + LOG_T(MAC, "%x ", dlsch_buffer[k]); + } - LOG_T(MAC, "\n"); + LOG_T(MAC, "\n"); #endif + } + } - } - } - // assume the max dtch header size, and adjust it later - header_len_dtch = 0; - header_len_dtch_last = 0; // the header length of the last mac sdu - // lcid has to be sorted before the actual allocation (similar struct as ue_list). - /* TODO limited lcid for performance */ + // assume the max dtch header size, and adjust it later + header_len_dtch = 0; + header_len_dtch_last = 0; // the header length of the last mac sdu + + // lcid has to be sorted before the actual allocation (similar struct as ue_list). + /* TODO limited lcid for performance */ for (lcid = DTCH; lcid >= DTCH; lcid--) { - // TBD: check if the lcid is active + // TBD: check if the lcid is active + header_len_dtch += 3; + header_len_dtch_last = 3; + LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n", + module_idP, + frameP, + lcid, + TBS, + TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch); - header_len_dtch += 3; - header_len_dtch_last = 3; - LOG_D(MAC, - "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n", - module_idP, frameP, lcid, TBS, - TBS - ta_len - header_len_dcch - - sdu_length_total - header_len_dtch); - - if (TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch > 0) { // NN: > 2 ? - rlc_status = mac_rlc_status_ind(module_idP, - rnti, - module_idP, - frameP, - subframeP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - TBS - ta_len - - header_len_dcch - - sdu_length_total - - header_len_dtch + if (TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch > 0) { // NN: > 2 ? + rlc_status = mac_rlc_status_ind(module_idP, + rnti, + module_idP, + frameP, + subframeP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch #ifdef Rel14 - ,0, 0 + , 0, 0 #endif - ); + ); - - if (rlc_status.bytes_in_buffer > 0) { - - LOG_D(MAC, - "[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n", - module_idP, frameP, - TBS - header_len_dcch - - sdu_length_total - header_len_dtch, lcid, - header_len_dtch); - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, TBS, //not used - (char - *) - &dlsch_buffer - [sdu_length_total] + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n", + module_idP, + frameP, + TBS - header_len_dcch - sdu_length_total - header_len_dtch, + lcid, + header_len_dtch); + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + rnti, + module_idP, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + TBS, //not used + (char *)&dlsch_buffer[sdu_length_total] #ifdef Rel14 - ,0, 0 + , 0, 0 #endif - ); - T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), - T_INT(CC_id), T_INT(rnti), T_INT(frameP), - T_INT(subframeP), T_INT(harq_pid), - T_INT(lcid), T_INT(sdu_lengths[num_sdus])); + ); + T(T_ENB_MAC_UE_DL_SDU, + T_INT(module_idP), + T_INT(CC_id), + T_INT(rnti), + T_INT(frameP), + T_INT(subframeP), + T_INT(harq_pid), + T_INT(lcid), + T_INT(sdu_lengths[num_sdus])); + LOG_D(MAC, "[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", + module_idP, + sdu_lengths[num_sdus], + lcid); + sdu_lcids[num_sdus] = lcid; + sdu_length_total += sdu_lengths[num_sdus]; + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus]; - LOG_D(MAC, - "[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", - module_idP, sdu_lengths[num_sdus], lcid); - sdu_lcids[num_sdus] = lcid; - sdu_length_total += sdu_lengths[num_sdus]; - UE_list-> - eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] - += 1; - UE_list-> - eNB_UE_stats[CC_id][UE_id].num_bytes_tx - [lcid] += sdu_lengths[num_sdus]; - if (sdu_lengths[num_sdus] < 128) { - header_len_dtch--; - header_len_dtch_last--; - } - num_sdus++; - UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; - } // no data for this LCID - else { - header_len_dtch -= 3; - } - } // no TBS left - else { - header_len_dtch -= 3; - break; - } - } - if (header_len_dtch == 0) - header_len_dtch_last = 0; - // there is at least one SDU - // if (num_sdus > 0 ){ - if ((sdu_length_total + header_len_dcch + - header_len_dtch) > 0) { + if (sdu_lengths[num_sdus] < 128) { + header_len_dtch--; + header_len_dtch_last--; + } - // Now compute number of required RBs for total sdu length - // Assume RAH format 2 - // adjust header lengths - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; - if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch > 0) ? 1 : 0; //header_len_dcch; // remove length field - } else { - header_len_dtch_last -= 1; // now use it to find how many bytes has to be removed for the last MAC SDU - header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last : header_len_dtch; // remove length field for the last SDU - } + num_sdus++; + UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; + } else { // no data for this LCID + header_len_dtch -= 3; + } + } else { // no TBS left + header_len_dtch -= 3; + break; + } + } - mcs = eNB_UE_stats->dlsch_mcs1; - nb_rb = min_rb_unit[CC_id]; - TBS = get_TBS_DL(mcs, nb_rb); + if (header_len_dtch == 0) + header_len_dtch_last = 0; - while (TBS < - (sdu_length_total + header_len_dcch + - header_len_dtch + ta_len)) { - nb_rb += min_rb_unit[CC_id]; // + // there is at least one SDU + // if (num_sdus > 0 ){ + if ((sdu_length_total + header_len_dcch + + header_len_dtch) > 0) { + // Now compute number of required RBs for total sdu length + // Assume RAH format 2 + // adjust header lengths + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; - if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs - // (can happen if N_RB_DL is odd) - TBS = - get_TBS_DL(eNB_UE_stats->dlsch_mcs1, - nb_available_rb); - nb_rb = nb_available_rb; - break; - } + if (header_len_dtch == 0) { + header_len_dcch = (header_len_dcch > 0) ? 1 : 0; //header_len_dcch; // remove length field + } else { + header_len_dtch_last -= 1; // now use it to find how many bytes has to be removed for the last MAC SDU + header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last : header_len_dtch; // remove length field for the last SDU + } - TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_rb); - } + mcs = eNB_UE_stats->dlsch_mcs1; + nb_rb = min_rb_unit[CC_id]; + TBS = get_TBS_DL(mcs, nb_rb); - if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band - UE_list->UE_template[CC_id][UE_id]. - rballoc_subband[harq_pid][j] = - ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - } - } else { - nb_rb_temp = nb_rb; - j = 0; + while (TBS < + (sdu_length_total + header_len_dcch + + header_len_dtch + ta_len)) { + nb_rb += min_rb_unit[CC_id]; // - while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) { - if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == - 1) { - UE_list-> - UE_template[CC_id] - [UE_id].rballoc_subband[harq_pid][j] = - ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs + // (can happen if N_RB_DL is odd) + TBS = + get_TBS_DL(eNB_UE_stats->dlsch_mcs1, + nb_available_rb); + nb_rb = nb_available_rb; + break; + } - if ((j == N_RBG[CC_id] - 1) && - ((N_RB_DL[CC_id] == 25) || - (N_RB_DL[CC_id] == 50))) { - nb_rb_temp = - nb_rb_temp - min_rb_unit[CC_id] + - 1; - } else { - nb_rb_temp = - nb_rb_temp - min_rb_unit[CC_id]; - } - } + TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_rb); + } - j = j + 1; - } - } + if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id]. + rballoc_subband[harq_pid][j] = + ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + } + } else { + nb_rb_temp = nb_rb; + j = 0; - // decrease mcs until TBS falls below required length - while ((TBS > - (sdu_length_total + header_len_dcch + - header_len_dtch + ta_len)) && (mcs > 0)) { - mcs--; - TBS = get_TBS_DL(mcs, nb_rb); - } + while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) { + if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == + 1) { + UE_list-> + UE_template[CC_id] + [UE_id].rballoc_subband[harq_pid][j] = + ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < - (sdu_length_total + header_len_dcch + - header_len_dtch + ta_len)) - && (((ue_sched_ctl->dl_pow_off[CC_id] > 0) - && (mcs < 28)) - || ((ue_sched_ctl->dl_pow_off[CC_id] == 0) - && (mcs <= 15)))) { - mcs++; - TBS = get_TBS_DL(mcs, nb_rb); - } + if ((j == N_RBG[CC_id] - 1) && + ((N_RB_DL[CC_id] == 25) || + (N_RB_DL[CC_id] == 50))) { + nb_rb_temp = + nb_rb_temp - min_rb_unit[CC_id] + + 1; + } else { + nb_rb_temp = + nb_rb_temp - min_rb_unit[CC_id]; + } + } - LOG_D(MAC, - "dlsch_mcs before and after the rate matching = (%d, %d)\n", - eNB_UE_stats->dlsch_mcs1, mcs); + j = j + 1; + } + } + // decrease mcs until TBS falls below required length + while ((TBS > + (sdu_length_total + header_len_dcch + + header_len_dtch + ta_len)) && (mcs > 0)) { + mcs--; + TBS = get_TBS_DL(mcs, nb_rb); + } + + // if we have decreased too much or we don't have enough RBs, increase MCS + while ((TBS < + (sdu_length_total + header_len_dcch + + header_len_dtch + ta_len)) + && (((ue_sched_ctl->dl_pow_off[CC_id] > 0) + && (mcs < 28)) + || ((ue_sched_ctl->dl_pow_off[CC_id] == 0) + && (mcs <= 15)))) { + mcs++; + TBS = get_TBS_DL(mcs, nb_rb); + } + + LOG_D(MAC, + "dlsch_mcs before and after the rate matching = (%d, %d)\n", + eNB_UE_stats->dlsch_mcs1, mcs); #ifdef DEBUG_eNB_SCHEDULER - LOG_D(MAC, - "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n", - module_idP, CC_id, mcs, TBS, nb_rb); - // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n", - // TBS, sdu_length_total, offset, TBS-sdu_length_total-offset); + LOG_D(MAC, + "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n", + module_idP, CC_id, mcs, TBS, nb_rb); + // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n", + // TBS, sdu_length_total, offset, TBS-sdu_length_total-offset); #endif - if ((TBS - header_len_dcch - header_len_dtch - - sdu_length_total - ta_len) <= 2) { - padding = - (TBS - header_len_dcch - header_len_dtch - - sdu_length_total - ta_len); - post_padding = 0; - } else { - padding = 0; + if ((TBS - header_len_dcch - header_len_dtch - + sdu_length_total - ta_len) <= 2) { + padding = + (TBS - header_len_dcch - header_len_dtch - + sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; - // adjust the header len - if (header_len_dtch == 0) { - header_len_dcch = header_len_dcch_tmp; - } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) - header_len_dtch = header_len_dtch_tmp; - } + // adjust the header len + if (header_len_dtch == 0) { + header_len_dcch = header_len_dcch_tmp; + } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) + header_len_dtch = header_len_dtch_tmp; + } - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header - } + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header + } #ifdef PHY_TX_THREAD - struct timespec time_req, time_rem; - time_req.tv_sec = 0; - time_req.tv_nsec = 10000; - while((!oai_exit)&&(phy_tx_txdataF_end == 0)){ - nanosleep(&time_req,&time_rem); - continue; - } + struct timespec time_req, time_rem; + time_req.tv_sec = 0; + time_req.tv_nsec = 10000; + + while((!oai_exit)&&(phy_tx_txdataF_end == 0)) { + nanosleep(&time_req,&time_rem); + continue; + } + #endif + offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, post_padding); - offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus - sdu_lengths, // - sdu_lcids, 255, // no drx - ta_update, // timing advance - NULL, // contention res id - padding, post_padding); + //#ifdef DEBUG_eNB_SCHEDULER + if (ta_update != 31) { + LOG_D(MAC, + "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n", + module_idP, frameP, UE_id, CC_id, + sdu_length_total, num_sdus, sdu_lengths[0], + sdu_lcids[0], offset, ta_update, padding, + post_padding, mcs, TBS, nb_rb, + header_len_dcch, header_len_dtch); + } - //#ifdef DEBUG_eNB_SCHEDULER - if (ta_update != 31) { - LOG_D(MAC, - "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n", - module_idP, frameP, UE_id, CC_id, - sdu_length_total, num_sdus, sdu_lengths[0], - sdu_lcids[0], offset, ta_update, padding, - post_padding, mcs, TBS, nb_rb, - header_len_dcch, header_len_dtch); - } - //#endif + //#endif #ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n",module_idP ); + LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n",module_idP ); - for (k = 0; k < 16; k++) { - LOG_T(MAC, "%x.", dlsch_buffer[k]); - } + for (k = 0; k < 16; k++) { + LOG_T(MAC, "%x.", dlsch_buffer[k]); + } - LOG_T(MAC, "\n"); + LOG_T(MAC, "\n"); #endif - // cycle through SDUs and place in dlsch_buffer memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); @@ -1666,9 +1686,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, 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; - + UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; add_ue_dlsch_info(module_idP, CC_id, UE_id, @@ -1677,13 +1695,11 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // store stats eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=mcs; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; @@ -1694,168 +1710,152 @@ schedule_ue_spec_fairRR(module_id_t module_idP, update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI,subframeP); } - // do PUCCH power control + // do PUCCH power control // this is the normalized RX power - eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; - + eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; /* Unit is not dBm, it's special from nfapi */ - normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30;//(+eNB->measurements.n0_power_dB[0]) - target_rx_power= eNB->puCch10xSnr/10 + 30;//(+eNB->measurements.n0_power_dB[0]) - + normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30;//(+eNB->measurements.n0_power_dB[0]) + target_rx_power= eNB->puCch10xSnr/10 + 30;//(+eNB->measurements.n0_power_dB[0]) // 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_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; + // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out + int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; + if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case - ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around - if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { - ue_sched_ctl->pucch1_cqi_update[CC_id] = 0; + ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around + if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { + ue_sched_ctl->pucch1_cqi_update[CC_id] = 0; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP; - - if (normalized_rx_power>(target_rx_power+4)) { - tpc = 0; //-1 - tpc_accumulated--; - } else if (normalized_rx_power<(target_rx_power-4)) { - tpc = 2; //+1 - tpc_accumulated++; - } else { - tpc = 1; //0 - } - - LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", - module_idP,frameP, subframeP,harq_pid,tpc, - tpc_accumulated,normalized_rx_power,target_rx_power); + if (normalized_rx_power>(target_rx_power+4)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power<(target_rx_power-4)) { + tpc = 2; //+1 + tpc_accumulated++; + } else { + tpc = 1; //0 + } - } // Po_PUCCH has been updated - else { - tpc = 1; //0 - } // time to do TPC update - else { - tpc = 1; //0 - } + LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", + module_idP,frameP, subframeP,harq_pid,tpc, + tpc_accumulated,normalized_rx_power,target_rx_power); + } // Po_PUCCH has been updated + else { + tpc = 1; //0 + } // time to do TPC update + else { + tpc = 1; //0 + } - dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; - memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; - dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu)); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP,CC_id),ue_sched_ctl->dl_cqi[CC_id],format1); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power - - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc; // dont adjust power when retransmitting - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; - //deactivate second codeword - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1; - if (cc[CC_id].tdd_Config != NULL) { //TDD - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n", - module_idP,CC_id,harq_pid, - (UE_list->UE_template[CC_id][UE_id].DAI-1), - mcs); - } else { - LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n", - module_idP,CC_id,harq_pid,mcs); - - } - LOG_D(MAC,"Checking feasibility pdu %d (new sdu)\n",dl_req->number_pdu); - if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,rnti)) { + dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; + memset((void *)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu)); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP,CC_id),ue_sched_ctl->dl_cqi[CC_id],format1); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc; // dont adjust power when retransmitting + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; + //deactivate second codeword + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1; + if (cc[CC_id].tdd_Config != NULL) { //TDD + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n", + module_idP,CC_id,harq_pid, + (UE_list->UE_template[CC_id][UE_id].DAI-1), + mcs); + } else { + LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n", + module_idP,CC_id,harq_pid,mcs); + } - ue_sched_ctl->round[CC_id][harq_pid] = 0; - dl_req->number_dci++; - dl_req->number_pdu++; - dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; - - eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; - eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; - // Toggle NDI for next time - LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", - CC_id, frameP,subframeP,UE_id, - rnti,harq_pid,UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs; - UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0; - AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated is NULL\n"); - AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); - - fill_nfapi_dlsch_config(eNB,dl_req, - TBS, - eNB->pdu_index[CC_id], - rnti, - 0, // type 0 allocation from 7.1.6 in 36.213 - 0, // virtual_resource_block_assignment_flag, unused here - 0, // resource_block_coding, to be filled in later - getQm(mcs), - 0, // redundancy version - 1, // transport blocks - 0, // transport block to codeword swap flag - cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme - 1, // number of layers - 1, // number of subbands - // uint8_t codebook_index, - 4, // UE category capacity - UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, - 0, // delta_power_offset for TM5 - 0, // ngap - 0, // nprb - cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode - 0, //number of PRBs treated as one subband, not used here - 0 // number of beamforming vectors, not used here - ); - eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body, - (frameP*10)+subframeP, - TBS, - eNB->pdu_index[CC_id], - eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]); - - LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",eNB->pdu_index[CC_id]); + LOG_D(MAC,"Checking feasibility pdu %d (new sdu)\n",dl_req->number_pdu); - eNB->pdu_index[CC_id]++; - program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); - last_dlsch_ue_id[CC_id] = UE_id; - } - else { - LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", - frameP,subframeP,UE_id,rnti); - } + if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,rnti)) { + ue_sched_ctl->round[CC_id][harq_pid] = 0; + dl_req->number_dci++; + dl_req->number_pdu++; + dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; + eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; + eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; + // Toggle NDI for next time + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frameP,subframeP,UE_id, + rnti,harq_pid,UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs; + UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0; + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated is NULL\n"); + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); + fill_nfapi_dlsch_config(eNB,dl_req, + TBS, + eNB->pdu_index[CC_id], + rnti, + 0, // type 0 allocation from 7.1.6 in 36.213 + 0, // virtual_resource_block_assignment_flag, unused here + 0, // resource_block_coding, to be filled in later + getQm(mcs), + 0, // redundancy version + 1, // transport blocks + 0, // transport block to codeword swap flag + cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme + 1, // number of layers + 1, // number of subbands + // uint8_t codebook_index, + 4, // UE category capacity + UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated->p_a, + 0, // delta_power_offset for TM5 + 0, // ngap + 0, // nprb + cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode + 0, //number of PRBs treated as one subband, not used here + 0 // number of beamforming vectors, not used here + ); + eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body, + (frameP*10)+subframeP, + TBS, + eNB->pdu_index[CC_id], + eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]); + LOG_D(MAC,"Filled NFAPI configuration for DCI/DLSCH/TXREQ %d, new SDU\n",eNB->pdu_index[CC_id]); + eNB->pdu_index[CC_id]++; + program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); + last_dlsch_ue_id[CC_id] = UE_id; + } else { + LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", + frameP,subframeP,UE_id,rnti); + } } else { // There is no data from RLC or MAC header, so don't schedule - } } - if (cc[CC_id].tdd_Config != NULL){ // TDD + if (cc[CC_id].tdd_Config != NULL) { // TDD set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); } - } // UE_id loop } // CC_id loop - fill_DLSCH_dci_fairRR(module_idP,frameP,subframeP,mbsfn_flag); stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); - - } //------------------------------------------------------------------------------ void fill_DLSCH_dci_fairRR( - module_id_t module_idP, - frame_t frameP, - sub_frame_t subframeP, - int* mbsfn_flagP) + module_id_t module_idP, + frame_t frameP, + sub_frame_t subframeP, + int *mbsfn_flagP) //------------------------------------------------------------------------------ { - // loop over all allocated UEs and compute frequency allocations for PDSCH int UE_id = -1; uint8_t /* first_rb, */ nb_rb=3; @@ -1863,7 +1863,6 @@ fill_DLSCH_dci_fairRR( //unsigned char *vrb_map; uint8_t rballoc_sub[25]; //uint8_t number_of_subbands=13; - //unsigned char round; unsigned char harq_pid; int i; @@ -1889,65 +1888,63 @@ fill_DLSCH_dci_fairRR( // UE specific DCIs for (j = 0; j < dlsch_ue_select[CC_id].ue_num; j++) { - if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG2){ + if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG2) { continue; } - if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG4){ + + if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG4) { continue; } + UE_id = dlsch_ue_select[CC_id].list[j].UE_id; LOG_T(MAC,"CC_id %d, UE_id: %d => status %d\n",CC_id,UE_id,eNB_dlsch_info[module_idP][CC_id][UE_id].status); if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) { - // clear scheduling flag eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING; rnti = UE_RNTI(module_idP,UE_id); - harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP); + harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - - /// Synchronizing rballoc with rballoc_sub for(i=0; iUE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; } - nfapi_dl_config_request_t *DL_req = &RC.mac[module_idP]->DL_req[0]; - nfapi_dl_config_request_pdu_t* dl_config_pdu; + nfapi_dl_config_request_t *DL_req = &RC.mac[module_idP]->DL_req[0]; + nfapi_dl_config_request_pdu_t *dl_config_pdu; - for (i=0;ipdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& - (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti) && - (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1)) { - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub); - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0; - } - else if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)&& - (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti) && - (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type==0)) { - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub); - } - } - } + for (i=0; ipdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& + (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti == rnti) && + (dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format != 1)) { + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0; + } else if ((dl_config_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)&& + (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti == rnti) && + (dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type==0)) { + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = allocate_prbs_sub(nb_rb,N_RB_DL,N_RBG,rballoc_sub); + } + } } } + } - stop_meas(&eNB->fill_DLSCH_dci); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI, VCD_FUNCTION_OUT); + stop_meas(&eNB->fill_DLSCH_dci); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI, VCD_FUNCTION_OUT); } void ulsch_scheduler_pre_ue_select_fairRR( - module_id_t module_idP, - frame_t frameP, - sub_frame_t subframeP, - sub_frame_t sched_subframeP, - ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) -{ + module_id_t module_idP, + frame_t frameP, + sub_frame_t subframeP, + sub_frame_t sched_subframeP, + ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) { eNB_MAC_INST *eNB=RC.mac[module_idP]; COMMON_channels_t *cc; int CC_id,UE_id; @@ -1958,7 +1955,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( uint8_t first_ue_id[MAX_NUM_CCs][20]; uint8_t ul_inactivity_num[MAX_NUM_CCs]; uint8_t ul_inactivity_id[MAX_NUM_CCs][20]; -// LTE_DL_FRAME_PARMS *frame_parms; + // LTE_DL_FRAME_PARMS *frame_parms; uint8_t ulsch_ue_max_num[MAX_NUM_CCs]; uint16_t saved_ulsch_dci[MAX_NUM_CCs]; rnti_t rnti; @@ -1966,127 +1963,134 @@ void ulsch_scheduler_pre_ue_select_fairRR( uint8_t cc_id_flag[MAX_NUM_CCs]; uint8_t harq_pid = 0,round = 0; UE_list_t *UE_list= &eNB->UE_list; - - uint8_t aggregation = 2; int format_flag; nfapi_hi_dci0_request_body_t *HI_DCI0_req; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; - for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { - //save ulsch dci number - saved_ulsch_dci[CC_id] = eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci; - // maximum multiplicity number - ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.ue_multiple_max[CC_id]; - - cc_id_flag[CC_id] = 0; - ue_first_num[CC_id] = 0; - ul_inactivity_num[CC_id] = 0; - + //save ulsch dci number + saved_ulsch_dci[CC_id] = eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci; + // maximum multiplicity number + ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.ue_multiple_max[CC_id]; + cc_id_flag[CC_id] = 0; + ue_first_num[CC_id] = 0; + ul_inactivity_num[CC_id] = 0; } + // UE round >0 for ( UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++ ) { - if (UE_list->active[UE_id] == FALSE) - continue; + if (UE_list->active[UE_id] == FALSE) + continue; - rnti = UE_RNTI(module_idP,UE_id); - if (rnti ==NOT_A_RNTI) + rnti = UE_RNTI(module_idP,UE_id); + + if (rnti ==NOT_A_RNTI) + continue; + + CC_id = UE_PCCID(module_idP,UE_id); + + if (UE_list->UE_template[CC_id][UE_id].configured == FALSE) + continue; + + if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) + continue; + + // UL DCI + HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + + if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { + cc_id_flag[CC_id] = 1; + HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; + ret = cc_id_end(cc_id_flag); + + if ( ret == 0 ) { continue; + } - CC_id = UE_PCCID(module_idP,UE_id); - if (UE_list->UE_template[CC_id][UE_id].configured == FALSE) - continue; + if ( ret == 1 ) { + return; + } + } - if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) - continue; + cc = &eNB->common_channels[CC_id]; + //harq_pid + harq_pid = subframe2harqpid(cc,(frameP+(sched_subframePUE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid]; - // UL DCI - HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; - if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { + if ( round > 0 ) { + 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; + + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { cc_id_flag[CC_id] = 1; - HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; - ret = cc_id_end(cc_id_flag); - if ( ret == 0 ) { - continue; - } - if ( ret == 1 ) { - return; - } + continue; + } else { + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + HI_DCI0_req->number_of_dci++; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_RETRANS; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = eNB->UE_list.UE_template[CC_id][UE_id].first_rb_ul[harq_pid]; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = eNB->UE_list.UE_template[CC_id][UE_id].nb_rb_ul[harq_pid]; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = UE_id; + ulsch_ue_select[CC_id].ue_num++; + continue; + } + } + + // + 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; + + if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) { + if ( bytes_to_schedule > 0 ) { + first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; + first_ue_total[CC_id][ue_first_num[CC_id]] = bytes_to_schedule; + ue_first_num[CC_id]++; + continue; } - cc = &eNB->common_channels[CC_id]; - //harq_pid - harq_pid = subframe2harqpid(cc,(frameP+(sched_subframePUE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid]; + if ( UE_list->UE_template[CC_id][UE_id].ul_SR > 0 ) { + 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]++; + continue; + } - if ( round > 0 ) { - 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; - if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { - cc_id_flag[CC_id] = 1; - continue; + UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + 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))) { + 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]++; + continue; + } + + /*if ( (ulsch_ue_select[CC_id].ue_num+ul_inactivity_num[CC_id] ) < ulsch_ue_max_num[CC_id] ) { + UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + uint8_t ul_period = 0; + if (cc->tdd_Config) { + ul_period = 50; } else { - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - HI_DCI0_req->number_of_dci++; - - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_RETRANS; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = eNB->UE_list.UE_template[CC_id][UE_id].first_rb_ul[harq_pid]; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = eNB->UE_list.UE_template[CC_id][UE_id].nb_rb_ul[harq_pid]; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = UE_id; - ulsch_ue_select[CC_id].ue_num++; - continue; + ul_period = 20; } - } - // - 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; - - if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) { - if ( bytes_to_schedule > 0 ) { - first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; - first_ue_total[CC_id][ue_first_num[CC_id]] = bytes_to_schedule; - ue_first_num[CC_id]++; - continue; - } - if ( UE_list->UE_template[CC_id][UE_id].ul_SR > 0 ) { - 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]++; - continue; - } - UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - if ( ((UE_sched_ctl->ul_inactivity_timer>20)&&(UE_sched_ctl->ul_scheduled==0)) || + if ( ((UE_sched_ctl->ul_inactivity_timer>ul_period)&&(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))) { - 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]++; + ul_inactivity_id[CC_id][ul_inactivity_num[CC_id]]= UE_id; + ul_inactivity_num[CC_id] ++; continue; } - /*if ( (ulsch_ue_select[CC_id].ue_num+ul_inactivity_num[CC_id] ) < ulsch_ue_max_num[CC_id] ) { - UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - uint8_t ul_period = 0; - if (cc->tdd_Config) { - ul_period = 50; - } else { - ul_period = 20; - } - if ( ((UE_sched_ctl->ul_inactivity_timer>ul_period)&&(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))) { - ul_inactivity_id[CC_id][ul_inactivity_num[CC_id]]= UE_id; - ul_inactivity_num[CC_id] ++; - continue; - } - }*/ - } - + }*/ + } } for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + for ( int temp = 0; temp < ue_first_num[CC_id]; temp++ ) { if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { cc_id_flag[CC_id] = 1; @@ -2097,113 +2101,121 @@ void ulsch_scheduler_pre_ue_select_fairRR( 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; rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]); - if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { - cc_id_flag[CC_id] = 1; - break; - } else { - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - HI_DCI0_req->number_of_dci++; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_FIRST; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = first_ue_total[CC_id][temp]; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = first_ue_id[CC_id][temp]; - ulsch_ue_select[CC_id].ue_num++; + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { + cc_id_flag[CC_id] = 1; + break; + } else { + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + HI_DCI0_req->number_of_dci++; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_FIRST; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = first_ue_total[CC_id][temp]; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = first_ue_id[CC_id][temp]; + ulsch_ue_select[CC_id].ue_num++; } } } for ( UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++ ) { if (UE_list->active[UE_id] == FALSE) - continue; + continue; rnti = UE_RNTI(module_idP,UE_id); + if (rnti ==NOT_A_RNTI) - continue; + continue; CC_id = UE_PCCID(module_idP,UE_id); if (UE_id > last_ulsch_ue_id[CC_id]) - continue; + continue; if (UE_list->UE_template[CC_id][UE_id].configured == FALSE) - continue; + continue; if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) - continue; + continue; if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { - cc_id_flag[CC_id] = 1; - HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; - ret = cc_id_end(cc_id_flag); - if ( ret == 0 ) { - continue; - } - if ( ret == 1 ) { - return; - } - } + cc_id_flag[CC_id] = 1; + HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; + ret = cc_id_end(cc_id_flag); - for(i = 0;iHI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; //SR BSR - UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - + UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; 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; 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)) ){ - 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; - if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { - cc_id_flag[CC_id] = 1; - continue; - } else { - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - HI_DCI0_req->number_of_dci++; + ((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)) ) { + 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; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_FIRST; - if(bytes_to_schedule > 0) - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = bytes_to_schedule; - else if(UE_list->UE_template[CC_id][UE_id].ul_SR > 0) - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = 0; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = UE_id; - ulsch_ue_select[CC_id].ue_num++; - continue; - } + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { + cc_id_flag[CC_id] = 1; + continue; + } else { + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + HI_DCI0_req->number_of_dci++; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_FIRST; + + if(bytes_to_schedule > 0) + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = bytes_to_schedule; + else if(UE_list->UE_template[CC_id][UE_id].ul_SR > 0) + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = 0; + + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = UE_id; + ulsch_ue_select[CC_id].ue_num++; + continue; + } } + //inactivity UE -/* if ( (ulsch_ue_select[CC_id].ue_num+ul_inactivity_num[CC_id]) < ulsch_ue_max_num[CC_id] ) { - UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - uint8_t ul_period = 0; - if (cc->tdd_Config) { - ul_period = 50; - } else { - ul_period = 20; - } - if ( ((UE_sched_ctl->ul_inactivity_timer>ul_period)&&(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))) { - ul_inactivity_id[CC_id][ul_inactivity_num[CC_id]]= UE_id; - ul_inactivity_num[CC_id]++; - continue; - } - }*/ + /* if ( (ulsch_ue_select[CC_id].ue_num+ul_inactivity_num[CC_id]) < ulsch_ue_max_num[CC_id] ) { + UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + uint8_t ul_period = 0; + if (cc->tdd_Config) { + ul_period = 50; + } else { + ul_period = 20; + } + if ( ((UE_sched_ctl->ul_inactivity_timer>ul_period)&&(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))) { + ul_inactivity_id[CC_id][ul_inactivity_num[CC_id]]= UE_id; + ul_inactivity_num[CC_id]++; + continue; + } + }*/ } for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + for ( int temp = 0; temp < ul_inactivity_num[CC_id]; temp++ ) { if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; @@ -2214,43 +2226,45 @@ void ulsch_scheduler_pre_ue_select_fairRR( 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; rnti = UE_RNTI(module_idP,ul_inactivity_id[CC_id][temp]); - if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { - cc_id_flag[CC_id] = 1; - continue; - } else { - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - HI_DCI0_req->number_of_dci++; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_INACTIVE; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = 0; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = ul_inactivity_id[CC_id][temp]; - ulsch_ue_select[CC_id].ue_num++; + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { + cc_id_flag[CC_id] = 1; + continue; + } else { + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + HI_DCI0_req->number_of_dci++; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_INACTIVE; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ul_total_buffer = 0; + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = ul_inactivity_id[CC_id][temp]; + ulsch_ue_select[CC_id].ue_num++; } } + HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; } + return; } -uint8_t find_rb_table_index(uint8_t average_rbs) -{ +uint8_t find_rb_table_index(uint8_t average_rbs) { int i; + for ( i = 0; i < 34; i++ ) { if ( rb_table[i] > average_rbs ) { return (i-1); } } + return i; } void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, - frame_t frameP, - sub_frame_t subframeP, - sub_frame_t sched_subframeP, - ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) -{ + frame_t frameP, + sub_frame_t subframeP, + sub_frame_t sched_subframeP, + ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) { int CC_id,ulsch_ue_num; eNB_MAC_INST *eNB = RC.mac[module_idP]; UE_list_t *UE_list= &eNB->UE_list; @@ -2275,26 +2289,27 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { cc = &RC.mac[module_idP]->common_channels[CC_id]; frame_parms = &(RC.eNB[module_idP][CC_id]->frame_parms); + if (cc->tdd_Config) { //TDD if (frame_parms->N_RB_UL == 25) { - num_pucch_rb = 1; + num_pucch_rb = 1; } else if (frame_parms->N_RB_UL == 50) { - num_pucch_rb = 2; + num_pucch_rb = 2; } else { - num_pucch_rb = 3; + num_pucch_rb = 3; } } else {//FDD if (frame_parms->N_RB_UL == 25) { - num_pucch_rb = 1; + num_pucch_rb = 1; } else { - num_pucch_rb = 2; + num_pucch_rb = 2; } } first_rb[CC_id] = num_pucch_rb; ue_num_temp = ulsch_ue_select[CC_id].ue_num; - for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) { + for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) { UE_id = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id; if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) { @@ -2309,52 +2324,59 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, continue; } - if (first_rb[CC_id] >= frame_parms->N_RB_UL-num_pucch_rb ) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id); - break; + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id); + break; } - total_rbs = frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id]; + total_rbs = frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id]; average_rbs = (int)round((double)total_rbs/(double)ue_num_temp); + if ( average_rbs < 3 ) { ue_num_temp--; ulsch_ue_num--; ulsch_ue_select[CC_id].ue_num--; continue; } + if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_RETRANS ) { if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb <= average_rbs ) { - // assigne RBS(nb_rb) - ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; - first_rb[CC_id] = first_rb[CC_id] + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + // assigne RBS(nb_rb) + ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; + first_rb[CC_id] = first_rb[CC_id] + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; } + if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb > average_rbs ) { if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb <= total_rbs ) { - // assigne RBS(average_rbs) - ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; - first_rb[CC_id] = first_rb[CC_id] + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + // assigne RBS(average_rbs) + ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; + first_rb[CC_id] = first_rb[CC_id] + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; } else { - // assigne RBS(remain rbs) - ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; - rb_table_index = 2; - while(rb_table[rb_table_index] <= total_rbs){ - rb_table_index++; - } - ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb = rb_table[rb_table_index-1]; - first_rb[CC_id] = first_rb[CC_id] + rb_table[rb_table_index-1]; + // assigne RBS(remain rbs) + ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb = first_rb[CC_id]; + rb_table_index = 2; + + while(rb_table[rb_table_index] <= total_rbs) { + rb_table_index++; + } + + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb = rb_table[rb_table_index-1]; + first_rb[CC_id] = first_rb[CC_id] + rb_table[rb_table_index-1]; } } - }else{ + } else { UE_template = &UE_list->UE_template[CC_id][UE_id]; + if ( UE_list->UE_sched_ctrl[UE_id].phr_received == 1 ) { mcs = 20; } else { mcs = 10; } + if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST ) { int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes; + if (bytes_to_schedule < 0) bytes_to_schedule = 0; if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) { @@ -2369,7 +2391,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, } while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id])) && - ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { + ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { rb_table_index++; tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3; tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); @@ -2378,6 +2400,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, if ( rb_table[rb_table_index]<3 ) { rb_table_index=2; } + if ( rb_table[rb_table_index] <= average_rbs ) { // assigne RBS( nb_rb) first_rb[CC_id] = first_rb[CC_id] + rb_table[rb_table_index]; @@ -2385,27 +2408,30 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = rb_table_index; UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs; } + if ( rb_table[rb_table_index] > average_rbs ) { // assigne RBS(average_rbs) rb_table_index = find_rb_table_index(average_rbs); - if (rb_table_index>=34){ - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: average RBs %d > 100\n", - module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id,average_rbs); - break; + + if (rb_table_index>=34) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: average RBs %d > 100\n", + module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id,average_rbs); + break; } + first_rb[CC_id] = first_rb[CC_id] + rb_table[rb_table_index]; UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = rb_table[rb_table_index]; UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = rb_table_index; UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs; } - }else { + } else { // assigne RBS( 3 RBs) first_rb[CC_id] = first_rb[CC_id] + 3; UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = 3; UE_list->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 2; UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10; } - }else if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE ) { + } else if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE ) { // assigne RBS( 3 RBs) first_rb[CC_id] = first_rb[CC_id] + 3; UE_list->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul[0] = 3; @@ -2413,6 +2439,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_list->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10; } } + ue_num_temp--; } } @@ -2421,105 +2448,126 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, void schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, - sub_frame_t subframeP) -{ + sub_frame_t subframeP) { uint16_t i; int CC_id; eNB_MAC_INST *mac = RC.mac[module_idP]; COMMON_channels_t *cc; int sched_frame=frameP; - start_meas(&mac->schedule_ulsch); - int sched_subframe = (subframeP+4)%10; - cc = &mac->common_channels[0]; int tdd_sfa; + // for TDD: check subframes where we have to act and return if nothing should be done now if (cc->tdd_Config) { tdd_sfa = cc->tdd_Config->subframeAssignment; + switch (subframeP) { - case 0: - if ((tdd_sfa == 0)|| - (tdd_sfa == 3)) sched_subframe = 4; - else if (tdd_sfa==6) sched_subframe = 7; - else return; - break; - case 1: - if ((tdd_sfa==0)|| - (tdd_sfa==1)) sched_subframe = 7; - else if (tdd_sfa==6) sched_subframe = 8; - else return; - break; - case 2: // Don't schedule UL in subframe 2 for TDD - return; - case 3: - if (tdd_sfa==2) sched_subframe = 7; - else return; - break; - case 4: - if (tdd_sfa==1) sched_subframe = 8; - else return; - break; - case 5: - if (tdd_sfa==0) sched_subframe = 9; - else if (tdd_sfa==6) sched_subframe = 2; - else return; - break; - case 6: - if (tdd_sfa==0 || tdd_sfa==1) sched_subframe = 2; - else if (tdd_sfa==6) sched_subframe = 3; - else return; - break; - case 7: - return; - case 8: - if ((tdd_sfa>=2) && (tdd_sfa<=5)) sched_subframe=2; - else return; - break; - case 9: - if ((tdd_sfa==1) || (tdd_sfa==3) || (tdd_sfa==4)) sched_subframe=3; - else if (tdd_sfa==6) sched_subframe=4; - else return; - break; + case 0: + if ((tdd_sfa == 0)|| + (tdd_sfa == 3)) sched_subframe = 4; + else if (tdd_sfa==6) sched_subframe = 7; + else return; + + break; + + case 1: + if ((tdd_sfa==0)|| + (tdd_sfa==1)) sched_subframe = 7; + else if (tdd_sfa==6) sched_subframe = 8; + else return; + + break; + + case 2: // Don't schedule UL in subframe 2 for TDD + return; + + case 3: + if (tdd_sfa==2) sched_subframe = 7; + else return; + + break; + + case 4: + if (tdd_sfa==1) sched_subframe = 8; + else return; + + break; + + case 5: + if (tdd_sfa==0) sched_subframe = 9; + else if (tdd_sfa==6) sched_subframe = 2; + else return; + + break; + + case 6: + if (tdd_sfa==0 || tdd_sfa==1) sched_subframe = 2; + else if (tdd_sfa==6) sched_subframe = 3; + else return; + + break; + + case 7: + return; + + case 8: + if ((tdd_sfa>=2) && (tdd_sfa<=5)) sched_subframe=2; + else return; + + break; + + case 9: + if ((tdd_sfa==1) || (tdd_sfa==3) || (tdd_sfa==4)) sched_subframe=3; + else if (tdd_sfa==6) sched_subframe=4; + else return; + + break; } } + if (sched_subframe < subframeP) sched_frame++; + ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]; memset(ulsch_ue_select, 0, sizeof(ulsch_ue_select)); - LTE_DL_FRAME_PARMS *frame_parms ; for (CC_id=0; CC_idcommon_channels[CC_id]; frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms; + // output of scheduling, the UE numbers in RBs, where it is in the code??? // check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3 // Msg3 is using 1 PRB so we need to increase first_rb accordingly // not sure about the break (can there be more than 1 active RA procedure?) for (i=0; ira[i].state == WAITMSG3) &&(cc->ra[i].Msg3_subframe == sched_subframe)) { + if ((cc->ra[i].state == WAITMSG3) &&(cc->ra[i].Msg3_subframe == sched_subframe)) { ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3; + if (cc->tdd_Config == NULL) { - if(frame_parms->N_RB_UL == 25){ - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; - }else{ - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2; - } + if(frame_parms->N_RB_UL == 25) { + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; + } else { + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2; + } } else { - switch(frame_parms->N_RB_UL){ + switch(frame_parms->N_RB_UL) { case 25: default: ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; break; + case 50: ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2; break; + case 100: ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 3; break; - } + } } + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 1; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1; ulsch_ue_select[CC_id].ue_num++; @@ -2531,11 +2579,11 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) { ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset( - frame_parms, - frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, - frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, - 0,//tdd_mapindex - frameP); //Nf + frame_parms, + frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, + 0,//tdd_mapindex + frameP); //Nf ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1; ulsch_ue_select[CC_id].ue_num++; @@ -2547,11 +2595,10 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, } void schedule_ulsch_rnti_fairRR(module_id_t module_idP, - frame_t frameP, - sub_frame_t subframeP, - unsigned char sched_subframeP, - ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) -{ + frame_t frameP, + sub_frame_t subframeP, + unsigned char sched_subframeP, + ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]) { int16_t UE_id; uint8_t aggregation = 2; uint16_t first_rb[MAX_NUM_CCs]; @@ -2560,7 +2607,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, uint8_t round = 0; uint8_t harq_pid = 0; uint8_t status = 0; - uint8_t rb_table_index = -1; + uint8_t rb_table_index = -1; uint32_t cqi_req,cshift,ndi,tpc; int32_t normalized_rx_power; int32_t target_rx_power=-90; @@ -2576,99 +2623,102 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, int rvidx_tab[4] = {0,2,3,1}; uint16_t ul_req_index; uint8_t dlsch_flag; + if (sched_subframeP < subframeP) sched_frame++; nfapi_hi_dci0_request_body_t *hi_dci0_req; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; - nfapi_ul_config_request_body_t *ul_req_tmp; nfapi_ul_config_ulsch_harq_information *ulsch_harq_information; LOG_D(MAC,"entering ulsch preprocesor\n"); ulsch_scheduler_pre_processor_fairRR(module_idP, - frameP, - subframeP, - sched_subframeP, - ulsch_ue_select); - + frameP, + subframeP, + sched_subframeP, + ulsch_ue_select); LOG_D(MAC,"exiting ulsch preprocesor\n"); - - // loop over all active UEs for (CC_id=0; CC_idHI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; - eNB->HI_DCI0_req[CC_id][subframeP].sfn_sf = (frameP<<4)+subframeP; - ul_req_tmp = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body; - nfapi_ul_config_request_t *ul_req = &eNB->UL_req_tmp[CC_id][sched_subframeP]; - + hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + eNB->HI_DCI0_req[CC_id][subframeP].sfn_sf = (frameP<<4)+subframeP; + ul_req_tmp = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body; + nfapi_ul_config_request_t *ul_req = &eNB->UL_req_tmp[CC_id][sched_subframeP]; ULSCH_first_end = 0; cc = &eNB->common_channels[CC_id]; // This is the actual CC_id in the list N_RB_UL = to_prb(cc->mib->message.dl_Bandwidth); + //leave out first RB for PUCCH if (cc->tdd_Config == NULL) { - if(N_RB_UL == 25){ - first_rb[CC_id] = 1; - }else{ - first_rb[CC_id] = 2; - } - }else { - switch(N_RB_UL){ + if(N_RB_UL == 25) { + first_rb[CC_id] = 1; + } else { + first_rb[CC_id] = 2; + } + } else { + switch(N_RB_UL) { case 25: default: - first_rb[CC_id] = 1; + first_rb[CC_id] = 1; break; + case 50: - first_rb[CC_id] = 2; + first_rb[CC_id] = 2; break; + case 100: - first_rb[CC_id] = 3; + first_rb[CC_id] = 3; break; - } + } } + for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) { UE_id = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id; + /* be sure that there are some free RBs */ - if (cc->tdd_Config == NULL){ - if(N_RB_UL == 25){ - if (first_rb[CC_id] >= N_RB_UL-1) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id); - break; - } - }else{ - if (first_rb[CC_id] >= N_RB_UL-2) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id); - break; - } + if (cc->tdd_Config == NULL) { + if(N_RB_UL == 25) { + if (first_rb[CC_id] >= N_RB_UL-1) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,rnti,CC_id); + break; } + } else { + if (first_rb[CC_id] >= N_RB_UL-2) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,rnti,CC_id); + break; + } + } } else { - if(N_RB_UL == 25){ - if (first_rb[CC_id] >= N_RB_UL-1) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); - break; - } - }else if(N_RB_UL == 50){ - if (first_rb[CC_id] >= N_RB_UL-2) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); - break; - } - }else if(N_RB_UL == 100){ - if (first_rb[CC_id] >= N_RB_UL-3) { - LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); - break; - } + if(N_RB_UL == 25) { + if (first_rb[CC_id] >= N_RB_UL-1) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); + break; } + } else if(N_RB_UL == 50) { + if (first_rb[CC_id] >= N_RB_UL-2) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); + break; + } + } else if(N_RB_UL == 100) { + if (first_rb[CC_id] >= N_RB_UL-3) { + LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); + break; + } + } } + //MSG3 if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) { first_rb[CC_id] ++; continue; } + //PRACH if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) { first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; @@ -2681,376 +2731,389 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, rnti = UE_RNTI(CC_id,UE_id); LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL); - int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes; + if (bytes_to_schedule < 0) bytes_to_schedule = 0; RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = bytes_to_schedule; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]); - status = mac_eNB_get_rrc_status(module_idP,rnti); + if (status < RRC_CONNECTED) 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( subframeP == 1 || subframeP == 6 ) cqi_req=0; - break; - case 3: - if( subframeP == 1 ) cqi_req=0; - break; - default: - LOG_E(MAC," TDD config not supported\n"); - break; - } - } - if(cqi_req == 1){ - UE_sched_ctrl->cqi_req_timer=0; - UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP; - } - } - else + 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( subframeP == 1 || subframeP == 6 ) cqi_req=0; + + break; + + case 3: + if( subframeP == 1 ) cqi_req=0; + + break; + + default: + LOG_E(MAC," TDD config not supported\n"); + break; + } + } + + if(cqi_req == 1) { + UE_sched_ctrl->cqi_req_timer=0; + UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP; + } + } else cqi_req = 0; //power control //compute the expected ULSCH RX power (for the stats) - // this is the normalized RX power and this should be constant (regardless of mcs normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30; //(+eNB->measurements.n0_power_dB[0]) target_rx_power= eNB->puSch10xSnr/10 + 30; //(+eNB->measurements.n0_power_dB[0]) - // 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 (normalized_rx_power>(target_rx_power+4)) { - tpc = 0; //-1 - tpc_accumulated--; - } else if (normalized_rx_power<(target_rx_power-4)) { - tpc = 2; //+1 - tpc_accumulated++; - } else { - tpc = 1; //0 - } + ((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 (normalized_rx_power>(target_rx_power+4)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power<(target_rx_power-4)) { + tpc = 2; //+1 + tpc_accumulated++; } 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, normalized/target rx power %d/%d\n", + } 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, normalized/target rx power %d/%d\n", module_idP,frameP,subframeP,harq_pid,tpc, tpc_accumulated,normalized_rx_power,target_rx_power); + } + + // new transmission + if ((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) || + (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE)) { + LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x (SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n", + module_idP,harq_pid,frameP,subframeP,UE_id,rnti,UE_template->ul_SR, + UE_sched_ctrl->ul_inactivity_timer, + UE_sched_ctrl->ul_failure_timer, + UE_sched_ctrl->cqi_req_timer); + ndi = 1-UE_template->oldNDI_UL[harq_pid]; + UE_template->oldNDI_UL[harq_pid]=ndi; + UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul; + UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS + + if (UE_template->pre_allocated_rb_table_index_ul >=0) { + rb_table_index=UE_template->pre_allocated_rb_table_index_ul; + } else { + UE_template->mcs_UL[harq_pid]=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs); + rb_table_index=5; // for PHR } - // new transmission - if ((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) || - (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE)) { - LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x (SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n", - module_idP,harq_pid,frameP,subframeP,UE_id,rnti,UE_template->ul_SR, - UE_sched_ctrl->ul_inactivity_timer, - UE_sched_ctrl->ul_failure_timer, - UE_sched_ctrl->cqi_req_timer); - ndi = 1-UE_template->oldNDI_UL[harq_pid]; - UE_template->oldNDI_UL[harq_pid]=ndi; - UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; - UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul; - UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS - if (UE_template->pre_allocated_rb_table_index_ul >=0) { - rb_table_index=UE_template->pre_allocated_rb_table_index_ul; - } else { - UE_template->mcs_UL[harq_pid]=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs); - rb_table_index=5; // for PHR - } - 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].ulsch_mcs2=UE_template->mcs_UL[harq_pid]; + UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]); + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index]; + 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(first_rb[CC_id]), T_INT(rb_table[rb_table_index]), + T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi)); - UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]); - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index]; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid]; + if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) + LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n", + module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid], + first_rb[CC_id],rb_table[rb_table_index], + rb_table_index,UE_template->TBS_UL[harq_pid],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(first_rb[CC_id]), T_INT(rb_table[rb_table_index]), - T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi)); + // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) + //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_sched_ctrl->ul_scheduled |= (1<mcs_UL[harq_pid], - first_rb[CC_id],rb_table[rb_table_index], - rb_table_index,UE_template->TBS_UL[harq_pid],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); - // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) - //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]; + // adjust total UL buffer status by TBS, wait for UL sdus to do final update + /*LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); + if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid]) + UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid]; + else + UE_template->ul_total_buffer = 0; + LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);*/ + // Cyclic shift for DM RS + 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; + 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_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb[CC_id]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; + hi_dci0_req->number_of_dci++; + hi_dci0_req->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4) + hi_dci0_req->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; + nfapi_hi_dci0_request_t *nfapi_hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP]; + nfapi_hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! + nfapi_hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + ul_req_index = 0; + dlsch_flag = 0; - UE_sched_ctrl->ul_scheduled |= (1<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 - /*LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); - if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid]) - UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid]; - else - UE_template->ul_total_buffer = 0; - LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);*/ - // Cyclic shift for DM RS - 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; - - 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_DCI_PDU_TYPE; - hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb[CC_id]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; - - hi_dci0_req->number_of_dci++; - hi_dci0_req->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4) - hi_dci0_req->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; - nfapi_hi_dci0_request_t *nfapi_hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP]; - nfapi_hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! - nfapi_hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); - - ul_req_index = 0; - dlsch_flag = 0; - for(ul_req_index = 0;ul_req_index < ul_req_tmp->number_of_pdus;ul_req_index++){ - if((ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) && - (ul_req_tmp->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)){ - dlsch_flag = 1; - LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); - break; - } - } - // Add UL_config PDUs - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_index], - cqi_req, - cc, - UE_template->physicalConfigDedicated, - get_tmode(module_idP,CC_id,UE_id), - eNB->ul_handle, - rnti, - first_rb[CC_id], // resource_block_start - rb_table[rb_table_index], // 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 - ndi, // new_data_indication - 0, // redundancy_version - harq_pid, // harq_process_number - 0, // ul_tx_mode - 0, // current_tx_nb - 0, // n_srs - get_TBS_UL(UE_template->mcs_UL[harq_pid], - rb_table[rb_table_index]) - ); -#ifdef Rel14 - if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_index], - UE_template->rach_resource_type>2 ? 2 : 1, - 1, //total_number_of_repetitions - 1, //repetition_number - (frameP*10)+subframeP); - } -#endif - if(dlsch_flag == 1){ - if(cqi_req == 1){ - ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; - - }else{ - ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; - } - fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); - }else{ - ul_req_tmp->number_of_pdus++; - } - eNB->ul_handle++; - ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; - ul_req_tmp->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; - uint16_t ul_sched_frame = sched_frame; - uint16_t ul_sched_subframeP = sched_subframeP; - add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2); - ul_req->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP; - - 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); - - // increment first rb for next UE allocation - first_rb[CC_id]+=rb_table[rb_table_index]; - if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) { - UE_template->scheduled_ul_bytes += get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]); - UE_template->ul_SR = 0; - } - if((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE) && (ULSCH_first_end == 0)) { - ULSCH_first_end = 1; - last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num-1].UE_id; - } - if((ulsch_ue_num == ulsch_ue_select[CC_id].ue_num-1) && (ULSCH_first_end == 0)) { - ULSCH_first_end = 1; - last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id; - } + for(ul_req_index = 0; ul_req_index < ul_req_tmp->number_of_pdus; ul_req_index++) { + if((ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) && + (ul_req_tmp->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) { + dlsch_flag = 1; + LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); + break; } - else if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_RETRANS) { // round > 0 => retransmission - 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(first_rb[CC_id]), T_INT(rb_table[rb_table_index]), - T_INT(round)); + } - round = UE_sched_ctrl->round_UL[CC_id][harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; - UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; - uint8_t mcs_rv = 0; - if(rvidx_tab[round&3]==1){ - mcs_rv = 29; - }else if(rvidx_tab[round&3]==2){ - mcs_rv = 30; - }else if(rvidx_tab[round&3]==3){ - mcs_rv = 31; - } - UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb); - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid]; + // Add UL_config PDUs + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_index], + cqi_req, + cc, + UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + first_rb[CC_id], // resource_block_start + rb_table[rb_table_index], // 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 + ndi, // new_data_indication + 0, // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + get_TBS_UL(UE_template->mcs_UL[harq_pid], + rb_table[rb_table_index]) + ); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_index], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP*10)+subframeP); + } - if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) - LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n", - module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,mcs_rv,first_rb[CC_id],rb_table[rb_table_index],rb_table_index,UE_template->TBS_UL[harq_pid],harq_pid); - - // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) - //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; - - UE_sched_ctrl->ul_scheduled |= (1<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_DCI_PDU_TYPE; - hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = mcs_rv; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = UE_template->oldNDI_UL[harq_pid]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; - - hi_dci0_req->number_of_dci++; - // Add UL_config PDUs - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); - ul_req_index = 0; - dlsch_flag = 0; - for(ul_req_index = 0;ul_req_index < ul_req_tmp->number_of_pdus;ul_req_index++){ - if((ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) && - (ul_req_tmp->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)){ - dlsch_flag = 1; - LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(phich)\n",frameP,subframeP,rnti,ul_req_index); - break; - } - } - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_index], - cqi_req, - cc, - UE_template->physicalConfigDedicated, - get_tmode(module_idP,CC_id,UE_id), - eNB->ul_handle, - rnti, - ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb, // resource_block_start - ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb, // 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&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] - ); -#ifdef Rel14 - if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_index], - UE_template->rach_resource_type>2 ? 2 : 1, - 1, //total_number_of_repetitions - 1, //repetition_number - (frameP*10)+subframeP); - } #endif - if(dlsch_flag == 1){ - if(cqi_req == 1){ - ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; - }else{ - ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; - } - fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); - }else{ - ul_req_tmp->number_of_pdus++; - } - eNB->ul_handle++; - ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; - ul_req_tmp->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; - ul_req->sfn_sf = sched_frame<<4|sched_subframeP; - - LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0(round >0)\n", module_idP,CC_id,frameP,subframeP,UE_id); - - // increment first rb for next UE allocation - first_rb[CC_id]+=ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + if(dlsch_flag == 1) { + if(cqi_req == 1) { + ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag= + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; + } else { + ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; } + + fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); + } else { + ul_req_tmp->number_of_pdus++; + } + + eNB->ul_handle++; + ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; + ul_req_tmp->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; + uint16_t ul_sched_frame = sched_frame; + uint16_t ul_sched_subframeP = sched_subframeP; + add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2); + ul_req->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP; + 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); + // increment first rb for next UE allocation + first_rb[CC_id]+=rb_table[rb_table_index]; + + if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) { + UE_template->scheduled_ul_bytes += get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]); + UE_template->ul_SR = 0; + } + + if((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE) && (ULSCH_first_end == 0)) { + ULSCH_first_end = 1; + last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num-1].UE_id; + } + + if((ulsch_ue_num == ulsch_ue_select[CC_id].ue_num-1) && (ULSCH_first_end == 0)) { + ULSCH_first_end = 1; + last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id; + } + } else if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_RETRANS) { // round > 0 => retransmission + 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(first_rb[CC_id]), T_INT(rb_table[rb_table_index]), + T_INT(round)); + round = UE_sched_ctrl->round_UL[CC_id][harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; + uint8_t mcs_rv = 0; + + if(rvidx_tab[round&3]==1) { + mcs_rv = 29; + } else if(rvidx_tab[round&3]==2) { + mcs_rv = 30; + } else if(rvidx_tab[round&3]==3) { + mcs_rv = 31; + } + + UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb); + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid]; + + if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) + LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n", + module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,mcs_rv,first_rb[CC_id],rb_table[rb_table_index],rb_table_index,UE_template->TBS_UL[harq_pid],harq_pid); + + // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) + //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; + UE_sched_ctrl->ul_scheduled |= (1<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_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = mcs_rv; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = UE_template->oldNDI_UL[harq_pid]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; + hi_dci0_req->number_of_dci++; + // Add UL_config PDUs + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + ul_req_index = 0; + dlsch_flag = 0; + + for(ul_req_index = 0; ul_req_index < ul_req_tmp->number_of_pdus; ul_req_index++) { + if((ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) && + (ul_req_tmp->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) { + dlsch_flag = 1; + LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(phich)\n",frameP,subframeP,rnti,ul_req_index); + break; + } + } + + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_index], + cqi_req, + cc, + UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb, // resource_block_start + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb, // 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&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] + ); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + + if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_index], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP*10)+subframeP); + } + +#endif + + if(dlsch_flag == 1) { + if(cqi_req == 1) { + ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag= + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + } else { + ul_req_tmp->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = + ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + } + + fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); + } else { + ul_req_tmp->number_of_pdus++; + } + + eNB->ul_handle++; + ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; + ul_req_tmp->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; + ul_req->sfn_sf = sched_frame<<4|sched_subframeP; + LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0(round >0)\n", module_idP,CC_id,frameP,subframeP,UE_id); + // increment first rb for next UE allocation + first_rb[CC_id]+=ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; + } } // loop over UE_id } // loop of CC_id } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index 16953e958a..649f763f42 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -59,7 +59,7 @@ extern RAN_CONTEXT_t RC; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area) @@ -151,7 +151,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, // 1st: Check the MBSFN subframes from SIB2 info (SF allocation pattern i, max 8 non-overlapping patterns exist) if (frameP % mbsfn_period == cc->mbsfn_SubframeConfig[j]->radioframeAllocationOffset) { // MBSFN frameP - if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format + if (cc->mbsfn_SubframeConfig[j]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format // Find the first subframeP in this MCH to transmit MSI if (frameP % mch_scheduling_period == @@ -585,7 +585,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, TBS = get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth)); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // do not let mcch and mtch multiplexing when relaying is active // for sync area 1, so not transmit data //if ((i == 0) && ((RC.mac[module_idP]->MBMS_flag != multicast_relay) || (RC.mac[module_idP]->mcch_active==0))) { @@ -633,7 +633,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, MTCH, TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -652,7 +652,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES, MTCH, 0, //not used (char *) &mch_buffer[sdu_length_total] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -676,7 +676,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, header_len_mtch = 0; } } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // } #endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c index 81c418c123..881359f274 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c @@ -169,7 +169,7 @@ schedule_ue_spec_phy_test( 1, // number of subbands // uint8_t codebook_index, 4, // UE category capacity - PDSCH_ConfigDedicated__p_a_dB0, + LTE_PDSCH_ConfigDedicated__p_a_dB0, 0, // delta_power_offset for TM5 0, // ngap 0, // nprb @@ -347,7 +347,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s 0, // n_srs get_TBS_UL(mcs,nb_rb) ); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type>2 ? 2 : 1, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 6a6141d45c..60463d36d1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -61,6 +61,7 @@ extern uint16_t frame_cnt; #include "SCHED/sched_common.h" extern RAN_CONTEXT_t RC; +extern uint8_t nfapi_mode; int choose(int n, int k) { @@ -789,7 +790,7 @@ get_srs_pos(COMMON_channels_t * cc, uint16_t isrs, void get_csi_params(COMMON_channels_t * cc, - struct CQI_ReportPeriodic *cqi_ReportPeriodic, + struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic, uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H) { uint16_t cqi_PMI_ConfigIndex = @@ -862,7 +863,7 @@ get_csi_params(COMMON_channels_t * cc, // get H if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic. present == - CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) + LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) *H = 1 + (Jtab[cc->mib->message.dl_Bandwidth] * cqi_ReportPeriodic->choice.setup. @@ -874,7 +875,7 @@ get_csi_params(COMMON_channels_t * cc, uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, uint8_t ri, - CQI_ReportModeAperiodic_t * + LTE_CQI_ReportModeAperiodic_t * cqi_ReportModeAperiodic) { int Ntab[6] = { 0, 4, 7, 9, 10, 13 }; @@ -886,7 +887,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, "cqi_ReportPeriodic is null!\n"); switch (*cqi_ReportModeAperiodic) { - case CQI_ReportModeAperiodic_rm12: + case LTE_CQI_ReportModeAperiodic_rm12: AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, "Illegal TM (%d) for CQI_ReportModeAperiodic_rm12\n", @@ -902,7 +903,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, else if (ri > 1 && cc->p_eNB == 4) return (8 + (N << 2)); break; - case CQI_ReportModeAperiodic_rm20: + case LTE_CQI_ReportModeAperiodic_rm20: // Table 5.2.2.6.3-1 (36.212) AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7 || tmode == 9 @@ -914,7 +915,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, "TM9/10 will be handled later for CQI_ReportModeAperiodic_rm20\n"); return (4 + 2 + L); break; - case CQI_ReportModeAperiodic_rm22: + case LTE_CQI_ReportModeAperiodic_rm22: // Table 5.2.2.6.3-2 (36.212) AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -932,7 +933,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, if (ri >= 2 && cc->p_eNB == 4) return (4 + 2 + 4 + 2 + L + 8); break; - case CQI_ReportModeAperiodic_rm30: + case LTE_CQI_ReportModeAperiodic_rm30: // Table 5.2.2.6.2-1 (36.212) AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7 || tmode == 8 || tmode == 9 @@ -944,7 +945,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, "TM8/9/10 will be handled later for CQI_ReportModeAperiodic_rm30\n"); return (4 + (N << 1)); break; - case CQI_ReportModeAperiodic_rm31: + case LTE_CQI_ReportModeAperiodic_rm31: // Table 5.2.2.6.2-2 (36.212) AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -962,8 +963,8 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, else if (ri >= 2 && cc->p_eNB == 4) return (4 + (N << 1) + 4 + (N << 1) + 4); break; -#if (RRC_VERSION >= MAKE_VERSION(12, 5, 0)) - case CQI_ReportModeAperiodic_rm32_v1250: +#if (LTE_RRC_VERSION >= MAKE_VERSION(12, 5, 0)) + case LTE_CQI_ReportModeAperiodic_rm32_v1250: AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, "Illegal TM (%d) for CQI_ReportModeAperiodic_rm32\n", @@ -971,14 +972,14 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm32_v1250 not supported yet\n"); break; - case CQI_ReportModeAperiodic_rm10_v1310: + case LTE_CQI_ReportModeAperiodic_rm10_v1310: // Table 5.2.2.6.1-1F/G (36.212) if (ri == 1) return (4); // F else return (7); // G break; - case CQI_ReportModeAperiodic_rm11_v1310: + case LTE_CQI_ReportModeAperiodic_rm11_v1310: // Table 5.2.2.6.1-1H (36.212) AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -996,7 +997,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, return (4 + 4 + 4); break; -#endif /* #if (RRC_VERSION >= MAKE_VERSION(12, 5, 0)) */ +#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(12, 5, 0)) */ } AssertFatal(1 == 0, "Shouldn't get here\n"); return (0); @@ -1005,7 +1006,7 @@ get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, COMMON_channels_t * cc, uint8_t tmode, - struct CQI_ReportPeriodic * cqi_ReportPeriodic) + struct LTE_CQI_ReportPeriodic * cqi_ReportPeriodic) { int no_pmi = 0; // Ltab[6] = {0,log2(15/4/2),log2(25/4/2),log2(50/6/3),log2(75/8/4),log2(100/8/4)}; @@ -1015,10 +1016,10 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, AssertFatal(cqi_ReportPeriodic != NULL, "cqi_ReportPeriodic is null!\n"); - AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING, + AssertFatal(cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_NOTHING, "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); AssertFatal(cqi_ReportPeriodic->choice. - setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, + setup.cqi_FormatIndicatorPeriodic.present != LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); switch (tmode) { @@ -1033,7 +1034,7 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, no_pmi = 0; } - if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) + if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) || (sched_ctl->feedback_cnt[CC_idP] == 0)) { // send wideband report every opportunity if wideband reporting mode is selected, else every H opportunities if (no_pmi == 1) return (4); @@ -1045,7 +1046,7 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, AssertFatal(1 == 0, "illegal combination p %d, ri %d, no_pmi %d\n", cc->p_eNB, ri, no_pmi); - } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) { + } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) { if ((no_pmi == 1) || ri == 1) return (4 + Ltab[cc->mib->message.dl_Bandwidth]); else return (7 + Ltab[cc->mib->message.dl_Bandwidth]); } @@ -1104,12 +1105,12 @@ program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP, nfapi_ul_config_ulsch_harq_information *ulsch_harq_information = NULL; nfapi_ul_config_harq_information *harq_information = NULL; -#if (RRC_VERSION >= MAKE_VERSION(10, 2, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 2, 0)) if ((UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2) && (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020) && (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10) - && (*UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 == PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true)) + && (*UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 == LTE_PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true)) use_simultaneous_pucch_pusch = 1; #endif @@ -1262,7 +1263,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_ int UE_id = find_UE_id(module_idP, rntiP); - PUSCH_ConfigDedicated_t *puschConfigDedicated; + LTE_PUSCH_ConfigDedicated_t *puschConfigDedicated; // PUSCH_ConfigDedicated_v1020_t *puschConfigDedicated_v1020; // PUSCH_ConfigDedicated_v1130_t *puschConfigDedicated_v1130; // PUSCH_ConfigDedicated_v1250_t *puschConfigDedicated_v1250; @@ -1271,26 +1272,27 @@ fill_nfapi_ulsch_harq_information(module_id_t module_ AssertFatal(UE_list != NULL, "UE_list is null\n"); AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated for rnti %x is null\n", rntiP); - AssertFatal((puschConfigDedicated = (PUSCH_ConfigDedicated_t *) + AssertFatal((puschConfigDedicated = (LTE_PUSCH_ConfigDedicated_t *) UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pusch_ConfigDedicated) != NULL, "physicalConfigDedicated->puschConfigDedicated for rnti %x is null\n", rntiP); -#if (RRC_VERSION >= MAKE_VERSION(10, 2, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 2, 0)) /* if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext2) puschConfigDedicated_v1020 = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext2->pusch_ConfigDedicated_v1020; #endif - #if (RRC_VERSION >= MAKE_VERSION(11, 3, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(11, 3, 0)) if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4) puschConfigDedicated_v1130 = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext4->pusch_ConfigDedicated_v1130; #endif - #if (RRC_VERSION >= MAKE_VERSION(12, 5, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(12, 5, 0)) if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5) puschConfigDedicated_v1250 = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->ext5->pusch_ConfigDedicated_v1250; #endif */ #endif harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index; + harq_information->harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG; AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL, "pucch_ConfigDedicated is null!\n"); if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) - && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) + && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == LTE_PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) harq_information->harq_information_rel10.ack_nack_mode = 1; // multiplexing else harq_information->harq_information_rel10.ack_nack_mode = 0; // bundling @@ -1375,7 +1377,7 @@ fill_nfapi_harq_information(module_id_t module_idP, if (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL && UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL && (UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) - && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) + && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == LTE_PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing @@ -1399,7 +1401,7 @@ fill_nfapi_harq_information(module_id_t module_idP, AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL, "pucch_ConfigDedicated is null for TDD!\n"); if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) - && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { + && (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode == LTE_PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing } else { harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling @@ -1545,7 +1547,7 @@ void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pdu, uint8_t cqi_req, COMMON_channels_t *cc, - struct PhysicalConfigDedicated *physicalConfigDedicated, + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, uint8_t tmode, uint32_t handle, uint16_t rnti, @@ -1616,7 +1618,7 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pd } } -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t * ul_config_pdu, uint8_t ue_type, @@ -1659,12 +1661,12 @@ mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP, sub_frame_t subframeP, int rmax, MPDCCH_TYPES_t mpdcch_type, int UE_id) { - struct PRACH_ConfigSIB_v1310 *ext4_prach = + struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = eNB->common_channels[CC_id].radioResourceConfigCommon_BR-> ext4->prach_ConfigCommon_v1310; int T; - EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11; + LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11; switch (mpdcch_type) { case TYPE0: @@ -1917,7 +1919,7 @@ void dump_ue_list(UE_list_t * listP, int ul_flag) } int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint8_t rach_resource_type #endif ) @@ -1951,7 +1953,7 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0; #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type; #endif @@ -2273,8 +2275,7 @@ uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP) eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; - struct PhysicalConfigDedicated *physicalConfigDedicated = - eNB->UE_list.physicalConfigDedicated[CC_idP][UE_idP]; + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = eNB->UE_list.physicalConfigDedicated[CC_idP][UE_idP]; if (physicalConfigDedicated == NULL) { // RRCConnectionSetup not received by UE yet AssertFatal(cc->p_eNB <= 2, "p_eNB is %d, should be <2\n", @@ -2286,16 +2287,16 @@ uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP) UE_idP); AssertFatal(physicalConfigDedicated->antennaInfo->present != - PhysicalConfigDedicated__antennaInfo_PR_NOTHING, + LTE_PhysicalConfigDedicated__antennaInfo_PR_NOTHING, "antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n", module_idP, CC_idP); if (physicalConfigDedicated->antennaInfo->present == - PhysicalConfigDedicated__antennaInfo_PR_explicitValue) { + LTE_PhysicalConfigDedicated__antennaInfo_PR_explicitValue) { return (physicalConfigDedicated->antennaInfo-> choice.explicitValue.transmissionMode); } else if (physicalConfigDedicated->antennaInfo->present == - PhysicalConfigDedicated__antennaInfo_PR_defaultValue) { + LTE_PhysicalConfigDedicated__antennaInfo_PR_defaultValue) { AssertFatal(cc->p_eNB <= 2, "p_eNB is %d, should be <2\n", cc->p_eNB); return (cc->p_eNB); @@ -3311,7 +3312,7 @@ CCE_allocation_infeasible(int module_idP, return res; } -void get_retransmission_timing(TDD_Config_t *tdd_Config, frame_t *frameP, +void get_retransmission_timing(LTE_TDD_Config_t *tdd_Config, frame_t *frameP, sub_frame_t *subframeP) { @@ -3362,7 +3363,7 @@ uint8_t get_dl_subframe_count(int tdd_config_sfa, sub_frame_t subframeP){ return -1; } -uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP){ +uint8_t frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP){ int harq_pid; if(tdd_Config){ @@ -3383,7 +3384,7 @@ uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, su return -1; } -unsigned char ul_ACK_subframe2M(TDD_Config_t *tdd_Config,unsigned char subframe) +unsigned char ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,unsigned char subframe) { if (tdd_Config == NULL) { @@ -3448,7 +3449,7 @@ unsigned char ul_ACK_subframe2M(TDD_Config_t *tdd_Config,unsigned char subframe) return(0); } -unsigned char ul_ACK_subframe2dl_subframe(TDD_Config_t *tdd_Config,unsigned char subframe,unsigned char ACK_index) +unsigned char ul_ACK_subframe2dl_subframe(LTE_TDD_Config_t *tdd_Config,unsigned char subframe,unsigned char ACK_index) { if (tdd_Config == NULL) { @@ -3532,7 +3533,7 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, int frame_tx; uint8_t harq_pid; -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL && UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL && (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7) @@ -3634,9 +3635,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, AssertFatal(num_ack_nak == 1, "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n", num_ack_nak,frameP,subframeP); - AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, - "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", - harq_pid, UE_id, rnti); + + // In case of nFAPI, sometimes timing of eNB and UE become different. + // So if nfapi_mode == 2(VNF) , this function don't check assertion to avoid process exit. + if (nfapi_mode != 2){ + AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, + "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", + harq_pid, UE_id, rnti); + } else { + if(sched_ctl->round[CC_idP][harq_pid] == 8){ + LOG_E(MAC,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid, UE_id, rnti); + return; + } + } AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n", @@ -4014,7 +4025,7 @@ extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP]; - struct CQI_ReportPeriodic *cqi_ReportPeriodic; + struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic; int no_pmi; uint8_t Ltab[6] = { 0, 2, 4, 4, 4, 4 }; uint8_t Jtab[6] = { 0, 2, 2, 3, 4, 4 }; @@ -4029,10 +4040,10 @@ extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, "cqi_ReportPeriodic is null for UE %d\n", UE_id); // determine feedback mode - AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); - AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); + AssertFatal(cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_NOTHING, + "cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_NOTHING!\n"); + AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, + "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); uint16_t Npd, N_OFFSET_CQI; int H, K, bandwidth_part, L, Lmask; @@ -4066,7 +4077,7 @@ extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, no_pmi = 0; } - if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) + if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) || (feedback_cnt == 0)) { // Note: This implements only Tables: 5.3.3.1-1,5.3.3.1-1A and 5.3.3.1-2 from 36.213 (1,2,4 antenna ports Wideband CQI/PMI) @@ -4099,7 +4110,7 @@ extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, AssertFatal(1 == 0, "illegal combination p %d, ri %d, no_pmi %d\n", cc->p_eNB, ri, no_pmi); - } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) + } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) { // This is Table 5.2.3.3.2-2 for 36.213 if (ri == 1) { @@ -4130,7 +4141,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, int i; uint64_t p = *(uint64_t *) pdu; int curbyte, curbit; - CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic; + LTE_CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic; AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n", UE_id); @@ -4147,7 +4158,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, int m; switch (*cqi_ReportModeAperiodic) { - case CQI_ReportModeAperiodic_rm12: + case LTE_CQI_ReportModeAperiodic_rm12: AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n"); // wideband multiple PMI (TM4/6), Table 5.2.2.6.1-1 (for TM4/6) AssertFatal(tmode == 4 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -4196,7 +4207,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, } break; - case CQI_ReportModeAperiodic_rm20: + case LTE_CQI_ReportModeAperiodic_rm20: AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n"); // UE-selected subband CQI no PMI (TM1/2/3/7) , Table 5.2.2.6.3-1 from 36.213 AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 @@ -4213,7 +4224,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, for (m = 0; m < Mtab_uesel[bw]; m++) sched_ctl->aperiodic_subband_diffcqi0[CC_idP][v[m]] = diffcqi0; break; - case CQI_ReportModeAperiodic_rm22: + case LTE_CQI_ReportModeAperiodic_rm22: AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n"); // UE-selected subband CQI multiple PMI (TM4/6) Table 5.2.2.6.3-2 from 36.213 @@ -4258,7 +4269,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, sched_ctl->aperiodic_subband_pmi[CC_idP][v[m]] = pmi_uesel; } break; - case CQI_ReportModeAperiodic_rm30: + case LTE_CQI_ReportModeAperiodic_rm30: //subband CQI no PMI (TM1/2/3/7) AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7, @@ -4279,7 +4290,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, sched_ctl->dl_cqi[CC_idP] = sched_ctl->aperiodic_wideband_cqi0[CC_idP]; break; - case CQI_ReportModeAperiodic_rm31: + case LTE_CQI_ReportModeAperiodic_rm31: AssertFatal(0 == 1, "to be fixed, don't use p but pdu directly\n"); //subband CQI single PMI (TM4/5/6) AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8 @@ -4350,8 +4361,8 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, } break; -#if (RRC_VERSION >= MAKE_VERSION(12, 5, 0)) - case CQI_ReportModeAperiodic_rm32_v1250: +#if (LTE_RRC_VERSION >= MAKE_VERSION(12, 5, 0)) + case LTE_CQI_ReportModeAperiodic_rm32_v1250: AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -4360,15 +4371,15 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm32 to be done\n"); break; #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 1, 0)) - case CQI_ReportModeAperiodic_rm10_v1310: +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 1, 0)) + case LTE_CQI_ReportModeAperiodic_rm10_v1310: AssertFatal(tmode == 1 || tmode == 2 || tmode == 3 || tmode == 7, "Illegal transmission mode %d for CQI_ReportModeAperiodic_rm10\n", tmode); AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm10 to be done\n"); break; - case CQI_ReportModeAperiodic_rm11_v1310: + case LTE_CQI_ReportModeAperiodic_rm11_v1310: AssertFatal(tmode == 4 || tmode == 5 || tmode == 6 || tmode == 8 || tmode == 9 || tmode == 10, @@ -4376,7 +4387,7 @@ extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, tmode); AssertFatal(1 == 0, "CQI_ReportModeAperiodic_rm11 to be done\n"); break; -#endif /* #if (RRC_VERSION >= MAKE_VERSION(13, 1, 0)) */ +#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(13, 1, 0)) */ } } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index a97525ef86..7a2c605a18 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -51,7 +51,7 @@ #include "pdcp.h" #if defined(ENABLE_ITTI) -#include "intertask_interface.h" + #include "intertask_interface.h" #endif #include "ENB_APP/flexran_agent_defs.h" @@ -76,10 +76,10 @@ extern int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req); extern uint8_t nfapi_mode; // This table holds the allowable PRB sizes for ULSCH transmissions -uint8_t rb_table[34] = - { 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, - 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100 - }; +uint8_t rb_table[34] = { + 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, + 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100 +}; extern mui_t rrc_eNB_mui; @@ -89,10 +89,9 @@ rx_sdu(const module_id_t enb_mod_idP, const frame_t frameP, const sub_frame_t subframeP, const rnti_t rntiP, - uint8_t * sduP, + uint8_t *sduP, const uint16_t sdu_lenP, - const uint16_t timing_advance, const uint8_t ul_cqi) -{ + const uint16_t timing_advance, const uint8_t ul_cqi) { int current_rnti = rntiP; unsigned char rx_ces[MAX_NUM_CE], num_ce, num_sdu, i, *payload_ptr; unsigned char rx_lcids[NB_RB_MAX]; @@ -104,13 +103,12 @@ rx_sdu(const module_id_t enb_mod_idP, int harq_pid = subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP); int lcgid_updated[4] = {0, 0, 0, 0}; - UE_list_t *UE_list = &mac->UE_list; int crnti_rx = 0; RA_t *ra = (RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0]; int first_rb = 0; - + rrc_eNB_ue_context_t *ue_contextP = NULL; start_meas(&mac->rx_ulsch_sdu); if ((UE_id > MAX_MOBILES_PER_ENB) || (UE_id == -1)) @@ -119,23 +117,24 @@ rx_sdu(const module_id_t enb_mod_idP, } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 1); + (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); + 0, 0); LOG_D(OPT, "[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", - enb_mod_idP, frameP, current_rnti, sdu_lenP); + enb_mod_idP, frameP, current_rnti, sdu_lenP); } if (UE_id != -1) { LOG_D(MAC, - "[eNB %d][PUSCH %d] SFN.SF %d.%d : CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n", - enb_mod_idP, harq_pid, frameP,subframeP, CC_idP, - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], - current_rnti, UE_id, ul_cqi); - + "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n", + enb_mod_idP, harq_pid, CC_idP,frameP,subframeP, + UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], + current_rnti, UE_id, ul_cqi); AssertFatal(UE_list->UE_sched_ctrl[UE_id]. - round_UL[CC_idP][harq_pid] < 8, "round >= 8\n"); + round_UL[CC_idP][harq_pid] < 8, "round >= 8\n"); + if (sduP != NULL) { UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0; UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; @@ -145,58 +144,60 @@ rx_sdu(const module_id_t enb_mod_idP, * lte_est_timing_advance_pusch, maybe it's not necessary? * maybe it's even not correct at all? */ - UE_list->UE_sched_ctrl[UE_id].ta_update = (UE_list->UE_sched_ctrl[UE_id].ta_update * 3 + timing_advance) / 4; + UE_list->UE_sched_ctrl[UE_id].ta_update = (UE_list->UE_sched_ctrl[UE_id].ta_update * 3 + timing_advance) / 4; UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi; UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors = 0; first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) { - UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0; - mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, - subframeP, UE_RNTI(enb_mod_idP, - UE_id)); + UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0; + mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, + subframeP, UE_RNTI(enb_mod_idP, + UE_id)); } /* update scheduled bytes */ UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]; + if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0) UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0; - } else { // we've got an error + } else { // we've got an error LOG_I(MAC, - "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d\n", - enb_mod_idP, harq_pid, CC_idP,frameP,subframeP, - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], - ul_cqi); + "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d\n", + enb_mod_idP, harq_pid, CC_idP,frameP,subframeP, + UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], + ul_cqi); - if(ul_cqi>200){ // too high energy pattern + if(ul_cqi>200) { // too high energy pattern UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi; } // AssertFatal(1==0,"ulsch in error\n"); if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) { - UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid)); - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0; - if (UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors++ == 10) - UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1; + UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid)); + UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0; + + if (UE_list->UE_sched_ctrl[UE_id].ul_consecutive_errors++ == 10) + UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 1; /* update scheduled bytes */ UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes -= UE_list->UE_template[CC_idP][UE_id].TBS_UL[harq_pid]; + if (UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes < 0) UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0; if (find_RA_id(enb_mod_idP, CC_idP, current_rnti) != -1) cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); } else - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++; + UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++; first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; - // Program NACK for PHICH LOG_D(MAC, - "Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n", - current_rnti, harq_pid, first_rb); + "Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n", + current_rnti, harq_pid, first_rb); nfapi_hi_dci0_request_t *hi_dci0_req; - uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP); + uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP); hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10]; nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = @@ -213,64 +214,59 @@ rx_sdu(const module_id_t enb_mod_idP, hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, sf_ahead_dl); hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - return; - } - } else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti + } else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti AssertFatal(mac->common_channels[CC_idP]. - radioResourceConfigCommon->rach_ConfigCommon. - maxHARQ_Msg3Tx > 1, - "maxHARQ %d should be greater than 1\n", - (int) mac->common_channels[CC_idP]. - radioResourceConfigCommon->rach_ConfigCommon. - maxHARQ_Msg3Tx); - - LOG_I(MAC, - "[eNB %d][PUSCH %d] SFN.SF %d.%d CC_id %d [RAPROC Msg3] : Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n", - enb_mod_idP, harq_pid, frameP,subframeP,CC_idP, ra[RA_id].msg3_round, - current_rnti, RA_id, ul_cqi); - + radioResourceConfigCommon->rach_ConfigCommon. + maxHARQ_Msg3Tx > 1, + "maxHARQ %d should be greater than 1\n", + (int) mac->common_channels[CC_idP]. + radioResourceConfigCommon->rach_ConfigCommon. + maxHARQ_Msg3Tx); + LOG_D(MAC, + "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n", + enb_mod_idP, harq_pid, CC_idP, ra[RA_id].msg3_round, + current_rnti, RA_id, ul_cqi); first_rb = ra->msg3_first_rb; - if (sduP == NULL) { // we've got an error on Msg3 - LOG_I(MAC, - "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", - enb_mod_idP, CC_idP, RA_id, - ra[RA_id].msg3_round, - (int) mac->common_channels[CC_idP]. - radioResourceConfigCommon->rach_ConfigCommon. - maxHARQ_Msg3Tx); - if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { - cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); - } + if (sduP == NULL) { // we've got an error on Msg3 + LOG_D(MAC, + "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", + enb_mod_idP, CC_idP, RA_id, + ra[RA_id].msg3_round, + (int) mac->common_channels[CC_idP]. + radioResourceConfigCommon->rach_ConfigCommon. + maxHARQ_Msg3Tx); - else { - first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; - ra[RA_id].msg3_round++; - // prepare handling of retransmission + if (ra[RA_id].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 { + first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; + ra[RA_id].msg3_round++; + // prepare handling of retransmission get_Msg3allocret(&mac->common_channels[CC_idP], - ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame, - &ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe); - add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP); + ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame, + &ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe); + add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP); } /* TODO: program NACK for PHICH? */ - return; } } else { LOG_W(MAC, - "Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n", - current_rnti); + "Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n", + current_rnti); return; } + payload_ptr = parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths, sdu_lenP); - if(payload_ptr == NULL){ - LOG_E(MAC,"[eNB %d][PUSCH %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n", - enb_mod_idP, harq_pid, CC_idP,current_rnti, UE_id); - return; + if(payload_ptr == NULL) { + LOG_E(MAC,"[eNB %d][PUSCH %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n", + enb_mod_idP, harq_pid, CC_idP,current_rnti, UE_id); + return; } T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), @@ -280,62 +276,65 @@ rx_sdu(const module_id_t enb_mod_idP, T_INT(current_rnti), T_INT(frameP), T_INT(subframeP), T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu), T_BUFFER(sduP, sdu_lenP)); - mac->eNB_stats[CC_idP].ulsch_bytes_rx = sdu_lenP; mac->eNB_stats[CC_idP].total_ulsch_bytes_rx += sdu_lenP; mac->eNB_stats[CC_idP].total_ulsch_pdus_rx += 1; - UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] = 0; // control element for (i = 0; i < num_ce; i++) { - T(T_ENB_MAC_UE_UL_CE, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP), T_INT(rx_ces[i])); - switch (rx_ces[i]) { // implement and process BSR + CRNTI + - case POWER_HEADROOM: - if (UE_id != -1) { - UE_list->UE_template[CC_idP][UE_id].phr_info = - (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET; - LOG_D(MAC, - "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n", - enb_mod_idP, CC_idP, rx_ces[i], - UE_list->UE_template[CC_idP][UE_id].phr_info); - UE_list->UE_template[CC_idP][UE_id].phr_info_configured = - 1; - UE_list->UE_sched_ctrl[UE_id].phr_received = 1; - } - payload_ptr += sizeof(POWER_HEADROOM_CMD); - break; + switch (rx_ces[i]) { // implement and process BSR + CRNTI + + case POWER_HEADROOM: + if (UE_id != -1) { + UE_list->UE_template[CC_idP][UE_id].phr_info = + (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + (int8_t)(hundred_times_log10_NPRB[UE_list->UE_template[CC_idP][UE_id].nb_rb_ul[harq_pid]-1]/100); - case CRNTI: - { - int old_rnti = - (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1]; - int old_UE_id = find_UE_id(enb_mod_idP, old_rnti); - LOG_D(MAC, - "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", - enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i, - num_ce, old_rnti, old_UE_id); - /* receiving CRNTI means that the current rnti has to go away */ - //cancel_ra_proc(enb_mod_idP, CC_idP, frameP, - // current_rnti); - if (old_UE_id != -1) { - /* TODO: if the UE did random access (followed by a MAC uplink with - * CRNTI) because none of its scheduling request was granted, then - * according to 36.321 5.4.4 the UE's MAC will notify RRC to release - * PUCCH/SRS. According to 36.331 5.3.13 the UE will then apply - * default configuration for CQI reporting and scheduling requests, - * which basically means that the CQI requests won't work anymore and - * that the UE won't do any scheduling request anymore as long as the - * eNB doesn't reconfigure the UE. - * We have to take care of this. As the code is, nothing is done and - * the UE state in the eNB is wrong. - */ + if(UE_list->UE_template[CC_idP][UE_id].phr_info > 40) + UE_list->UE_template[CC_idP][UE_id].phr_info = 40; + + LOG_D(MAC, + "[eNB %d] CC_id %d MAC CE_LCID %d : Received PHR PH = %d (db)\n", + enb_mod_idP, CC_idP, rx_ces[i], + UE_list->UE_template[CC_idP][UE_id].phr_info); + UE_list->UE_template[CC_idP][UE_id].phr_info_configured = + 1; + UE_list->UE_sched_ctrl[UE_id].phr_received = 1; + } + + payload_ptr += sizeof(POWER_HEADROOM_CMD); + break; + + case CRNTI: { + int old_rnti = + (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1]; + int old_UE_id = find_UE_id(enb_mod_idP, old_rnti); + LOG_D(MAC, + "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", + enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i, + num_ce, old_rnti, old_UE_id); + + /* receiving CRNTI means that the current rnti has to go away */ + //cancel_ra_proc(enb_mod_idP, CC_idP, frameP, + // current_rnti); + if (old_UE_id != -1) { + /* TODO: if the UE did random access (followed by a MAC uplink with + * CRNTI) because none of its scheduling request was granted, then + * according to 36.321 5.4.4 the UE's MAC will notify RRC to release + * PUCCH/SRS. According to 36.331 5.3.13 the UE will then apply + * default configuration for CQI reporting and scheduling requests, + * which basically means that the CQI requests won't work anymore and + * that the UE won't do any scheduling request anymore as long as the + * eNB doesn't reconfigure the UE. + * We have to take care of this. As the code is, nothing is done and + * the UE state in the eNB is wrong. + */ for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { ra = &mac->common_channels[CC_idP].ra[ii]; + if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { mac_rrc_data_ind(enb_mod_idP, CC_idP, @@ -350,7 +349,6 @@ rx_sdu(const module_id_t enb_mod_idP, LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) RRCConnectionReconfiguration(Msg4)\n", enb_mod_idP, frameP, subframeP, CC_idP, old_rnti, old_UE_id); - UE_id = old_UE_id; current_rnti = old_rnti; ra->rnti = old_rnti; @@ -360,11 +358,13 @@ rx_sdu(const module_id_t enb_mod_idP, UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0; UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; + if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) { UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0; mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, subframeP, old_rnti); } + UE_list->UE_template[CC_idP][UE_id].ul_SR = 1; UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 1; break; @@ -373,368 +373,378 @@ rx_sdu(const module_id_t enb_mod_idP, } else { cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti); } - crnti_rx = 1; - payload_ptr += 2; - break; + + crnti_rx = 1; + payload_ptr += 2; + break; } - case TRUNCATED_BSR: - case SHORT_BSR: - { - uint8_t lcgid; - lcgid = (payload_ptr[0] >> 6); + case TRUNCATED_BSR: + case SHORT_BSR: { + uint8_t lcgid; + lcgid = (payload_ptr[0] >> 6); + LOG_D(MAC, + "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n", + enb_mod_idP, CC_idP, rx_ces[i], lcgid, + payload_ptr[0] & 0x3f); - LOG_D(MAC, - "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n", - enb_mod_idP, CC_idP, rx_ces[i], lcgid, - payload_ptr[0] & 0x3f); + if (crnti_rx == 1) + LOG_D(MAC, + "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n", + enb_mod_idP, CC_idP, rx_ces[i], lcgid, + payload_ptr[0] & 0x3f); - if (crnti_rx == 1) - LOG_D(MAC, - "[eNB %d] CC_id %d MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n", - enb_mod_idP, CC_idP, rx_ces[i], lcgid, - payload_ptr[0] & 0x3f); - if (UE_id != -1) { + if (UE_id != -1) { int bsr = payload_ptr[0] & 0x3f; - lcgid_updated[lcgid] = 1; - // update buffer info UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid] = BSR_TABLE[bsr]; - UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]; - //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; - - RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f); - if (UE_id == UE_list->head) - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR, - RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr - [UE_id][(frameP * 10) + subframeP]); - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] = frameP; - } - if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED) - LOG_D(MAC, - "[eNB %d] CC_id %d MAC CE_LCID %d : estimated_ul_buffer = %d (lcg increment %d)\n", - enb_mod_idP, CC_idP, rx_ces[i], - UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer, - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]); - } else { - - } - payload_ptr += 1; //sizeof(SHORT_BSR); // fixme - } - break; - - case LONG_BSR: - if (UE_id != -1) { - int bsr0 = (payload_ptr[0] & 0xFC) >> 2; - int bsr1 = ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4); - int bsr2 = ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6); - int bsr3 = payload_ptr[2] & 0x3F; - - lcgid_updated[LCGID0] = 1; - lcgid_updated[LCGID1] = 1; - lcgid_updated[LCGID2] = 1; - lcgid_updated[LCGID3] = 1; - - // update buffer info - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] = BSR_TABLE[bsr0]; - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] = BSR_TABLE[bsr1]; - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] = BSR_TABLE[bsr2]; - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] = BSR_TABLE[bsr3]; - - UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]; - //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; + //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; + RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f); - LOG_D(MAC, - "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = " - "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP, - rx_ces[i], - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0], - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1], - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2], - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]); - if (crnti_rx == 1) + if (UE_id == UE_list->head) + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR, + RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr + [UE_id][(frameP * 10) + subframeP]); + + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] = frameP; + } + + if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP, UE_id)) < RRC_CONNECTED) + LOG_D(MAC, + "[eNB %d] CC_id %d MAC CE_LCID %d : estimated_ul_buffer = %d (lcg increment %d)\n", + enb_mod_idP, CC_idP, rx_ces[i], + UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer, + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]); + } else { + } + + payload_ptr += 1; //sizeof(SHORT_BSR); // fixme + } + break; + + case LONG_BSR: + if (UE_id != -1) { + int bsr0 = (payload_ptr[0] & 0xFC) >> 2; + int bsr1 = ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4); + int bsr2 = ((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6); + int bsr3 = payload_ptr[2] & 0x3F; + lcgid_updated[LCGID0] = 1; + lcgid_updated[LCGID1] = 1; + lcgid_updated[LCGID2] = 1; + lcgid_updated[LCGID3] = 1; + // update buffer info + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] = BSR_TABLE[bsr0]; + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] = BSR_TABLE[bsr1]; + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] = BSR_TABLE[bsr2]; + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] = BSR_TABLE[bsr3]; + UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]; + //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = " - "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, - CC_idP, rx_ces[i], + "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP, + rx_ces[i], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2], UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]); - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = 0; - } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = frameP; - } + if (crnti_rx == 1) + LOG_D(MAC, + "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = " + "%u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, + CC_idP, rx_ces[i], + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0], + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1], + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2], + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3]); - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = 0; - } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = frameP; - } + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID0] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = 0; + } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID0] = frameP; + } - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = 0; - } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = frameP; - } + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID1] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = 0; + } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID1] = frameP; + } - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = 0; - } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] == 0) { - UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = frameP; + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID2] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = 0; + } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID2] = frameP; + } - } - } + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[LCGID3] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = 0; + } else if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] == 0) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[LCGID3] = frameP; + } + } - payload_ptr += 3; ////sizeof(LONG_BSR); - break; + payload_ptr += 3; ////sizeof(LONG_BSR); + break; - default: - LOG_E(MAC, - "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n", - enb_mod_idP, CC_idP, rx_ces[i]); - break; + default: + LOG_E(MAC, + "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n", + enb_mod_idP, CC_idP, rx_ces[i]); + break; } } for (i = 0; i < num_sdu; i++) { LOG_D(MAC, "SDU Number %d MAC Subheader SDU_LCID %d, length %d\n", - i, rx_lcids[i], rx_lengths[i]); - + i, rx_lcids[i], rx_lengths[i]); T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP), T_INT(rx_lcids[i]), T_INT(rx_lengths[i])); T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP), T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, - rx_lengths - [i])); + rx_lengths + [i])); switch (rx_lcids[i]) { - case CCCH: - if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) { - LOG_E(MAC, - "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", - enb_mod_idP, CC_idP, frameP, rx_lengths[i], - CCCH_PAYLOAD_SIZE_MAX, sdu_lenP); - break; - } - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n", - enb_mod_idP, CC_idP, frameP, payload_ptr[0], - payload_ptr[1], payload_ptr[2], payload_ptr[3], - payload_ptr[4], payload_ptr[5], current_rnti); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 1); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 0); - for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { - RA_t *ra = &mac->common_channels[CC_idP].ra[ii]; - - LOG_D(MAC, - "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n", - enb_mod_idP, CC_idP, ii, ra->rnti, - current_rnti, ra->state); - - if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { - - //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len); - - if (UE_id < 0) { - memcpy(&ra->cont_res_id[0], payload_ptr, 6); - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n", - enb_mod_idP, CC_idP, frameP, rx_lengths[i], - payload_ptr - sduP); - - if ((UE_id = add_new_ue(enb_mod_idP, CC_idP, - mac->common_channels[CC_idP]. - ra[ii].rnti, harq_pid -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - , - mac->common_channels[CC_idP]. - ra[ii].rach_resource_type -#endif - )) == -1) { - LOG_E(MAC,"[MAC][eNB] Max user count reached\n"); - cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti); - break; - // kill RA procedure - } else - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", - enb_mod_idP, CC_idP, frameP, ra->rnti, - UE_id); - } else { - LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n", - enb_mod_idP, CC_idP, frameP, UE_id, - rx_lengths[i], payload_ptr - sduP); - // kill RA procedure - } - - mac_rrc_data_ind(enb_mod_idP, - CC_idP, - frameP, subframeP, - current_rnti, - CCCH, - (uint8_t *) payload_ptr, - rx_lengths[i], - 0); - - - if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest - // process_ra_message(msg3,num_ce,rx_lcids,rx_ces); - } - // prepare transmission of Msg4 - ra->state = MSG4; - - - - if(mac->common_channels[CC_idP].tdd_Config!=NULL){ - switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment){ - case 1: - ra->Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0); - ra->Msg4_subframe = (subframeP + 7) % 10; - break; - default: printf("%s:%d: TODO\n", __FILE__, __LINE__); abort(); - // TODO need to be complete for other tdd configs. - } - }else{ - // Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different - ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0); - ra->Msg4_subframe = (subframeP + 4) % 10; - } - - UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; - } // if process is active - } // loop on RA processes - - break; - - case DCCH: - case DCCH1: - // if(eNB_mac_inst[module_idP][CC_idP].Dcch_lchan[UE_id].Active==1){ - - -#if defined(ENABLE_MAC_PAYLOAD_DEBUG) - LOG_T(MAC, "offset: %d\n", - (unsigned char) ((unsigned char *) payload_ptr - sduP)); - for (j = 0; j < 32; j++) { - LOG_T(MAC, "%x ", payload_ptr[j]); - } - LOG_T(MAC, "\n"); -#endif - - if (UE_id != -1) { - if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) { - // adjust buffer occupancy of the correponding logical channel group - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i]) - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i]; - else - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0; - - UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3]; - //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; + case CCCH: + if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) { + LOG_E(MAC, + "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", + enb_mod_idP, CC_idP, frameP, rx_lengths[i], + CCCH_PAYLOAD_SIZE_MAX, sdu_lenP); + break; } - LOG_D(MAC, - "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n", - enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id, - rx_lcids[i]); + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n", + enb_mod_idP, CC_idP, frameP, payload_ptr[0], + payload_ptr[1], payload_ptr[2], payload_ptr[3], + payload_ptr[4], payload_ptr[5], current_rnti); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC, 0); - mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status); - UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1; - UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i]; + for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { + RA_t *ra = &mac->common_channels[CC_idP].ra[ii]; + LOG_D(MAC, + "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n", + enb_mod_idP, CC_idP, ii, ra->rnti, + current_rnti, ra->state); + if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { + //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len); + if (UE_id < 0) { + memcpy(&ra->cont_res_id[0], payload_ptr, 6); + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n", + enb_mod_idP, CC_idP, frameP, rx_lengths[i], + payload_ptr - sduP); - } - - /* UE_id != -1 */ - // } - break; - - // all the DRBS - case DTCH: - default: - -#if defined(ENABLE_MAC_PAYLOAD_DEBUG) - LOG_T(MAC, "offset: %d\n", - (unsigned char) ((unsigned char *) payload_ptr - sduP)); - for (j = 0; j < 32; j++) { - LOG_T(MAC, "%x ", payload_ptr[j]); - } - LOG_T(MAC, "\n"); + if ((UE_id = add_new_ue(enb_mod_idP, CC_idP, + mac->common_channels[CC_idP]. + ra[ii].rnti, harq_pid +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + , + mac->common_channels[CC_idP]. + ra[ii].rach_resource_type #endif - if (rx_lcids[i] < NB_RB_MAX) { - LOG_D(MAC, - "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n", - enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id, - rx_lcids[i]); + )) == -1) { + LOG_E(MAC,"[MAC][eNB] Max user count reached\n"); + cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti); + break; + // kill RA procedure + } else + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", + enb_mod_idP, CC_idP, frameP, ra->rnti, + UE_id); + } else { + LOG_D(MAC, + "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n", + enb_mod_idP, CC_idP, frameP, UE_id, + rx_lengths[i], payload_ptr - sduP); + // kill RA procedure + } - if (UE_id != -1) { - // adjust buffer occupancy of the correponding logical channel group - LOG_D(MAC, - "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %ld, %d\n", - enb_mod_idP, CC_idP, frameP, rx_lengths[i], - UE_id, rx_lcids[i], - UE_list->UE_template[CC_idP][UE_id]. - lcgidmap[rx_lcids[i]], - UE_list->UE_template[CC_idP][UE_id]. - ul_buffer_info[UE_list->UE_template[CC_idP] - [UE_id].lcgidmap[rx_lcids[i]]]); + mac_rrc_data_ind(enb_mod_idP, + CC_idP, + frameP, subframeP, + current_rnti, + CCCH, + (uint8_t *) payload_ptr, + rx_lengths[i], + 0); + if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest + // process_ra_message(msg3,num_ce,rx_lcids,rx_ces); + } + + // prepare transmission of Msg4 + ra->state = MSG4; + + if(mac->common_channels[CC_idP].tdd_Config!=NULL) { + switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment) { + case 1: + ra->Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0); + ra->Msg4_subframe = (subframeP + 7) % 10; + break; + + default: + printf("%s:%d: TODO\n", __FILE__, __LINE__); + abort(); + // TODO need to be complete for other tdd configs. + } + } else { + // Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different + ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0); + ra->Msg4_subframe = (subframeP + 4) % 10; + } + + UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; + } // if process is active + } // loop on RA processes + + break; + + case DCCH: + case DCCH1: + // if(eNB_mac_inst[module_idP][CC_idP].Dcch_lchan[UE_id].Active==1){ +#if defined(ENABLE_MAC_PAYLOAD_DEBUG) + LOG_T(MAC, "offset: %d\n", + (unsigned char) ((unsigned char *) payload_ptr - sduP)); + + for (j = 0; j < 32; j++) { + LOG_T(MAC, "%x ", payload_ptr[j]); + } + + LOG_T(MAC, "\n"); +#endif + + if (UE_id != -1) { if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) { - if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i]) - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i]; - else - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0; + // adjust buffer occupancy of the correponding logical channel group + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i]) + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i]; + else + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0; UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] + - UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3]; + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3]; //UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer += UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer / 4; } - if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block - mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status); + LOG_D(MAC, + "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d \n", + enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id, + rx_lcids[i]); + mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status); + UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1; + UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i]; + } - UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1; - UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i]; - //clear uplane_inactivity_timer - UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; - } else { /* rx_length[i] */ - UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; - LOG_E(MAC, - "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ", - enb_mod_idP, CC_idP, frameP, rx_lcids[i], - UE_id); - } - } else { /*(UE_id != -1 */ - LOG_E(MAC, - "[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ", - enb_mod_idP, CC_idP, frameP, rx_lcids[i], UE_id); - } - } + /* UE_id != -1 */ + // } + break; - break; + // all the DRBS + case DTCH: + default: +#if defined(ENABLE_MAC_PAYLOAD_DEBUG) + LOG_T(MAC, "offset: %d\n", + (unsigned char) ((unsigned char *) payload_ptr - sduP)); + + for (j = 0; j < 32; j++) { + LOG_T(MAC, "%x ", payload_ptr[j]); + } + + LOG_T(MAC, "\n"); +#endif + + if (rx_lcids[i] < NB_RB_MAX) { + LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + UE_id, + rx_lcids[i]); + + if (UE_id != -1) { + // adjust buffer occupancy of the correponding logical channel group + LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %ld, %d\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + UE_id, + rx_lcids[i], + UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]], + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]]); + + if (lcgid_updated[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] == 0) { + if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] >= rx_lengths[i]) { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] -= rx_lengths[i]; + } else { + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[UE_list->UE_template[CC_idP][UE_id].lcgidmap[rx_lcids[i]]] = 0; + } + + UE_list->UE_template[CC_idP][UE_id].estimated_ul_buffer = + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[0] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[1] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[2] + + UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[3]; + } + + if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block + mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); + UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1; + UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i]; + //clear uplane_inactivity_timer + UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; + // reset RRC inactivity timer after uplane activity + ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], current_rnti); + if (ue_contextP != NULL) { + ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + } else { + LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", + enb_mod_idP, + CC_idP, + current_rnti); + } + } else { /* rx_length[i] */ + UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; + LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ", + enb_mod_idP, + CC_idP, + frameP, + rx_lcids[i], + UE_id); + } + } else { // end if (UE_id != -1) + LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ", + enb_mod_idP, + CC_idP, + frameP, + rx_lcids[i], + UE_id); + } + } + + break; } payload_ptr += rx_lengths[i]; @@ -742,14 +752,13 @@ rx_sdu(const module_id_t enb_mod_idP, // Program ACK for PHICH LOG_D(MAC, - "Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n", - current_rnti, harq_pid, first_rb); + "Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n", + current_rnti, harq_pid, first_rb); nfapi_hi_dci0_request_t *hi_dci0_req; - uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP); + uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP); hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10]; - -nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; + nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); @@ -769,6 +778,7 @@ nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_b if ((num_sdu == 0) && (num_ce == 0)) { if (UE_id != -1) UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_errors_rx += 1; + /* if (msg3_flagP != NULL) { if( *msg3_flagP == 1 ) { @@ -788,8 +798,7 @@ nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_b stop_meas(&mac->rx_ulsch_sdu); } -uint32_t bytes_to_bsr_index(int32_t nbytes) -{ +uint32_t bytes_to_bsr_index(int32_t nbytes) { uint32_t i = 0; if (nbytes < 0) { @@ -805,30 +814,26 @@ uint32_t bytes_to_bsr_index(int32_t nbytes) void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, - sub_frame_t subframeP, UE_ULSCH_STATUS status) -{ + sub_frame_t subframeP, UE_ULSCH_STATUS status) { eNB_ulsch_info[module_idP][CC_id][UE_id].rnti = UE_RNTI(module_idP, UE_id); eNB_ulsch_info[module_idP][CC_id][UE_id].subframe = subframeP; eNB_ulsch_info[module_idP][CC_id][UE_id].status = status; - eNB_ulsch_info[module_idP][CC_id][UE_id].serving_num++; } unsigned char *parse_ulsch_header(unsigned char *mac_header, - unsigned char *num_ce, - unsigned char *num_sdu, - unsigned char *rx_ces, - unsigned char *rx_lcids, - unsigned short *rx_lengths, - unsigned short tb_length) -{ + unsigned char *num_ce, + unsigned char *num_sdu, + unsigned char *rx_ces, + unsigned char *rx_lcids, + unsigned short *rx_lengths, + unsigned short tb_length) { unsigned char not_done = 1, num_ces = 0, num_sdus = - 0, lcid, num_sdu_cnt; + 0, lcid, num_sdu_cnt; unsigned char *mac_header_ptr = mac_header; unsigned short length, ce_len = 0; while (not_done == 1) { - if (((SCH_SUBHEADER_FIXED *) mac_header_ptr)->E == 0) { not_done = 0; } @@ -836,62 +841,61 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header, lcid = ((SCH_SUBHEADER_FIXED *) mac_header_ptr)->LCID; if (lcid < EXTENDED_POWER_HEADROOM) { - if (not_done == 0) { // last MAC SDU, length is implicit - mac_header_ptr++; - length = tb_length - (mac_header_ptr - mac_header) - ce_len; + if (not_done == 0) { // last MAC SDU, length is implicit + mac_header_ptr++; + length = tb_length - (mac_header_ptr - mac_header) - ce_len; - for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus; - num_sdu_cnt++) { - length -= rx_lengths[num_sdu_cnt]; - } + for (num_sdu_cnt = 0; num_sdu_cnt < num_sdus; + num_sdu_cnt++) { + length -= rx_lengths[num_sdu_cnt]; + } } else { - if (((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F == 0) { - length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L; - mac_header_ptr += 2; //sizeof(SCH_SUBHEADER_SHORT); - } else { // F = 1 - length = - ((((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB & - 0x7f) << 8) | (((SCH_SUBHEADER_LONG *) - mac_header_ptr)->L_LSB & 0xff); - mac_header_ptr += 3; //sizeof(SCH_SUBHEADER_LONG); - } + if (((SCH_SUBHEADER_SHORT *) mac_header_ptr)->F == 0) { + length = ((SCH_SUBHEADER_SHORT *) mac_header_ptr)->L; + mac_header_ptr += 2; //sizeof(SCH_SUBHEADER_SHORT); + } else { // F = 1 + length = + ((((SCH_SUBHEADER_LONG *) mac_header_ptr)->L_MSB & + 0x7f) << 8) | (((SCH_SUBHEADER_LONG *) + mac_header_ptr)->L_LSB & 0xff); + mac_header_ptr += 3; //sizeof(SCH_SUBHEADER_LONG); + } } LOG_D(MAC, - "[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n", - num_sdus, lcid, tb_length, length, - mac_header_ptr - mac_header); + "[eNB] sdu %d lcid %d tb_length %d length %d (offset now %ld)\n", + num_sdus, lcid, tb_length, length, + mac_header_ptr - mac_header); rx_lcids[num_sdus] = lcid; rx_lengths[num_sdus] = length; num_sdus++; - } else { // This is a control element subheader POWER_HEADROOM, BSR and CRNTI + } else { // This is a control element subheader POWER_HEADROOM, BSR and CRNTI if (lcid == SHORT_PADDING) { - mac_header_ptr++; + mac_header_ptr++; } else { - rx_ces[num_ces] = lcid; - num_ces++; - mac_header_ptr++; + rx_ces[num_ces] = lcid; + num_ces++; + mac_header_ptr++; - if (lcid == LONG_BSR) { - ce_len += 3; - } else if (lcid == CRNTI) { - ce_len += 2; - } else if ((lcid == POWER_HEADROOM) - || (lcid == TRUNCATED_BSR) - || (lcid == SHORT_BSR)) { - ce_len++; - } else { - LOG_E(MAC, "unknown CE %d \n", lcid); - //AssertFatal(1 == 0, "unknown CE"); + if (lcid == LONG_BSR) { + ce_len += 3; + } else if (lcid == CRNTI) { + ce_len += 2; + } else if ((lcid == POWER_HEADROOM) + || (lcid == TRUNCATED_BSR) + || (lcid == SHORT_BSR)) { + ce_len++; + } else { + LOG_E(MAC, "unknown CE %d \n", lcid); + //AssertFatal(1 == 0, "unknown CE"); return NULL; - } + } } } } *num_ce = num_ces; *num_sdu = num_sdus; - return (mac_header_ptr); } @@ -902,18 +906,18 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header, */ void set_msg3_subframe(module_id_t mod_id, - int CC_id, - int frame, - int subframe, int rnti, int Msg3_frame, - int Msg3_subframe) -{ + int CC_id, + int frame, + int subframe, int rnti, int Msg3_frame, + int Msg3_subframe) { eNB_MAC_INST *mac = RC.mac[mod_id]; int i; + for (i = 0; i < NB_RA_PROC_MAX; i++) { if (mac->common_channels[CC_id].ra[i].state != IDLE && - mac->common_channels[CC_id].ra[i].rnti == rnti) { + mac->common_channels[CC_id].ra[i].rnti == rnti) { mac->common_channels[CC_id].ra[i].Msg3_subframe = - Msg3_subframe; + Msg3_subframe; break; } } @@ -921,90 +925,105 @@ set_msg3_subframe(module_id_t mod_id, void schedule_ulsch(module_id_t module_idP, frame_t frameP, - sub_frame_t subframeP) -{ + sub_frame_t subframeP) { uint16_t first_rb[NFAPI_CC_MAX], i; int CC_id; eNB_MAC_INST *mac = RC.mac[module_idP]; slice_info_t *sli = &RC.mac[module_idP]->slice_info; COMMON_channels_t *cc; - start_meas(&mac->schedule_ulsch); - int sched_frame=frameP; int sched_subframe = (subframeP + 4) % 10; - cc = &mac->common_channels[0]; int tdd_sfa; + // for TDD: check subframes where we have to act and return if nothing should be done now if (cc->tdd_Config) { tdd_sfa = cc->tdd_Config->subframeAssignment; - switch (subframeP) { - case 0: - if ((tdd_sfa == 0) || (tdd_sfa == 3)) - sched_subframe = 4; - else if (tdd_sfa == 6) - sched_subframe = 7; - else - return; - break; - case 1: - if ((tdd_sfa == 0) || (tdd_sfa == 1)) - sched_subframe = 7; - else if (tdd_sfa == 6) - sched_subframe = 8; - else - return; - break; - default: - return; - case 2: // Don't schedule UL in subframe 2 for TDD - return; - case 3: - if (tdd_sfa == 2) - sched_subframe = 7; - else - return; - break; - case 4: - if (tdd_sfa == 1) - sched_subframe = 8; - else - return; - break; - case 5: - if (tdd_sfa == 0) - sched_subframe = 9; - else if (tdd_sfa == 6) - sched_subframe = 2; - else - return; - break; - case 6: - if (tdd_sfa == 0 || tdd_sfa == 1) - sched_subframe = 2; - else if (tdd_sfa == 6) - sched_subframe = 3; - else - return; - break; - case 7: - return; - case 8: - if ((tdd_sfa >= 2) && (tdd_sfa <= 5)) - sched_subframe = 2; - else + switch (subframeP) { + case 0: + if ((tdd_sfa == 0) || (tdd_sfa == 3)) + sched_subframe = 4; + else if (tdd_sfa == 6) + sched_subframe = 7; + else + return; + + break; + + case 1: + if ((tdd_sfa == 0) || (tdd_sfa == 1)) + sched_subframe = 7; + else if (tdd_sfa == 6) + sched_subframe = 8; + else + return; + + break; + + default: return; - break; - case 9: - if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4)) - sched_subframe = 3; - else if (tdd_sfa == 6) - sched_subframe = 4; - else + + case 2: // Don't schedule UL in subframe 2 for TDD return; - break; + + case 3: + if (tdd_sfa == 2) + sched_subframe = 7; + else + return; + + break; + + case 4: + if (tdd_sfa == 1) + sched_subframe = 8; + else + return; + + break; + + case 5: + if (tdd_sfa == 0) + sched_subframe = 9; + else if (tdd_sfa == 6) + sched_subframe = 2; + else + return; + + break; + + case 6: + if (tdd_sfa == 0 || tdd_sfa == 1) + sched_subframe = 2; + else if (tdd_sfa == 6) + sched_subframe = 3; + else + return; + + break; + + case 7: + return; + + case 8: + if ((tdd_sfa >= 2) && (tdd_sfa <= 5)) + sched_subframe = 2; + else + return; + + break; + + case 9: + if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4)) + sched_subframe = 3; + else if (tdd_sfa == 6) + sched_subframe = 4; + else + return; + + break; } } @@ -1029,10 +1048,12 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, for (i = 0; i < NB_RA_PROC_MAX; i++) { if ((cc->ra[i].state == WAITMSG3) && - (cc->ra[i].Msg3_subframe == sched_subframe)) { - first_rb[CC_id]++; - // cc->ray[i].Msg3_subframe = -1; - break; + (cc->ra[i].Msg3_subframe == sched_subframe)) { + if (first_rb[CC_id] < cc->ra[i].msg3_first_rb + cc->ra[i].msg3_nb_rb) + first_rb[CC_id] = cc->ra[i].msg3_first_rb + cc->ra[i].msg3_nb_rb; + + // cc->ray[i].Msg3_subframe = -1; + break; } } } @@ -1047,11 +1068,10 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, void schedule_ulsch_rnti(module_id_t module_idP, - int slice_idx, - frame_t frameP, - sub_frame_t subframeP, - unsigned char sched_subframeP, uint16_t * first_rb) -{ + int slice_idx, + frame_t frameP, + sub_frame_t subframeP, + unsigned char sched_subframeP, uint16_t *first_rb) { int UE_id; uint8_t aggregation = 2; rnti_t rnti = -1; @@ -1079,56 +1099,55 @@ schedule_ulsch_rnti(module_id_t module_idP, int first_rb_slice[NFAPI_CC_MAX]; if (sched_subframeP < subframeP) - sched_frame++; + sched_frame++; nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id][subframeP]; nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; - nfapi_ul_config_request_t *ul_req_tmp = &mac->UL_req_tmp[CC_id][sched_subframeP]; nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body; nfapi_ul_config_ulsch_harq_information *ulsch_harq_information; - for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; ++CC_id) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; ++CC_id) { N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth); - UE_list->first_rb_offset[CC_id][slice_idx] = cmin(N_RB_UL, sli->ul[slice_idx].first_rb); - } + UE_list->first_rb_offset[CC_id][slice_idx] = cmin(N_RB_UL, sli->ul[slice_idx].first_rb); + } //LOG_D(MAC, "entering ulsch preprocesor\n"); ulsch_scheduler_pre_processor(module_idP, slice_idx, frameP, subframeP, sched_subframeP, first_rb); - for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; ++CC_id) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; ++CC_id) { first_rb_slice[CC_id] = first_rb[CC_id] + UE_list->first_rb_offset[CC_id][slice_idx]; } - //LOG_D(MAC, "exiting ulsch preprocesor\n"); + //LOG_D(MAC, "exiting ulsch preprocesor\n"); hi_dci0_req->sfn_sf = (frameP << 4) + subframeP; // loop over all active UEs for (UE_id = UE_list->head_ul; UE_id >= 0; UE_id = UE_list->next_ul[UE_id]) { - if (!ue_ul_slice_membership(module_idP, UE_id, slice_idx)) - continue; + continue; // don't schedule if Msg4 is not received yet if (UE_list->UE_template[UE_PCCID(module_idP, UE_id)][UE_id]. configured == FALSE) { - LOG_D(MAC, - "[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", - module_idP, frameP, subframeP, UE_id); - continue; + LOG_D(MAC, + "[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", + module_idP, frameP, subframeP, UE_id); + continue; } rnti = UE_RNTI(module_idP, UE_id); if (rnti == NOT_A_RNTI) { LOG_W(MAC, "[eNB %d] frame %d subfarme %d, UE %d: no RNTI \n", - module_idP, frameP, subframeP, UE_id); + module_idP, frameP, subframeP, UE_id); continue; } drop_ue = 0; + /* let's drop the UE if get_eNB_UE_stats returns NULL when calling it with any of the UE's active UL CCs */ /* TODO: refine? @@ -1144,6 +1163,7 @@ schedule_ulsch_rnti(module_id_t module_idP, if (drop_ue == 1) { /* we can't come here, ulsch_scheduler_pre_processor won't put in the list a UE with no PHY context */ abort(); + /* TODO: this is a hack. Sometimes the UE has no PHY context but * is still present in the MAC with 'ul_failure_timer' = 0 and * 'ul_out_of_sync' = 0. It seems wrong and the UE stays there forever. Let's @@ -1152,18 +1172,20 @@ schedule_ulsch_rnti(module_id_t module_idP, * In the meantime, this hack... */ if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer == 0 && - UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0) { - LOG_W(MAC, - "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: UE in weird state, let's put it 'out of sync'\n", - module_idP, frameP, subframeP, UE_id, rnti, CC_id); - // inform RRC of failure and clear timer - mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, - subframeP, rnti); - UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; - UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1; + UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 0) { + LOG_W(MAC, + "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: UE in weird state, let's put it 'out of sync'\n", + module_idP, frameP, subframeP, UE_id, rnti, CC_id); + // inform RRC of failure and clear timer + mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, + subframeP, rnti); + UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; + UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1; } + continue; } + // loop over all active UL CC_ids for this UE for (n = 0; n < UE_list->numactiveULCCs[UE_id]; n++) { // This is the actual CC_id in the list @@ -1171,416 +1193,421 @@ schedule_ulsch_rnti(module_id_t module_idP, N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth); /* - aggregation=get_aggregation(get_bw_index(module_idP,CC_id), - eNB_UE_stats->dl_cqi, - format0); + aggregation=get_aggregation(get_bw_index(module_idP,CC_id), + eNB_UE_stats->dl_cqi, + format0); */ if (CCE_allocation_infeasible - (module_idP, CC_id, 1, subframeP, aggregation, rnti)) { - LOG_W(MAC, - "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: not enough nCCE\n", - module_idP, frameP, subframeP, UE_id, rnti, CC_id); - continue; // break; + (module_idP, CC_id, 1, subframeP, aggregation, rnti)) { + LOG_W(MAC, + "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: not enough nCCE\n", + module_idP, frameP, subframeP, UE_id, rnti, CC_id); + continue; // break; } /* be sure that there are some free RBs */ if (first_rb_slice[CC_id] >= N_RB_UL - 1) { - LOG_W(MAC, - "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", - module_idP, frameP, subframeP, UE_id, rnti, CC_id); - continue; + LOG_W(MAC, + "[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", + module_idP, frameP, subframeP, UE_id, rnti, CC_id); + continue; } - // if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel + // if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel UE_template = &UE_list->UE_template[CC_id][UE_id]; UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; harq_pid = subframe2harqpid(&cc[CC_id], sched_frame, sched_subframeP); round = UE_sched_ctrl->round_UL[CC_id][harq_pid]; AssertFatal(round < 8, "round %d > 7 for UE %d/%x\n", round, - UE_id, rnti); + UE_id, rnti); LOG_D(MAC, - "[eNB %d] frame %d subframe %d (sched_frame %d, sched_subframe %d), Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", - module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti, - CC_id, aggregation, N_RB_UL); - + "[eNB %d] frame %d subframe %d (sched_frame %d, sched_subframe %d), Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", + module_idP, frameP, subframeP, sched_frame, sched_subframeP, harq_pid, UE_id, rnti, + CC_id, aggregation, 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,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP * - 10) + - subframeP]); - if (UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0 || round > 0) // || ((frameP%10)==0)) - // 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 10 frames - { - LOG_D(MAC, - "[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %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, 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 - UE_template->ul_SR = 0; - status = mac_eNB_get_rrc_status(module_idP, rnti); - cqi_req = 0; + 10) + + subframeP]); - if (status >= RRC_CONNECTED && UE_sched_ctrl->cqi_req_timer > 30) { - if (UE_sched_ctrl->cqi_received == 0) { - if (nfapi_mode) { - cqi_req = 0; - } else { - cqi_req = 1; - // To be safe , do not ask CQI in special Subframes:36.213/7.2.3 CQI definition - if (cc[CC_id].tdd_Config) { - switch (cc[CC_id].tdd_Config->subframeAssignment) { - case 1: - if( subframeP == 1 || subframeP == 6 ) cqi_req=0; - break; - case 3: - if( subframeP == 1 ) cqi_req=0; - break; - default: - LOG_E(MAC," TDD config not supported\n"); - break; - } - } - if(cqi_req == 1) UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP; - } - } - else if (UE_sched_ctrl->cqi_received == 1) { - UE_sched_ctrl->cqi_req_flag = 0; - UE_sched_ctrl->cqi_received = 0; - UE_sched_ctrl->cqi_req_timer = 0; - } - } + if (UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0 || round > 0) // || ((frameP%10)==0)) + // 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 10 frames + { + LOG_D(MAC, + "[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %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, 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 + UE_template->ul_SR = 0; + status = mac_eNB_get_rrc_status(module_idP, rnti); + cqi_req = 0; - //power control - //compute the expected ULSCH RX power (for the stats) + if (status >= RRC_CONNECTED && UE_sched_ctrl->cqi_req_timer > 30) { + if (UE_sched_ctrl->cqi_received == 0) { + if (nfapi_mode) { + cqi_req = 0; + } else { + cqi_req = 1; - // this is the normalized RX power and this should be constant (regardless of mcs - //is not in dBm, unit from nfapi, converting to dBm: ToDo: Noise power hard coded to 30 - normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30; - target_rx_power= mac->puSch10xSnr/10 + 30; - //printf("\n mac->puSch10xSnr = %d, normalized_rx_power = %d, target_rx_power = %d \n",mac->puSch10xSnr,normalized_rx_power,target_rx_power); - // 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 (normalized_rx_power > (target_rx_power + 4)) { - tpc = 0; //-1 - tpc_accumulated--; - } else if (normalized_rx_power < (target_rx_power - 4)) { - tpc = 2; //+1 - tpc_accumulated++; - } else { - tpc = 1; //0 - } - } else { - tpc = 1; //0 - } - //tpc = 1; - if (tpc != 1) { - LOG_D(MAC, - "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", - module_idP, frameP, subframeP, harq_pid, tpc, - tpc_accumulated, normalized_rx_power, - target_rx_power); - } - // new transmission - if (round == 0) { + // To be safe , do not ask CQI in special Subframes:36.213/7.2.3 CQI definition + if (cc[CC_id].tdd_Config) { + switch (cc[CC_id].tdd_Config->subframeAssignment) { + case 1: + if( subframeP == 1 || subframeP == 6 ) cqi_req=0; - ndi = 1 - UE_template->oldNDI_UL[harq_pid]; - UE_template->oldNDI_UL[harq_pid] = ndi; - UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power; - UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power; - UE_template->mcs_UL[harq_pid] = cmin(UE_template->pre_assigned_mcs_ul, sli->ul[slice_idx].maxmcs); - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1= UE_template->mcs_UL[harq_pid]; - //cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS - if (UE_template->pre_allocated_rb_table_index_ul >= 0) { - rb_table_index = UE_template->pre_allocated_rb_table_index_ul; - } else { - UE_template->mcs_UL[harq_pid] = 10; //cmin (10, openair_daq_vars.target_ue_ul_mcs); - rb_table_index = 5; // for PHR - } + break; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid]; - // buffer_occupancy = UE_template->ul_total_buffer; + case 3: + if( subframeP == 1 ) cqi_req=0; + break; - while (((rb_table[rb_table_index] > (N_RB_UL - first_rb_slice[CC_id])) - || (rb_table[rb_table_index] > 45)) - && (rb_table_index > 0)) { - rb_table_index--; - } - - UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], - rb_table[rb_table_index]); - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index]; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_TBS += UE_template->TBS_UL[harq_pid]; - // buffer_occupancy -= TBS; - - 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(first_rb_slice[CC_id]), - T_INT(rb_table[rb_table_index]), - T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi)); - - if (mac_eNB_get_rrc_status(module_idP, rnti) < RRC_CONNECTED) - LOG_D(MAC, - "[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n", - module_idP, harq_pid, rnti, CC_id, frameP, - subframeP, UE_id, - UE_template->mcs_UL[harq_pid], - first_rb_slice[CC_id], rb_table[rb_table_index], - rb_table_index, - UE_template->TBS_UL[harq_pid], harq_pid); - - // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) - //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_slice[CC_id]; - - 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 scheduled UL bytes by TBS, wait for UL sdus to do final update - LOG_D(MAC, - "[eNB %d] CC_id %d UE %d/%x : adjusting scheduled_ul_bytes, old %d, TBS %d\n", - module_idP, CC_id, UE_id, rnti, - UE_template->scheduled_ul_bytes, - UE_template->TBS_UL[harq_pid]); - - 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 DM RS - 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; - - hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; - memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t)); - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; - hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu); - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb_slice[CC_id]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; - hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; - - hi_dci0_req_body->number_of_dci++; - hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4); - hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; - - hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! - hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - - - LOG_D(MAC, - "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid, frameP, subframeP, UE_id, rnti, - sched_frame, sched_subframeP); - - ul_req_index = 0; - dlsch_flag = 0; - for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){ - if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE && - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti){ - dlsch_flag = 1; - LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); - break; + default: + LOG_E(MAC," TDD config not supported\n"); + break; + } } - } - // Add UL_config PDUs - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb_slice[CC_id], // resource_block_start - rb_table[rb_table_index], // 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 - ndi, // new_data_indication - 0, // redundancy_version - harq_pid, // harq_process_number - 0, // ul_tx_mode - 0, // current_tx_nb - 0, // n_srs - get_TBS_UL - (UE_template-> - mcs_UL[harq_pid], - rb_table - [rb_table_index])); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions - 1, //repetition_number - (frameP * - 10) + - subframeP); - } + if(cqi_req == 1) UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP; + } + } else if (UE_sched_ctrl->cqi_received == 1) { + UE_sched_ctrl->cqi_req_flag = 0; + UE_sched_ctrl->cqi_received = 0; + UE_sched_ctrl->cqi_req_timer = 0; + } + } + + //power control + //compute the expected ULSCH RX power (for the stats) + // this is the normalized RX power and this should be constant (regardless of mcs + //is not in dBm, unit from nfapi, converting to dBm: ToDo: Noise power hard coded to 30 + normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30; + target_rx_power= mac->puSch10xSnr/10 + 30; + //printf("\n mac->puSch10xSnr = %d, normalized_rx_power = %d, target_rx_power = %d \n",mac->puSch10xSnr,normalized_rx_power,target_rx_power); + // 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 (normalized_rx_power > (target_rx_power + 4)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power < (target_rx_power - 4)) { + tpc = 2; //+1 + tpc_accumulated++; + } else { + tpc = 1; //0 + } + } else { + tpc = 1; //0 + } + + //tpc = 1; + if (tpc != 1) { + LOG_D(MAC, + "[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", + module_idP, frameP, subframeP, harq_pid, tpc, + tpc_accumulated, normalized_rx_power, + target_rx_power); + } + + // new transmission + if (round == 0) { + ndi = 1 - UE_template->oldNDI_UL[harq_pid]; + UE_template->oldNDI_UL[harq_pid] = ndi; + UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power; + UE_template->mcs_UL[harq_pid] = cmin(UE_template->pre_assigned_mcs_ul, sli->ul[slice_idx].maxmcs); + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1= UE_template->mcs_UL[harq_pid]; + + //cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS + if (UE_template->pre_allocated_rb_table_index_ul >= 0) { + rb_table_index = UE_template->pre_allocated_rb_table_index_ul; + } else { + UE_template->mcs_UL[harq_pid] = 10; //cmin (10, openair_daq_vars.target_ue_ul_mcs); + rb_table_index = 5; // for PHR + } + + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid]; + // buffer_occupancy = UE_template->ul_total_buffer; + + while (((rb_table[rb_table_index] > (N_RB_UL - first_rb_slice[CC_id])) + || (rb_table[rb_table_index] > 45)) + && (rb_table_index > 0)) { + rb_table_index--; + } + + UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], + rb_table[rb_table_index]); + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index]; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_TBS += UE_template->TBS_UL[harq_pid]; + // buffer_occupancy -= TBS; + 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(first_rb_slice[CC_id]), + T_INT(rb_table[rb_table_index]), + T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi)); + + if (mac_eNB_get_rrc_status(module_idP, rnti) < RRC_CONNECTED) + LOG_D(MAC, + "[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n", + module_idP, harq_pid, rnti, CC_id, frameP, + subframeP, UE_id, + UE_template->mcs_UL[harq_pid], + first_rb_slice[CC_id], rb_table[rb_table_index], + rb_table_index, + UE_template->TBS_UL[harq_pid], harq_pid); + + // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) + //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_slice[CC_id]; + 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 scheduled UL bytes by TBS, wait for UL sdus to do final update + LOG_D(MAC, + "[eNB %d] CC_id %d UE %d/%x : adjusting scheduled_ul_bytes, old %d, TBS %d\n", + module_idP, CC_id, UE_id, rnti, + UE_template->scheduled_ul_bytes, + UE_template->TBS_UL[harq_pid]); + 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 DM RS + 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; + hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; + memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu); + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb_slice[CC_id]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; + hi_dci0_req_body->number_of_dci++; + hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4); + hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; + hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! + hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; + LOG_D(MAC, + "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid, frameP, subframeP, UE_id, rnti, + sched_frame, sched_subframeP); + ul_req_index = 0; + dlsch_flag = 0; + + for(ul_req_index = 0; ul_req_index < ul_req_tmp_body->number_of_pdus; ul_req_index++) { + if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE && + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) { + dlsch_flag = 1; + LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); + break; + } + } + + // Add UL_config PDUs + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, + first_rb_slice[CC_id], // resource_block_start + rb_table[rb_table_index], // 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 + ndi, // new_data_indication + 0, // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + get_TBS_UL + (UE_template-> + mcs_UL[harq_pid], + rb_table + [rb_table_index])); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + + if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions + 1, //repetition_number + (frameP * + 10) + + subframeP); + } + #endif - if(dlsch_flag == 1){ - if(cqi_req == 1){ - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; - }else{ - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; - } - fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); - }else{ - ul_req_tmp_body->number_of_pdus++; + if(dlsch_flag == 1) { + if(cqi_req == 1) { + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag= + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = + rb_table[rb_table_index]; + } else { + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index]; } - ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST; - ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; - mac->ul_handle++; + fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); + } else { + ul_req_tmp_body->number_of_pdus++; + } - uint16_t ul_sched_frame = sched_frame; - uint16_t ul_sched_subframeP = sched_subframeP; + ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST; + ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; + mac->ul_handle++; + uint16_t ul_sched_frame = sched_frame; + uint16_t ul_sched_subframeP = sched_subframeP; + //add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2); + ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP; + 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); + LOG_D(MAC,"[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n", harq_pid,frameP,subframeP,ul_sched_frame,ul_sched_subframeP,cqi_req,UE_id,rnti); + // increment first rb for next UE allocation + first_rb_slice[CC_id] += rb_table[rb_table_index]; + } else { // round > 0 => retransmission + 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(first_rb_slice[CC_id]), + T_INT(rb_table[rb_table_index]), T_INT(round)); + // Add UL_config PDUs + LOG_D(MAC, + "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid, frameP, subframeP, UE_id, rnti, + sched_frame, sched_subframeP); + ul_req_index = 0; + dlsch_flag = 0; - //add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2); - ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP; - - 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); - LOG_D(MAC,"[PUSCH %d] SFN/SF:%04d%d UL_CFG:SFN/SF:%04d%d CQI:%d for UE %d/%x\n", harq_pid,frameP,subframeP,ul_sched_frame,ul_sched_subframeP,cqi_req,UE_id,rnti); - - // increment first rb for next UE allocation - first_rb_slice[CC_id] += rb_table[rb_table_index]; - } else { // round > 0 => retransmission - 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(first_rb_slice[CC_id]), - T_INT(rb_table[rb_table_index]), T_INT(round)); - - // Add UL_config PDUs - LOG_D(MAC, - "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid, frameP, subframeP, UE_id, rnti, - sched_frame, sched_subframeP); - ul_req_index = 0; - dlsch_flag = 0; - for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){ - if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE && - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti){ - dlsch_flag = 1; - LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); - break; - } + for(ul_req_index = 0; ul_req_index < ul_req_tmp_body->number_of_pdus; ul_req_index++) { + if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE && + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) { + dlsch_flag = 1; + LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); + break; } - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->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 & 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]); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions - 1, //repetition_number - (frameP * - 10) + - subframeP); - } + } + + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->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 & 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]); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + + if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions + 1, //repetition_number + (frameP * + 10) + + subframeP); + } + #endif - if(dlsch_flag == 1){ - if(cqi_req == 1){ - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid]; - }else{ - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; - ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured - ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid]; - } - fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); - }else{ - ul_req_tmp_body->number_of_pdus++; + if(dlsch_flag == 1) { + if(cqi_req == 1) { + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag= + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = + UE_template->nb_rb_ul[harq_pid]; + } else { + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; + ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = + NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG; + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured + ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = + UE_template->nb_rb_ul[harq_pid]; } - mac->ul_handle++; + fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP); + } else { + ul_req_tmp_body->number_of_pdus++; + } - ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; + mac->ul_handle++; + ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; + ul_req_tmp->sfn_sf = sched_frame<<4|sched_subframeP; + ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST; + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d cqi_req %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,cqi_req); + } /* - ul_req_tmp->sfn_sf = sched_frame<<4|sched_subframeP; - ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST; + else if (round > 0) { //we schedule a retransmission - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d cqi_req %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,cqi_req); - } /* - else if (round > 0) { //we schedule a retransmission + ndi = UE_template->oldNDI_UL[harq_pid]; - ndi = UE_template->oldNDI_UL[harq_pid]; + if ((round&3)==0) { + mcs = openair_daq_vars.target_ue_ul_mcs; + } else { + mcs = rvidx_tab[round&3] + 28; //not correct for round==4! - if ((round&3)==0) { - mcs = openair_daq_vars.target_ue_ul_mcs; - } else { - mcs = rvidx_tab[round&3] + 28; //not correct for round==4! + } - } + LOG_I(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE retransmission (mcs %d, first rb %d, nb_rb %d, harq_pid %d, round %d)\n", + module_idP,UE_id,rnti,CC_id,frameP,subframeP,mcs, + first_rb[CC_id],UE_template->nb_rb_ul[harq_pid], + harq_pid, round); - LOG_I(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE retransmission (mcs %d, first rb %d, nb_rb %d, harq_pid %d, round %d)\n", - module_idP,UE_id,rnti,CC_id,frameP,subframeP,mcs, - first_rb[CC_id],UE_template->nb_rb_ul[harq_pid], - harq_pid, round); + rballoc = mac_xface->computeRIV(frame_parms->N_RB_UL, + first_rb[CC_id], + UE_template->nb_rb_ul[harq_pid]); + first_rb[CC_id]+=UE_template->nb_rb_ul[harq_pid]; // increment for next UE allocation - rballoc = mac_xface->computeRIV(frame_parms->N_RB_UL, - first_rb[CC_id], - UE_template->nb_rb_ul[harq_pid]); - first_rb[CC_id]+=UE_template->nb_rb_ul[harq_pid]; // increment for next UE allocation - - UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission_rx+=1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx_rx=UE_template->nb_rb_ul[harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=UE_template->nb_rb_ul[harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=mcs; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs; - } - */ - - } // UE_is_to_be_scheduled - } // loop over UE_id - } // loop of CC_id + UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission_rx+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx_rx=UE_template->nb_rb_ul[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=UE_template->nb_rb_ul[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=mcs; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs; + } + */ + } // UE_is_to_be_scheduled + } // loop over UE_id + } // loop of CC_id } diff --git a/openair2/LAYER2/MAC/l1_helpers.c b/openair2/LAYER2/MAC/l1_helpers.c index bd640a6c88..9b26413cb1 100644 --- a/openair2/LAYER2/MAC/l1_helpers.c +++ b/openair2/LAYER2/MAC/l1_helpers.c @@ -36,7 +36,7 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id) { - RACH_ConfigCommon_t *rach_ConfigCommon = NULL; + LTE_RACH_ConfigCommon_t *rach_ConfigCommon = NULL; AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n"); diff --git a/openair2/LAYER2/MAC/lte_transport_init.c b/openair2/LAYER2/MAC/lte_transport_init.c deleted file mode 100644 index e1f21f21e4..0000000000 --- a/openair2/LAYER2/MAC/lte_transport_init.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#define UL_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,24) -#define BCCH_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,4) -#define RA_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,4) -#define DLSCH_RB_ALLOC 0x1fff -#include "extern.h" - - -void init_transport_channels(unsigned char transmission_mode) -{ - - // init DCI structures for testing - - UL_alloc_pdu.type = 0; - UL_alloc_pdu.hopping = 0; - UL_alloc_pdu.rballoc = UL_RB_ALLOC; - UL_alloc_pdu.mcs = 2; - UL_alloc_pdu.ndi = 1; - UL_alloc_pdu.TPC = 0; - UL_alloc_pdu.cqi_req = 1; - - /* - BCCH_alloc_pdu.type = 1; - BCCH_alloc_pdu.vrb_type = 0; - BCCH_alloc_pdu.rballoc = BCCH_RB_ALLOC; - BCCH_alloc_pdu.ndi = 1; - BCCH_alloc_pdu.rv = 1; - BCCH_alloc_pdu.mcs = 1; - BCCH_alloc_pdu.harq_pid = 0; - BCCH_alloc_pdu.TPC = 1; // set to 3 PRB - - // for FDD mode - BCCH_alloc_pdu_fdd.type = 1; - BCCH_alloc_pdu_fdd.vrb_type = 0; - BCCH_alloc_pdu_fdd.rballoc = BCCH_RB_ALLOC; - BCCH_alloc_pdu_fdd.ndi = 1; - BCCH_alloc_pdu_fdd.rv = 1; - BCCH_alloc_pdu_fdd.mcs = 1; - BCCH_alloc_pdu_fdd.harq_pid = 0; - BCCH_alloc_pdu_fdd.TPC = 1; // set to 3 PRB - */ - - DLSCH_alloc_pdu1A.type = 1; - DLSCH_alloc_pdu1A.vrb_type = 0; - DLSCH_alloc_pdu1A.rballoc = BCCH_RB_ALLOC; - DLSCH_alloc_pdu1A.ndi = 1; - DLSCH_alloc_pdu1A.rv = 1; - DLSCH_alloc_pdu1A.mcs = 2; - DLSCH_alloc_pdu1A.harq_pid = 0; - DLSCH_alloc_pdu1A.TPC = 1; // set to 3 PRB - - DLSCH_alloc_pdu1A_fdd.type = 1; - DLSCH_alloc_pdu1A_fdd.vrb_type = 0; - DLSCH_alloc_pdu1A_fdd.rballoc = BCCH_RB_ALLOC; - DLSCH_alloc_pdu1A_fdd.ndi = 1; - DLSCH_alloc_pdu1A_fdd.rv = 1; - DLSCH_alloc_pdu1A_fdd.mcs = 2; - DLSCH_alloc_pdu1A_fdd.harq_pid = 0; - DLSCH_alloc_pdu1A_fdd.TPC = 1; // set to 3 PRB - - RA_alloc_pdu.type = 1; - RA_alloc_pdu.vrb_type = 0; - RA_alloc_pdu.rballoc = RA_RB_ALLOC; - RA_alloc_pdu.ndi = 1; - RA_alloc_pdu.rv = 0; - RA_alloc_pdu.mcs = 0; - RA_alloc_pdu.harq_pid = 0; - RA_alloc_pdu.TPC = 1; - - RA_alloc_pdu_fdd.type = 1; - RA_alloc_pdu_fdd.vrb_type = 0; - RA_alloc_pdu_fdd.rballoc = RA_RB_ALLOC; - RA_alloc_pdu_fdd.ndi = 1; - RA_alloc_pdu_fdd.rv = 1; - RA_alloc_pdu_fdd.mcs = 1; - RA_alloc_pdu_fdd.harq_pid = 0; - RA_alloc_pdu_fdd.TPC = 1; - - - DLSCH_alloc_pdu1.rballoc = 0xf; - DLSCH_alloc_pdu1.TPC = 0; - DLSCH_alloc_pdu1.dai = 0; - DLSCH_alloc_pdu1.harq_pid = 0; - DLSCH_alloc_pdu1.tb_swap = 0; - DLSCH_alloc_pdu1.mcs1 = 4; - DLSCH_alloc_pdu1.ndi1 = 1; - DLSCH_alloc_pdu1.rv1 = 0; - - // Forget second codeword - if (transmission_mode == 6) { - DLSCH_alloc_pdu1.tpmi = 5; // PUSCH_PRECODING0 - } else { - DLSCH_alloc_pdu1.tpmi = 0; - } - - DLSCH_alloc_pdu2.rah = 0; - DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC; - DLSCH_alloc_pdu2.TPC = 0; - DLSCH_alloc_pdu2.dai = 0; - DLSCH_alloc_pdu2.harq_pid = 0; - DLSCH_alloc_pdu2.tb_swap = 0; - DLSCH_alloc_pdu2.mcs1 = 4; - DLSCH_alloc_pdu2.ndi1 = 1; - DLSCH_alloc_pdu2.rv1 = 0; - - // Forget second codeword - if (transmission_mode == 6) { - DLSCH_alloc_pdu2.tpmi = 5; // PUSCH_PRECODING0 - } else { - DLSCH_alloc_pdu2.tpmi = 0; - } -} diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index ed6171dceb..7785abd16f 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -1,4 +1,4 @@ -/* + /* * 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. @@ -44,29 +44,29 @@ #include #include "COMMON/platform_constants.h" -#include "BCCH-BCH-Message.h" -#include "RadioResourceConfigCommon.h" -#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "MeasGapConfig.h" -#include "SchedulingInfoList.h" -#include "TDD-Config.h" -#include "RACH-ConfigCommon.h" -#include "MeasObjectToAddModList.h" -#include "MobilityControlInfo.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MBSFN-AreaInfoList-r9.h" -#include "MBSFN-SubframeConfigList.h" -#include "PMCH-InfoList-r9.h" +#include "LTE_BCCH-BCH-Message.h" +#include "LTE_RadioResourceConfigCommon.h" +#include "LTE_RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigDedicated.h" +#include "LTE_MeasGapConfig.h" +#include "LTE_SchedulingInfoList.h" +#include "LTE_TDD-Config.h" +#include "LTE_RACH-ConfigCommon.h" +#include "LTE_MeasObjectToAddModList.h" +#include "LTE_MobilityControlInfo.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_MBSFN-AreaInfoList-r9.h" +#include "LTE_MBSFN-SubframeConfigList.h" +#include "LTE_PMCH-InfoList-r9.h" #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "SCellToAddMod-r10.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#include "LTE_SCellToAddMod-r10.h" #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) -#include "SystemInformationBlockType1-v1310-IEs.h" -#include "SystemInformationBlockType18-r12.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#include "LTE_SystemInformationBlockType1-v1310-IEs.h" +#include "LTE_SystemInformationBlockType18-r12.h" #endif -#include "RadioResourceConfigCommonSIB.h" +#include "LTE_RadioResourceConfigCommonSIB.h" #include "nfapi_interface.h" #include "PHY_INTERFACE/IF_Module.h" @@ -91,7 +91,7 @@ #define DCH_PAYLOAD_SIZE_MAX 4096 /// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Mask for identifying subframe for MBMS #define MBSFN_TDD_SF3 0x80 // for TDD @@ -380,7 +380,7 @@ typedef struct { uint8_t payload[PCCH_PAYLOAD_SIZE_MAX]; } __attribute__ ((__packed__)) PCCH_PDU; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /*! \brief MCCH payload */ typedef struct { uint8_t payload[MCCH_PAYLOAD_SIZE_MAX]; @@ -437,7 +437,7 @@ typedef struct { /*!\brief LCID of padding LCID for DLSCH */ #define SHORT_PADDING 31 -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // MCH LCHAN IDs (table6.2.1-4 TS36.321) /*!\brief LCID of MCCH for DL */ #define MCCH_LCHANID 0 @@ -900,14 +900,14 @@ typedef struct { eNB_UE_estimated_distances distance; #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint8_t rach_resource_type; uint16_t mpdcch_repetition_cnt; frame_t Msg2_frame; #endif sub_frame_t Msg2_subframe; - PhysicalConfigDedicated_t *physicalConfigDedicated; + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated; } UE_TEMPLATE; @@ -1047,7 +1047,7 @@ typedef struct { int msg4_TBsize; /// MCS used for Msg4 int msg4_mcs; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint8_t rach_resource_type; uint8_t msg2_mpdcch_repetition_cnt; uint8_t msg4_mpdcch_repetition_cnt; @@ -1070,8 +1070,7 @@ typedef struct { /*! \brief UE list used by eNB to order UEs/CC for scheduling*/ typedef struct { /// Dedicated information for UEs - struct PhysicalConfigDedicated - *physicalConfigDedicated[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// DLSCH pdu DLSCH_PDU DLSCH_pdu[NFAPI_CC_MAX][2][MAX_MOBILES_PER_ENB]; /// DCI template and MAC connection parameters for UEs @@ -1243,14 +1242,14 @@ typedef struct { int Ncp; int eutra_band; uint32_t dl_CarrierFreq; - BCCH_BCH_Message_t *mib; - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; + LTE_BCCH_BCH_Message_t *mib; + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; #endif - TDD_Config_t *tdd_Config; - SchedulingInfoList_t *schedulingInfoList; - ARFCN_ValueEUTRA_t ul_CarrierFreq; + LTE_TDD_Config_t *tdd_Config; + LTE_SchedulingInfoList_t *schedulingInfoList; + LTE_ARFCN_ValueEUTRA_t ul_CarrierFreq; long ul_Bandwidth; /// Outgoing MIB PDU for PHY MIB_PDU MIB_pdu; @@ -1273,10 +1272,10 @@ typedef struct { /// VRB map for common channels and retransmissions by PHICH uint8_t vrb_map_UL[100]; /// MBSFN SubframeConfig - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; + struct LTE_MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; /// number of subframe allocation pattern available for MBSFN sync area uint8_t num_sf_allocation_pattern; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /// MBMS Flag uint8_t MBMS_flag; /// Outgoing MCCH pdu for PHY @@ -1290,17 +1289,17 @@ typedef struct { /// number of active MBSFN area uint8_t num_active_mbsfn_area; /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + struct LTE_MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + struct LTE_PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; /// MBMS session info list - struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; + struct LTE_MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; /// Outgoing MCH pdu for PHY MCH_PDU MCH_pdu; #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) /// Rel13 parameters from SIB1 - SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; + LTE_SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; /// Counter for SIB1-BR scheduling int SIB1_BR_cnt; /// Outgoing BCCH-BR pdu for PHY @@ -1454,9 +1453,9 @@ typedef struct { /// default value is false uint16_t ttiBundling; /// default value is release - struct DRX_Config *drx_config; + struct LTE_DRX_Config *drx_config; /// default value is release - struct MAC_MainConfig__phr_Config *phr_config; + struct LTE_MAC_MainConfig__phr_Config *phr_config; ///timer before triggering a periodic PHR uint16_t periodicPHR_Timer; ///timer before triggering a prohibit PHR @@ -1498,30 +1497,30 @@ typedef struct { /// uplink active flag uint8_t ul_active; /// pointer to RRC PHY configuration - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; + LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry) - struct RACH_ConfigDedicated *rach_ConfigDedicated; + struct LTE_RACH_ConfigDedicated *rach_ConfigDedicated; /// pointer to RRC PHY configuration - struct PhysicalConfigDedicated *physicalConfigDedicated; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /// pointer to RRC PHY configuration SCEll - struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10; + struct LTE_PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10; /// Preconfiguration for Sidelink - struct SL_Preconfiguration_r12 *SL_Preconfiguration; + struct LTE_SL_Preconfiguration_r12 *SL_Preconfiguration; /// RX Pool for Sidelink from SIB18 - SL_CommRxPoolList_r12_t commRxPool_r12; + LTE_SL_CommRxPoolList_r12_t commRxPool_r12; /// TX Pool Normal for Sidelink from SIB18 - struct SL_CommTxPoolList_r12 *commTxPoolNormalCommon_r12; + struct LTE_SL_CommTxPoolList_r12 *commTxPoolNormalCommon_r12; /// TX Pool Exceptional for Sidelink from SIB18 - struct SL_CommTxPoolList_r12 *commTxPoolExceptional_r12; + struct LTE_SL_CommTxPoolList_r12 *commTxPoolExceptional_r12; /// Common Sync Config for Sidelink from SIB18 - struct SL_SyncConfigList_r12 *commSyncConfig_r12; + struct LTE_SL_SyncConfigList_r12 *commSyncConfig_r12; /// Dedicated Sync TX control for Sidelink - struct SL_SyncTxControl_r12 *sl_SyncTxControl_r12; + struct LTE_SL_SyncTxControl_r12 *sl_SyncTxControl_r12; /// Dedicated Discovery TX control for Sidelink - struct SL_DiscConfig_r12 *sl_DiscConfig_r12; + struct LTE_SL_DiscConfig_r12 *sl_DiscConfig_r12; /// Dedicated TX config for Sidelink - struct SL_CommConfig_r12 *sl_CommConfig_r12; + struct LTE_SL_CommConfig_r12 *sl_CommConfig_r12; //SL sourceL2ID uint32_t sourceL2Id; //SL groupL2Id @@ -1535,17 +1534,17 @@ typedef struct { #endif /// pointer to TDD Configuration (NULL for FDD) - TDD_Config_t *tdd_Config; + LTE_TDD_Config_t *tdd_Config; /// Number of adjacent cells to measure uint8_t n_adj_cells; /// Array of adjacent physical cell ids uint32_t adj_cell_id[6]; /// Pointer to RRC MAC configuration - MAC_MainConfig_t *macConfig; + LTE_MAC_MainConfig_t *macConfig; /// Pointer to RRC Measurement gap configuration - MeasGapConfig_t *measGapConfig; + LTE_MeasGapConfig_t *measGapConfig; /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive. - LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; + LTE_LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; /// Scheduling Information UE_SCHEDULING_INFO scheduling_info; /// Outgoing CCCH pdu for PHY @@ -1554,7 +1553,7 @@ typedef struct { RAR_PDU RAR_pdu; /// Incoming DLSCH pdu for PHY DLSCH_PDU DLSCH_pdu[MAX_MOBILES_PER_ENB][2]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int sltx_active; SLSCH_t slsch; SLDCH_t sldch; @@ -1610,16 +1609,16 @@ typedef struct { uint8_t periodBSRTimer_expires_flag; /// MBSFN_Subframe Configuration - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? + struct LTE_MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area uint8_t num_sf_allocation_pattern; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) /// number of active MBSFN area uint8_t num_active_mbsfn_area; /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + struct LTE_MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + struct LTE_PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; /// MCCH status uint8_t mcch_status; /// MSI status @@ -1627,7 +1626,7 @@ typedef struct { uint8_t msi_current_alloc; uint8_t msi_pmch; - struct MBSFN_SubframeConfig *commonSF_Alloc_r9_mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? + struct LTE_MBSFN_SubframeConfig *commonSF_Alloc_r9_mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? uint8_t commonSF_AllocPeriod_r9; int common_num_sf_alloc; diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index ca72882471..fd9ffb6a87 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -64,7 +64,8 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES extern unsigned char NB_INST; #endif extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; +extern uint16_t NB_THREAD_INST; extern unsigned char NB_RN_INST; extern unsigned short NODE_ID[1]; diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h index 34ad183f73..aa685cca09 100644 --- a/openair2/LAYER2/MAC/mac_proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -290,7 +290,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame void initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t subframeP, uint16_t preamble_index, int16_t timing_offset, uint16_t rnti -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint8_t rach_resource_type #endif ); @@ -309,7 +309,7 @@ unsigned short fill_rar(const module_id_t module_idP, const uint16_t N_RB_UL, const uint8_t input_buffer_length); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) unsigned short fill_rar_br(eNB_MAC_INST * eNB, int CC_id, RA_t * ra, @@ -465,7 +465,7 @@ void set_ue_dai(sub_frame_t subframeP, int UE_id, uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list); -uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP); +uint8_t frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP); /** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). @param Mod_id Instance ID of eNB @param frame Frame index @@ -549,7 +549,7 @@ void ue_send_sl_sdu(module_id_t module_idP, sl_discovery_flag_t sl_discovery_flag ); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /* \brief Called by PHY to transfer MCH transport block to ue MAC. @param Mod_id Index of module instance @param frame Frame index @@ -694,7 +694,7 @@ int to_prb(int); int to_rbg(int); int mac_init(void); int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , uint8_t rach_resource_type #endif ); @@ -956,46 +956,46 @@ int rrc_mac_config_req_eNB(module_id_t module_idP, int p_eNB, int Ncp, int eutra_band, uint32_t dl_CarrierFreq, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int pbch_repetition, #endif rnti_t rntiP, - BCCH_BCH_Message_t * mib, - RadioResourceConfigCommonSIB_t * + LTE_BCCH_BCH_Message_t * mib, + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RadioResourceConfigCommonSIB_t * - radioResourceConfigCommon_BR, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + LTE_RadioResourceConfigCommonSIB_t * + LTE_radioResourceConfigCommon_BR, #endif - struct PhysicalConfigDedicated + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SCellToAddMod_r10_t * sCellToAddMod_r10, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SCellToAddMod_r10_t * sCellToAddMod_r10, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, + LTE_MeasObjectToAddMod_t ** measObj, + LTE_MAC_MainConfig_t * mac_MainConfig, long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, - SchedulingInfoList_t * schedulingInfoList, + LTE_LogicalChannelConfig_t * logicalChannelConfig, + LTE_MeasGapConfig_t * measGapConfig, + LTE_TDD_Config_t * tdd_Config, + LTE_MobilityControlInfo_t * mobilityControlInfo, + LTE_SchedulingInfoList_t * schedulingInfoList, uint32_t ul_CarrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t * + LTE_AdditionalSpectrumEmission_t * additionalSpectrumEmission, - struct MBSFN_SubframeConfigList + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList + LTE_MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + LTE_PMCH_InfoList_r9_t * pmch_InfoList #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) , - SystemInformationBlockType1_v1310_IEs_t * + LTE_SystemInformationBlockType1_v1310_IEs_t * sib1_ext_r13 #endif ); @@ -1023,40 +1023,40 @@ int rrc_mac_config_req_eNB(module_id_t module_idP, int rrc_mac_config_req_ue(module_id_t module_idP, int CC_id, uint8_t eNB_index, - RadioResourceConfigCommonSIB_t * + LTE_RadioResourceConfigCommonSIB_t * radioResourceConfigCommon, - struct PhysicalConfigDedicated + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SCellToAddMod_r10_t * sCellToAddMod_r10, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SCellToAddMod_r10_t * sCellToAddMod_r10, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, + LTE_MeasObjectToAddMod_t ** measObj, + LTE_MAC_MainConfig_t * mac_MainConfig, long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, + LTE_LogicalChannelConfig_t * logicalChannelConfig, + LTE_MeasGapConfig_t * measGapConfig, + LTE_TDD_Config_t * tdd_Config, + LTE_MobilityControlInfo_t * mobilityControlInfo, uint8_t * SIwindowsize, uint16_t * SIperiod, - ARFCN_ValueEUTRA_t * ul_CarrierFreq, + LTE_ARFCN_ValueEUTRA_t * ul_CarrierFreq, long *ul_Bandwidth, - AdditionalSpectrumEmission_t * + LTE_AdditionalSpectrumEmission_t * additionalSpectrumEmission, - struct MBSFN_SubframeConfigList + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) , uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList + LTE_MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + LTE_PMCH_InfoList_r9_t * pmch_InfoList #endif #ifdef CBA , uint8_t num_active_cba_groups, uint16_t cba_rnti #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,config_action_t config_action ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id @@ -1084,11 +1084,11 @@ uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, int get_phich_resource_times6(COMMON_channels_t * cc); -uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP); +uint8_t frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP); uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe); -unsigned char ul_ACK_subframe2M(TDD_Config_t *tdd_Config,unsigned char subframe); +unsigned char ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,unsigned char subframe); int to_rbg(int dl_Bandwidth); @@ -1114,17 +1114,17 @@ void get_srs_pos(COMMON_channels_t * cc, uint16_t isrs, uint16_t * psrsPeriodicity, uint16_t * psrsOffset); void get_csi_params(COMMON_channels_t * cc, - struct CQI_ReportPeriodic *cqi_PMI_ConfigIndex, + struct LTE_CQI_ReportPeriodic *cqi_PMI_ConfigIndex, uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H); uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, COMMON_channels_t * cc, uint8_t tmode, - struct CQI_ReportPeriodic + struct LTE_CQI_ReportPeriodic *cqi_ReportPeriodic); uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, uint8_t ri, - CQI_ReportModeAperiodic_t * + LTE_CQI_ReportModeAperiodic_t * cqi_ReportModeAperiodic); void extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, frame_t frameP, sub_frame_t subframeP, @@ -1141,7 +1141,7 @@ uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t * tx_req_body, void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t * ul_config_pdu, uint8_t cqi_req, COMMON_channels_t * cc, - struct PhysicalConfigDedicated + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, uint8_t tmode, uint32_t handle, uint16_t rnti, @@ -1160,7 +1160,7 @@ void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t * uint8_t current_tx_nb, uint8_t n_srs, uint16_t size); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t * ul_config_pdu, uint8_t ue_type, uint16_t @@ -1237,7 +1237,7 @@ uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP); uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int get_numnarrowbandbits(long dl_Bandwidth); int mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP, diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h index 76842afd38..7126301a7c 100644 --- a/openair2/LAYER2/MAC/mac_vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -95,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = { uint32_t RRC_CONNECTION_FLAG; -UE_MAC_INST *UE_mac_inst; //[NB_MODULE_MAX]; +UE_MAC_INST *UE_mac_inst = NULL; //[NB_MODULE_MAX]; MAC_RLC_XFACE *Mac_rlc_xface; /// Primary component carrier index of eNB @@ -109,7 +109,8 @@ eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN #ifdef OPENAIR2 unsigned char NB_eNB_INST = 0; -unsigned char NB_UE_INST = 0; +uint16_t NB_UE_INST = 0; +uint16_t NB_THREAD_INST = 0; unsigned char NB_RN_INST = 0; unsigned char NB_INST = 0; #endif @@ -124,7 +125,7 @@ DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu; DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu; DCI1_5MHz_TDD_t DLSCH_alloc_pdu; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) DCI1C_5MHz_t MCCH_alloc_pdu; #endif diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c index 95f25c7ff5..1168ed265a 100644 --- a/openair2/LAYER2/MAC/main_ue.c +++ b/openair2/LAYER2/MAC/main_ue.c @@ -43,7 +43,8 @@ #include "common/ran_context.h" - +extern FILL_UL_INFO_MUTEX_t fill_ul_mutex; +extern uint8_t nfapi_mode; extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active); void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR @@ -103,6 +104,15 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer, UE_mac_inst = NULL; } + // mutex below are used for multiple UE's L2 FAPI simulation. + if (nfapi_mode == 3){ + pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL); + } LOG_I(MAC, "[MAIN] calling RRC\n"); openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index 5846720c7f..341579a084 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -124,7 +124,7 @@ store_dlsch_buffer(module_id_t Mod_id, rlc_status = mac_rlc_status_ind(Mod_id, rnti, Mod_id, frameP, subframeP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index aeabbd092a..d139c8bd47 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -57,12 +57,12 @@ get_prach_resources(module_id_t module_idP, uint8_t eNB_index, uint8_t t_id, uint8_t first_Msg3, - RACH_ConfigDedicated_t * rach_ConfigDedicated) + LTE_RACH_ConfigDedicated_t * rach_ConfigDedicated) { uint8_t Msg3_size = UE_mac_inst[module_idP].RA_Msg3_size; PRACH_RESOURCES_t *prach_resources = &UE_mac_inst[module_idP].RA_prach_resources; - RACH_ConfigCommon_t *rach_ConfigCommon = NULL; + LTE_RACH_ConfigCommon_t *rach_ConfigCommon = NULL; uint8_t noGroupB = 0; uint8_t f_id = 0, num_prach = 0; int numberOfRA_Preambles; @@ -311,8 +311,8 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, uint8_t lcid = CCCH; uint16_t Size16; - struct RACH_ConfigCommon *rach_ConfigCommon = - (struct RACH_ConfigCommon *) NULL; + struct LTE_RACH_ConfigCommon *rach_ConfigCommon = + (struct LTE_RACH_ConfigCommon *) NULL; int32_t frame_diff = 0; uint8_t dcch_header_len = 0; uint16_t sdu_lengths; @@ -408,7 +408,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, UE_mac_inst[module_idP].crnti, eNB_indexP, frameP, subframeP, ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -428,7 +428,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, sdu_lengths = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_indexP, frameP, ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, 6, //not used (char *) &ulsch_buff[0] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -553,37 +553,37 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, int preambleTransMax = -1; switch (rach_ConfigCommon->ra_SupervisionInfo. preambleTransMax) { - case PreambleTransMax_n3: + case LTE_PreambleTransMax_n3: preambleTransMax = 3; break; - case PreambleTransMax_n4: + case LTE_PreambleTransMax_n4: preambleTransMax = 4; break; - case PreambleTransMax_n5: + case LTE_PreambleTransMax_n5: preambleTransMax = 5; break; - case PreambleTransMax_n6: + case LTE_PreambleTransMax_n6: preambleTransMax = 6; break; - case PreambleTransMax_n7: + case LTE_PreambleTransMax_n7: preambleTransMax = 7; break; - case PreambleTransMax_n8: + case LTE_PreambleTransMax_n8: preambleTransMax = 8; break; - case PreambleTransMax_n10: + case LTE_PreambleTransMax_n10: preambleTransMax = 10; break; - case PreambleTransMax_n20: + case LTE_PreambleTransMax_n20: preambleTransMax = 20; break; - case PreambleTransMax_n50: + case LTE_PreambleTransMax_n50: preambleTransMax = 50; break; - case PreambleTransMax_n100: + case LTE_PreambleTransMax_n100: preambleTransMax = 100; break; - case PreambleTransMax_n200: + case LTE_PreambleTransMax_n200: preambleTransMax = 200; break; } diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index 2e6b47ff60..3414d7632f 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -108,7 +108,7 @@ fill_rar(const module_id_t module_idP, return (ra->rnti); } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) //------------------------------------------------------------------------------ unsigned short fill_rar_br(eNB_MAC_INST * eNB, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 2c99b79ce8..19765cff04 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -65,11 +65,12 @@ #define DEBUG_HEADER_PARSING 1 #define ENABLE_MAC_PAYLOAD_DEBUG 1 -extern uint8_t usim_test; extern UL_IND_t *UL_INFO; extern uint8_t nfapi_mode; +extern int next_ra_frame; +extern module_id_t next_Mod_id; /* * @@ -96,22 +97,22 @@ void ue_init_mac(module_id_t module_idP) LOG_I(MAC, "[UE%d] Applying default macMainConfig\n", module_idP); //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL; UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer = - RetxBSR_Timer_r12_sf10240; + LTE_RetxBSR_Timer_r12_sf10240; UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer = - PeriodicBSR_Timer_r12_infinity; + LTE_PeriodicBSR_Timer_r12_infinity; UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = - MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; + LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = - MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; + LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = - MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; + LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; UE_mac_inst[module_idP].PHR_state = - MAC_MainConfig__phr_Config_PR_setup; + LTE_MAC_MainConfig__phr_Config_PR_setup; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0; UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer = 0; UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running = 0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx = - MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling = 0; UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10 = 0; UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10 = 0; @@ -304,14 +305,14 @@ ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, // determin the measurement gap if (UE_mac_inst[module_idP].measGapConfig != NULL) { if (UE_mac_inst[module_idP].measGapConfig->choice.setup. - gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { + gapOffset.present == LTE_MeasGapConfig__setup__gapOffset_PR_gp0) { MGRP = 40; gapOffset = UE_mac_inst[module_idP].measGapConfig->choice. setup.gapOffset.choice.gp0; } else if (UE_mac_inst[module_idP].measGapConfig->choice. setup.gapOffset.present == - MeasGapConfig__setup__gapOffset_PR_gp1) { + LTE_MeasGapConfig__setup__gapOffset_PR_gp1) { MGRP = 80; gapOffset = UE_mac_inst[module_idP].measGapConfig->choice. @@ -689,7 +690,7 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP, } } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) unsigned char *parse_mch_header(unsigned char *mac_header, unsigned char *num_sdu, unsigned char *rx_lcids, @@ -1017,7 +1018,7 @@ int ue_query_p_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, i if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL) continue; - if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format + if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format continue; // four-frameP format @@ -1032,7 +1033,7 @@ int ue_query_p_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, i if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL) continue; - if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format + if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) // one-frameP format continue; // four-frameP format @@ -1167,7 +1168,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_ break; } - if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format + if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[j]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) { // one-frameP format if (frameP % mbsfn_period == mbsfn_alloc_offset) { // MBSFN frameP if (UE_mac_inst[module_idP].pmch_Config[0]) { @@ -1372,7 +1373,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_ if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] == NULL) continue; - if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present != MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) + if (UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.present != LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) continue; uint32_t common_mbsfn_SubframeConfig = UE_mac_inst[module_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]; @@ -1919,7 +1920,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, } // periodicBSR-Timer expires, trigger BSR if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != - PeriodicBSR_Timer_r12_infinity) + LTE_PeriodicBSR_Timer_r12_infinity) && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == 0)) { // Trigger BSR Periodic UE_mac_inst[module_idP].BSR_reporting_active |= @@ -2020,7 +2021,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, { // Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU - if ((usim_test == 0) && (lcid == DCCH1) + if (( get_softmodem_params()->usim_test == 0) && (lcid == DCCH1) && (lcid_rlc_pdu_count == 0) && (num_sdus)) { // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed @@ -2055,7 +2056,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, lcid, buflen_remain, (char *)&ulsch_buff[sdu_length_total] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -2071,7 +2072,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, if (sdu_lengths[num_sdus]) { sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = lcid; - LOG_D(MAC, + LOG_I(MAC, "[UE %d] TX Multiplex RLC PDU TX Got %d bytes for LcId%d\n", module_idP, sdu_lengths[num_sdus], lcid); @@ -2447,7 +2448,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, // Reset Periodic Timer except when BSR is truncated if ((bsr_t == NULL) && (UE_mac_inst[module_idP].scheduling_info. - periodicBSR_Timer != PeriodicBSR_Timer_r12_infinity)) { + periodicBSR_Timer != LTE_PeriodicBSR_Timer_r12_infinity)) { UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst [module_idP].scheduling_info. @@ -2506,8 +2507,8 @@ ue_scheduler(const module_id_t module_idP, int bucketsizeduration_max = -1; // mac_rlc_status_resp_t rlc_status[MAX_NUM_LCGID]; // 4 // int8_t lcg_id; - struct RACH_ConfigCommon *rach_ConfigCommon = - (struct RACH_ConfigCommon *) NULL; + struct LTE_RACH_ConfigCommon *rach_ConfigCommon = + (struct LTE_RACH_ConfigCommon *) NULL; protocol_ctxt_t ctxt; #if defined(ENABLE_ITTI) @@ -2524,44 +2525,50 @@ ue_scheduler(const module_id_t module_idP, UE_mac_inst[module_idP].crnti, txFrameP, txSubframeP, eNB_indexP); #if defined(ENABLE_ITTI) + if(module_idP == 0){ + do { + // Checks if a message has been sent to MAC sub-task + itti_poll_msg(TASK_MAC_UE, &msg_p); - do { - // Checks if a message has been sent to MAC sub-task - itti_poll_msg(TASK_MAC_UE, &msg_p); + if (msg_p != NULL) { - if (msg_p != NULL) { + switch (ITTI_MSG_ID(msg_p)) { + case RRC_MAC_CCCH_DATA_REQ: + LOG_I(MAC, + "Received %s from %s: instance %d, frameP %d, eNB_index %d\n", + ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), + RRC_MAC_CCCH_DATA_REQ(msg_p).frame, + RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); - switch (ITTI_MSG_ID(msg_p)) { - case RRC_MAC_CCCH_DATA_REQ: - LOG_I(MAC, - "Received %s from %s: instance %d, frameP %d, eNB_index %d\n", - ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), - RRC_MAC_CCCH_DATA_REQ(msg_p).frame, - RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); - - // TODO process CCCH data req. - break; + // TODO process CCCH data req. + break; - default: - LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p)); - break; + default: + LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p)); + break; + } + + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal(result == EXIT_SUCCESS, + "Failed to free memory (%d)!\n", result); } - - result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal(result == EXIT_SUCCESS, - "Failed to free memory (%d)!\n", result); - } - } + } while (msg_p != NULL); - + } #endif //Mac_rlc_xface->frameP=frameP; //Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //if (subframe%5 == 0) //LG#ifdef EXMIMO - pdcp_run(&ctxt); + + // data to/from NETLINK is treated in pdcp_run. + // one socket is used in multiple UE's L2 FAPI simulator and + // only first UE need to do this. + if(module_idP == 0){ + pdcp_run(&ctxt); + } //#endif UE_mac_inst[module_idP].txFrame = txFrameP; UE_mac_inst[module_idP].txSubframe = txSubframeP; @@ -2600,7 +2607,7 @@ ue_scheduler(const module_id_t module_idP, eNB_indexP); //Invalid...need to add another MAC UE state for re-connection procedure phy_config_afterHO_ue(module_idP, 0, eNB_indexP, - (MobilityControlInfo_t *) NULL, 1); + (LTE_MobilityControlInfo_t *) NULL, 1); //return(3); break; @@ -2765,7 +2772,7 @@ ue_scheduler(const module_id_t module_idP, physicalConfigDedicated->schedulingRequestConfig == NULL) || (UE_mac_inst[module_idP]. physicalConfigDedicated->schedulingRequestConfig->present == - SchedulingRequestConfig_PR_release)) { + LTE_SchedulingRequestConfig_PR_release)) { // initiate RA with CRNTI included in msg3 (no contention) as descibed in 36.321 sec 5.1.5 @@ -2776,7 +2783,7 @@ ue_scheduler(const module_id_t module_idP, } // Put this in a function // Call PHR procedure as described in Section 5.4.6 in 36.321 - if (UE_mac_inst[module_idP].PHR_state == MAC_MainConfig__phr_Config_PR_setup) { // normal operation + if (UE_mac_inst[module_idP].PHR_state == LTE_MAC_MainConfig__phr_Config_PR_setup) { // normal operation if (UE_mac_inst[module_idP].PHR_reconfigured == 1) { // upon (re)configuration of the power headroom reporting functionality by upper layers UE_mac_inst[module_idP].PHR_reporting_active = 1; @@ -3037,7 +3044,7 @@ update_bsr(module_id_t module_idP, frame_t frameP, rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti,eNB_index,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO, lcid, 0xFFFF //TBS is not used in RLC at this step, set a special value for debug -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -3182,63 +3189,63 @@ int get_sf_periodicBSRTimer(uint8_t sf_offset) { switch (sf_offset) { - case PeriodicBSR_Timer_r12_sf5: + case LTE_PeriodicBSR_Timer_r12_sf5: return 5; break; - case PeriodicBSR_Timer_r12_sf10: + case LTE_PeriodicBSR_Timer_r12_sf10: return 10; break; - case PeriodicBSR_Timer_r12_sf16: + case LTE_PeriodicBSR_Timer_r12_sf16: return 16; break; - case PeriodicBSR_Timer_r12_sf20: + case LTE_PeriodicBSR_Timer_r12_sf20: return 20; break; - case PeriodicBSR_Timer_r12_sf32: + case LTE_PeriodicBSR_Timer_r12_sf32: return 32; break; - case PeriodicBSR_Timer_r12_sf40: + case LTE_PeriodicBSR_Timer_r12_sf40: return 40; break; - case PeriodicBSR_Timer_r12_sf64: + case LTE_PeriodicBSR_Timer_r12_sf64: return 64; break; - case PeriodicBSR_Timer_r12_sf80: + case LTE_PeriodicBSR_Timer_r12_sf80: return 80; break; - case PeriodicBSR_Timer_r12_sf128: + case LTE_PeriodicBSR_Timer_r12_sf128: return 128; break; - case PeriodicBSR_Timer_r12_sf160: + case LTE_PeriodicBSR_Timer_r12_sf160: return 160; break; - case PeriodicBSR_Timer_r12_sf320: + case LTE_PeriodicBSR_Timer_r12_sf320: return 320; break; - case PeriodicBSR_Timer_r12_sf640: + case LTE_PeriodicBSR_Timer_r12_sf640: return 640; break; - case PeriodicBSR_Timer_r12_sf1280: + case LTE_PeriodicBSR_Timer_r12_sf1280: return 1280; break; - case PeriodicBSR_Timer_r12_sf2560: + case LTE_PeriodicBSR_Timer_r12_sf2560: return 2560; break; - case PeriodicBSR_Timer_r12_infinity: + case LTE_PeriodicBSR_Timer_r12_infinity: default: return 0xFFFF; break; @@ -3249,27 +3256,27 @@ int get_sf_retxBSRTimer(uint8_t sf_offset) { switch (sf_offset) { - case RetxBSR_Timer_r12_sf320: + case LTE_RetxBSR_Timer_r12_sf320: return 320; break; - case RetxBSR_Timer_r12_sf640: + case LTE_RetxBSR_Timer_r12_sf640: return 640; break; - case RetxBSR_Timer_r12_sf1280: + case LTE_RetxBSR_Timer_r12_sf1280: return 1280; break; - case RetxBSR_Timer_r12_sf2560: + case LTE_RetxBSR_Timer_r12_sf2560: return 2560; break; - case RetxBSR_Timer_r12_sf5120: + case LTE_RetxBSR_Timer_r12_sf5120: return 5120; break; - case RetxBSR_Timer_r12_sf10240: + case LTE_RetxBSR_Timer_r12_sf10240: return 10240; break; @@ -3283,32 +3290,32 @@ int get_ms_bucketsizeduration(uint8_t bucketsizeduration) { switch (bucketsizeduration) { - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50: return 50; break; - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms100: return 100; break; - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms150: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms150: return 150; break; - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms300: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms300: return 300; break; - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms500: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms500: return 500; break; - case LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000: + case LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms1000: return 1000; break; @@ -3369,19 +3376,19 @@ int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer) int get_db_dl_PathlossChange(uint8_t dl_PathlossChange) { switch (dl_PathlossChange) { - case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1: + case LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1: return 1; break; - case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3: + case LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3: return 3; break; - case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB6: + case LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB6: return 6; break; - case MAC_MainConfig__phr_Config__setup__dl_PathlossChange_infinity: + case LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_infinity: default: return -1; break; @@ -3478,7 +3485,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ue->slsch_lcid, req, (char*)(ue->slsch_pdu.payload + sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG)) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,ue->sourceL2Id, ue->destinationL2Id #endif diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc deleted file mode 100644 index 2f5cea7555..0000000000 --- a/openair2/LAYER2/Makefile.inc +++ /dev/null @@ -1,118 +0,0 @@ -ifeq ($(OPENAIR2),1) -EXTRA_CFLAGS += -DOPENAIR2 -endif -EXTRA_CFLAGS += -DASSERT -EXTRA_CFLAGS += -DNO_RRM - -COMMON_DIR = $(OPENAIR2_TOP)/COMMON -L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE -RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v9.3.0 -RLC_AM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/AM_v9.3.0 -RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM_v9.3.0 -RLC_DIR = $(OPENAIR2_TOP)/LAYER2/RLC -PDCP_DIR = $(OPENAIR2_TOP)/LAYER2/PDCP_v10.1.0 -PHY_INTERFACE_DIR = $(OPENAIR2_TOP)/PHY_INTERFACE -RRC_DIR = $(OPENAIR2_TOP)/RRC/LITE -L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE -MAC_DIR = $(OPENAIR2_TOP)/LAYER2/MAC -RRC_CELL_DIR = $(OPENAIR2_TOP)/RRC/CELLULAR - -SOURCES_L2 += $(OPENAIR2_TOP)/LAYER2/openair2_proc.c - -SOURCES_L2 += $(PDCP_DIR)/pdcp.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_fifo.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_sequence_manager.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_primitives.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_util.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_security.c -SOURCES_L2 += $(PDCP_DIR)/pdcp_netlink.c - -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_init.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_poll_retransmit.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_reordering.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_status_prohibit.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_segment.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_segments_holes.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_in_sdu.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_receiver.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_retransmit.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_windows.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_rx_list.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_reassembly.c -SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_status_report.c - - -SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm.c -SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_init.c - -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_fsm.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_control_primitives.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_segment.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_reassembly.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_receiver.c -SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_dar.c - -SOURCES_L2 += $(RLC_DIR)/rlc_mac.c -SOURCES_L2 += $(RLC_DIR)/rlc.c -SOURCES_L2 += $(RLC_DIR)/rlc_rrc.c -SOURCES_L2 += $(RLC_DIR)/rlc_mpls.c - -RRC_OBJS = $(RRC_DIR)/rrc_UE.o -ifeq ($(ENABLE_RAL),1) -RRC_OBJS += $(RRC_DIR)/rrc_UE_ral.o -RRC_OBJS += $(RRC_DIR)/rrc_eNB_ral.o -endif - -RRC_OBJS += $(RRC_DIR)/rrc_eNB.o -RRC_OBJS += $(RRC_DIR)/rrc_eNB_UE_context.o -RRC_OBJS += $(RRC_DIR)/rrc_eNB_S1AP.o -ifdef USE_MME -RRC_OBJS += $(RRC_DIR)/rrc_eNB_GTPV1U.o -endif -RRC_OBJS += $(RRC_DIR)/rrc_common.o -RRC_OBJS += $(RRC_DIR)/L2_interface.o - -MAC_OBJS = $(MAC_DIR)/lte_transport_init.o -MAC_OBJS += $(MAC_DIR)/main.o -MAC_OBJS += $(MAC_DIR)/ue_procedures.o -MAC_OBJS += $(MAC_DIR)/ra_procedures.o -MAC_OBJS += $(MAC_DIR)/l1_helpers.o -MAC_OBJS += $(MAC_DIR)/rar_tools.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_dlsch.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_ulsch.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_mch.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_bch.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_primitives.o -MAC_OBJS += $(MAC_DIR)/eNB_scheduler_RA.o -MAC_OBJS += $(MAC_DIR)/pre_processor.o -MAC_OBJS += $(MAC_DIR)/config.o - -L2_INTERFACE_OBJS = $(L2_INTERFACE_DIR)/openair_rrc_L2_interface.o - -L2_OBJS=$(addsuffix .o,$(basename $(SOURCES_L2))) $(PHY_INTERFACE_OBJS) $(MAC_OBJS) $(L2_INTERFACE_OBJS) - -L2_incl = -I$(OPENAIR2_TOP) -L2_incl = -I$(OPENAIR_DIR)/common/utils/msc -L2_incl += -I$(COMMON_DIR) -L2_incl += -I$(RLC_DIR) -L2_incl += -I$(RLC_AM_DIR) -L2_incl += -I$(RLC_UM_DIR) -L2_incl += -I$(RLC_TM_DIR) -L2_incl += -I$(PDCP_DIR) -L2_incl += -I$(OPENAIR3)/MESH -L2_incl += -I$(OPENAIR2_TOP)/RRC/LITE/MESSAGES -L2_incl += -I$(OPENAIR3)/MESH/RRM - -ifeq ($(rrc_cellular),1) - include $(RRC_CELL_DIR)/Makefile.inc - L2_OBJS += $(RRC_CELLULAR_OBJS) - L2_incl += -I$(OPENAIR2_TOP)/RRC/CELLULAR - EXTRA_CFLAGS += -DRRC_CELLULAR -DCELLULAR -else - L2_OBJS += $(RRC_OBJS) - L2_incl += -I$(OPENAIR2_TOP)/RRC/LITE -endif - diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 05ddb4151f..b21a5c2422 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -49,7 +49,7 @@ #include "platform_constants.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "msc.h" - +#include "targets/COMMON/openairinterface5g_limits.h" #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" #endif @@ -64,9 +64,12 @@ #endif extern int otg_enabled; - +#if defined(ENABLE_USE_MME) +extern uint8_t nfapi_mode; +#endif #include "common/ran_context.h" extern RAN_CONTEXT_t RC; +hash_table_t *pdcp_coll_p = NULL; #ifdef MBMS_MULTICAST_OUT # include @@ -96,7 +99,7 @@ boolean_t pdcp_data_req( const sdu_size_t sdu_buffer_sizeP, unsigned char *const sdu_buffer_pP, const pdcp_transmission_mode_t modeP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id #endif @@ -143,7 +146,7 @@ boolean_t pdcp_data_req( if (srb_flagP) { AssertError (rb_idP < 3, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rnti); } else { - AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); + AssertError (rb_idP < LTE_maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); } } @@ -182,8 +185,9 @@ boolean_t pdcp_data_req( (unsigned char*)&pdcp_pdu_p->data[0], sdu_buffer_sizeP); #endif + LOG_D(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP); rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -317,7 +321,7 @@ boolean_t pdcp_data_req( pdcp_apply_security(ctxt_pP, pdcp_p, srb_flagP, - rb_idP % maxDRB, + rb_idP % LTE_maxDRB, pdcp_header_len, current_sn, pdcp_pdu_p->data, @@ -366,8 +370,9 @@ boolean_t pdcp_data_req( LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size, "[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP); + LOG_D(PDCP, "Before rlc_data_req 2, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP); rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,sourceL2Id ,destinationL2Id #endif @@ -471,6 +476,7 @@ pdcp_data_ind( LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP, "[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP); + #if T_TRACER if (ctxt_pP->enb_flag != ENB_FLAG_NO) T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP)); @@ -504,15 +510,15 @@ pdcp_data_ind( } } else { - rb_id = rb_idP % maxDRB; - AssertError (rb_id < maxDRB, return FALSE, "RB id is too high (%u/%d) %u UE %x!\n", + rb_id = rb_idP % LTE_maxDRB; + AssertError (rb_id < LTE_maxDRB, return FALSE, "RB id is too high (%u/%d) %u UE %x!\n", rb_id, - maxDRB, + LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); AssertError (rb_id > 0, return FALSE, "RB id is too low (%u/%d) %u UE %x!\n", rb_id, - maxDRB, + LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_id, srb_flagP); @@ -795,18 +801,30 @@ pdcp_data_ind( * for the UE compiled in noS1 mode, we need 0 * TODO: be sure of this */ - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + if (nfapi_mode == 3) { +#ifdef UESIM_EXPANSION + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 0; +#else + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; +#endif + } else { + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + } #endif } else { - ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB); + ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB); + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; } - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; + // new_sdu_p->data->inst is set again in UE case so move to above. + //Panos: Commented this out because it cancels the assignment in #if defined(ENABLE_USE_MME) case + //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; #ifdef DEBUG_PDCP_FIFO_FLUSH_SDU static uint32_t pdcp_inst = 0; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = pdcp_inst++; LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size); #endif + //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; //pdcp_inst++; memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \ &sdu_buffer_pP->data[payload_offset], \ @@ -962,7 +980,7 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).frame, 0, RRC_DCCH_DATA_REQ (msg_p).eNB_index); - LOG_I(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", + LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), @@ -972,6 +990,7 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).mode); + LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %d \n", RRC_DCCH_DATA_REQ (msg_p).rb_id); result = pdcp_data_req (&ctxt, SRB_FLAG_YES, RRC_DCCH_DATA_REQ (msg_p).rb_id, @@ -980,7 +999,7 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).sdu_size, RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).mode -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , NULL, NULL #endif ); @@ -1083,8 +1102,8 @@ pdcp_remove_UE( ) //----------------------------------------------------------------------------- { - DRB_Identity_t srb_id = 0; - DRB_Identity_t drb_id = 0; + LTE_DRB_Identity_t srb_id = 0; + LTE_DRB_Identity_t drb_id = 0; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; int i; @@ -1102,7 +1121,7 @@ pdcp_remove_UE( h_rc = hashtable_remove(pdcp_coll_p, key); } - for (drb_id=0; drb_idmodule_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_remove(pdcp_coll_p, key); @@ -1131,44 +1150,44 @@ pdcp_remove_UE( boolean_t rrc_pdcp_config_asn1_req ( const protocol_ctxt_t* const ctxt_pP, - SRB_ToAddModList_t *const srb2add_list_pP, - DRB_ToAddModList_t *const drb2add_list_pP, - DRB_ToReleaseList_t *const drb2release_list_pP, + LTE_SRB_ToAddModList_t *const srb2add_list_pP, + LTE_DRB_ToAddModList_t *const drb2add_list_pP, + LTE_DRB_ToReleaseList_t *const drb2release_list_pP, const uint8_t security_modeP, uint8_t *const kRRCenc_pP, uint8_t *const kRRCint_pP, uint8_t *const kUPenc_pP -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,PMCH_InfoList_r9_t* const pmch_InfoList_r9_pP +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,LTE_PMCH_InfoList_r9_t* const pmch_InfoList_r9_pP #endif ,rb_id_t *const defaultDRB ) //----------------------------------------------------------------------------- { long int lc_id = 0; - DRB_Identity_t srb_id = 0; + LTE_DRB_Identity_t srb_id = 0; long int mch_id = 0; rlc_mode_t rlc_type = RLC_MODE_NONE; - DRB_Identity_t drb_id = 0; - DRB_Identity_t *pdrb_id_p = NULL; + LTE_DRB_Identity_t drb_id = 0; + LTE_DRB_Identity_t *pdrb_id_p = NULL; uint8_t drb_sn = 12; uint8_t srb_sn = 5; // fixed sn for SRBs uint8_t drb_report = 0; long int cnt = 0; uint16_t header_compression_profile = 0; config_action_t action = CONFIG_ACTION_ADD; - SRB_ToAddMod_t *srb_toaddmod_p = NULL; - DRB_ToAddMod_t *drb_toaddmod_p = NULL; + LTE_SRB_ToAddMod_t *srb_toaddmod_p = NULL; + LTE_DRB_ToAddMod_t *drb_toaddmod_p = NULL; pdcp_t *pdcp_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; hash_key_t key_defaultDRB = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_defaultDRB_rc; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) int i,j; - MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; - MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; + LTE_MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; + LTE_MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; #endif LOG_T(PDCP, PROTOCOL_CTXT_FMT" %s() SRB2ADD %p DRB2ADD %p DRB2RELEASE %p\n", @@ -1215,12 +1234,12 @@ rrc_pdcp_config_asn1_req ( if (srb_toaddmod_p->rlc_Config) { switch (srb_toaddmod_p->rlc_Config->present) { - case SRB_ToAddMod__rlc_Config_PR_NOTHING: + case LTE_SRB_ToAddMod__rlc_Config_PR_NOTHING: break; - case SRB_ToAddMod__rlc_Config_PR_explicitValue: + case LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue: switch (srb_toaddmod_p->rlc_Config->choice.explicitValue.present) { - case RLC_Config_PR_NOTHING: + case LTE_RLC_Config_PR_NOTHING: break; default: @@ -1245,7 +1264,7 @@ rrc_pdcp_config_asn1_req ( break; - case SRB_ToAddMod__rlc_Config_PR_defaultValue: + case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue: pdcp_config_req_asn1 ( ctxt_pP, pdcp_p, @@ -1294,7 +1313,7 @@ rrc_pdcp_config_asn1_req ( continue; } - DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); + DevCheck4(drb_id < LTE_maxDRB, drb_id, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1343,7 +1362,7 @@ rrc_pdcp_config_asn1_req ( if (drb_toaddmod_p->pdcp_Config->rlc_AM) { drb_report = drb_toaddmod_p->pdcp_Config->rlc_AM->statusReportRequired; - drb_sn = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; // default SN size + drb_sn = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; // default SN size rlc_type = RLC_MODE_AM; } @@ -1353,12 +1372,12 @@ rrc_pdcp_config_asn1_req ( } switch (drb_toaddmod_p->pdcp_Config->headerCompression.present) { - case PDCP_Config__headerCompression_PR_NOTHING: - case PDCP_Config__headerCompression_PR_notUsed: + case LTE_PDCP_Config__headerCompression_PR_NOTHING: + case LTE_PDCP_Config__headerCompression_PR_notUsed: header_compression_profile=0x0; break; - case PDCP_Config__headerCompression_PR_rohc: + case LTE_PDCP_Config__headerCompression_PR_rohc: // parse the struc and get the rohc profile if(drb_toaddmod_p->pdcp_Config->headerCompression.choice.rohc.profiles.profile0x0001) { @@ -1463,7 +1482,7 @@ rrc_pdcp_config_asn1_req ( } } -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) if (pmch_InfoList_r9_pP != NULL) { for (i=0; ilist.count; i++) { @@ -1480,7 +1499,7 @@ rrc_pdcp_config_asn1_req ( // can set the mch_id = i if (ctxt_pP->enb_flag) { - drb_id = (mch_id * maxSessionPerPMCH ) + lc_id ;//+ (maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1 + drb_id = (mch_id * LTE_maxSessionPerPMCH ) + lc_id ;//+ (LTE_maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1 if (pdcp_mbms_array_eNB[ctxt_pP->module_id][mch_id][lc_id].instanciated_instance == TRUE) { action = CONFIG_ACTION_MBMS_MODIFY; @@ -1488,7 +1507,7 @@ rrc_pdcp_config_asn1_req ( action = CONFIG_ACTION_MBMS_ADD; } } else { - drb_id = (mch_id * maxSessionPerPMCH ) + lc_id; // + (maxDRB + 3); // 15 + drb_id = (mch_id * LTE_maxSessionPerPMCH ) + lc_id; // + (LTE_maxDRB + 3); // 15 if (pdcp_mbms_array_ue[ctxt_pP->module_id][mch_id][lc_id].instanciated_instance == TRUE) { action = CONFIG_ACTION_MBMS_MODIFY; @@ -1580,9 +1599,9 @@ pdcp_config_req_asn1 ( pdcp_pP->header_compression_profile = header_compression_profileP; pdcp_pP->status_report = rb_reportP; - if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) { + if (rb_snP == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) { pdcp_pP->seq_num_size = PDCP_SN_12BIT; - } else if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { + } else if (rb_snP == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { pdcp_pP->seq_num_size = PDCP_SN_7BIT; } else { pdcp_pP->seq_num_size = PDCP_SN_5BIT; @@ -1640,9 +1659,9 @@ pdcp_config_req_asn1 ( kUPenc_pP); } - if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { + if (rb_snP == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { pdcp_pP->seq_num_size = 7; - } else if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) { + } else if (rb_snP == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) { pdcp_pP->seq_num_size = 12; } else { pdcp_pP->seq_num_size=5; @@ -1685,7 +1704,7 @@ pdcp_config_req_asn1 ( memset(pdcp_pP, 0, sizeof(pdcp_t)); break; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) case CONFIG_ACTION_MBMS_ADD: case CONFIG_ACTION_MBMS_MODIFY: @@ -2006,7 +2025,7 @@ void pdcp_layer_init(void) module_id_t instance; int i,j; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) mbms_session_id_t session_id; mbms_service_id_t service_id; #endif @@ -2014,14 +2033,14 @@ void pdcp_layer_init(void) * Initialize SDU list */ list_init(&pdcp_sdu_list, NULL); - pdcp_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, pdcp_free); + pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free); AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed"); for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - for (service_id = 0; service_id < maxServiceCount; service_id++) { - for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) { + for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) { + for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) { memset(&pdcp_mbms_array_ue[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t)); } } @@ -2032,10 +2051,10 @@ void pdcp_layer_init(void) for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - for (service_id = 0; service_id < maxServiceCount; service_id++) { - for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) { + for (service_id = 0; service_id < LTE_maxServiceCount; service_id++) { + for (session_id = 0; session_id < LTE_maxSessionPerPMCH; session_id++) { memset(&pdcp_mbms_array_eNB[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t)); } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 054bb5fac4..69157b6398 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -42,13 +42,13 @@ #include "RRC/LTE/rrc_defs.h" #include "COMMON/platform_constants.h" #include "COMMON/platform_types.h" -#include "DRB-ToAddMod.h" -#include "DRB-ToAddModList.h" -#include "SRB-ToAddMod.h" -#include "SRB-ToAddModList.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MBMS-SessionInfoList-r9.h" -#include "PMCH-InfoList-r9.h" +#include "LTE_DRB-ToAddMod.h" +#include "LTE_DRB-ToAddModList.h" +#include "LTE_SRB-ToAddMod.h" +#include "LTE_SRB-ToAddModList.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_MBMS-SessionInfoList-r9.h" +#include "LTE_PMCH-InfoList-r9.h" #endif @@ -195,7 +195,7 @@ typedef struct pdcp_s { } pdcp_t; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) typedef struct pdcp_mbms_s { boolean_t instanciated_instance; rb_id_t rb_id; @@ -232,7 +232,7 @@ boolean_t pdcp_data_req( const sdu_size_t sdu_buffer_size, unsigned char* const sdu_buffer, const pdcp_transmission_mode_t mode -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id #endif @@ -292,15 +292,15 @@ void rrc_pdcp_config_req ( */ boolean_t rrc_pdcp_config_asn1_req ( const protocol_ctxt_t* const ctxt_pP, - SRB_ToAddModList_t *const srb2add_list, - DRB_ToAddModList_t *const drb2add_list, - DRB_ToReleaseList_t *const drb2release_list, + LTE_SRB_ToAddModList_t *const srb2add_list, + LTE_DRB_ToAddModList_t *const drb2add_list, + LTE_DRB_ToReleaseList_t *const drb2release_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kRRCint, uint8_t *const kUPenc -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,PMCH_InfoList_r9_t *pmch_InfoList_r9 +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9 #endif ,rb_id_t *const defaultDRB ); @@ -404,7 +404,7 @@ typedef struct pdcp_data_req_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t traffic_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif @@ -415,7 +415,7 @@ typedef struct pdcp_data_ind_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t dummy_traffic_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif @@ -429,7 +429,7 @@ struct pdcp_netlink_element_s { }; //TTN for D2D (PC5S) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #define PDCP_SOCKET_PORT_NO 9999 //temporary value #define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value int pdcp_pc5_sockfd; @@ -499,9 +499,9 @@ pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode unsigned int pdcp_eNB_UE_instance_to_rnti_index; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h #endif sdu_size_t pdcp_output_sdu_bytes_to_write; sdu_size_t pdcp_output_header_bytes_to_write; @@ -542,7 +542,7 @@ sdu_size_t pdcp_input_sdu_remaining_size_to_read; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *pdcp_coll_p; +extern hash_table_t *pdcp_coll_p; #endif /*@}*/ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 92409d96dc..906fbaba5a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -82,10 +82,13 @@ extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; unsigned char pdcp_read_state_g = 0; +extern uint8_t nfapi_mode; +#ifdef UESIM_EXPANSION +extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif #endif extern Packet_OTG_List_t *otg_pdcp_buffer; - #if defined(LINK_ENB_PDCP_TO_GTPV1U) # include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_defs.h" @@ -168,7 +171,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ((pdcp_data_ind_header_t*) sdu_p->data)->inst, ((pdcp_data_ind_header_t *) sdu_p->data)->data_size); #else - ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + // Raphael: was suppressed by Raymond --> should be suppressed? + // value of sdu_p->data->inst is set in pdcp_data_ind + // it's necessary to set 1 in case of UE with S1. + //if (ctxt_pP->enb_flag){ + // ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + //} #endif #if defined(LINK_ENB_PDCP_TO_GTPV1U) @@ -178,7 +186,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) LOG_D(PDCP,"Sending to GTPV1U %d bytes\n", ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size); gtpv1u_new_data_req( ctxt_pP->module_id, //gtpv1u_data_t *gtpv1u_data_p, - ctxt_pP->rnti,//rb_id/maxDRB, TO DO UE ID + ctxt_pP->rnti,//rb_id/LTE_maxDRB, TO DO UE ID ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id + 4, &(((uint8_t *) sdu_p->data)[sizeof (pdcp_data_ind_header_t)]), ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, @@ -195,14 +203,14 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) #endif /* defined(ENABLE_USE_MME) */ #ifdef PDCP_DEBUG - LOG_D(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n", + LOG_I(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n", ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst, ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id); #endif //PDCP_DEBUG cont = 0; //TTN - for D2D (PC5S) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) sidelink_pc5s_element *sl_pc5s_msg_recv = NULL; char send_buf[BUFSIZE]; int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; @@ -452,7 +460,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , NULL, NULL #endif ); @@ -488,7 +496,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_t* pdcp_p = NULL; //TTN for D2D (PC5S) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int prose_addr_len; char send_buf[BUFSIZE], receive_buf[BUFSIZE]; //int optval; @@ -509,7 +517,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) while (pdcp_netlink_dequeue_element(ctxt_pP, &data_p) != 0) { DevAssert(data_p != NULL); - rab_id = data_p->pdcp_read_header.rb_id % maxDRB; + rab_id = data_p->pdcp_read_header.rb_id % LTE_maxDRB; // ctxt_pP->rnti is NOT_A_RNTI ctxt_cpy.rnti = pdcp_module_id_to_rnti[ctxt_cpy.module_id][data_p->pdcp_read_header.inst]; key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_cpy.rnti, ctxt_pP->enb_flag, rab_id, SRB_FLAG_NO); @@ -526,7 +534,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) CHECK_CTXT_ARGS(&ctxt_cpy); - AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB); + AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB); if (rab_id != 0) { LOG_D(PDCP, "[FRAME %05d][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ " @@ -543,7 +551,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) if ((data_p->pdcp_read_header.traffic_type == TRAFFIC_IPV6_TYPE_MULTICAST) /*TRAFFIC_IPV6_TYPE_MULTICAST */ || (data_p->pdcp_read_header.traffic_type == TRAFFIC_IPV4_TYPE_MULTICAST) /*TRAFFIC_IPV4_TYPE_MULTICAST */ || (data_p->pdcp_read_header.traffic_type == TRAFFIC_IPV4_TYPE_BROADCAST) /*TRAFFIC_IPV4_TYPE_BROADCAST */ ) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) PDCP_TRANSMISSION_MODE_TRANSPARENT; #else pdcp_mode= PDCP_TRANSMISSION_MODE_DATA; @@ -561,13 +569,13 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #endif pdcp_data_req(&ctxt_cpy, SRB_FLAG_NO, - rab_id % maxDRB, + rab_id % LTE_maxDRB, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, data_p->pdcp_read_header.data_size, data_p->data, pdcp_mode -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -595,7 +603,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) data_p->pdcp_read_header.data_size, data_p->data, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -612,7 +620,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) data_p->pdcp_read_header.data_size, data_p->data, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -632,7 +640,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) //TTN for D2D (PC5S) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) prose_addr_len = sizeof(prose_pdcp_addr); // receive a message from ProSe App memset(receive_buf, 0, BUFSIZE); @@ -680,18 +688,18 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ctxt.frame = ctxt_cpy.frame; ctxt.enb_flag = ENB_FLAG_YES; ctxt.module_id = pc5s_header.inst + oai_emulation.info.first_enb_local; - ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pc5s_header->rb_id / maxDRB + oai_emulation.info.first_ue_local]; - rab_id = pc5s_header->rb_id % maxDRB; + ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pc5s_header->rb_id / LTE_maxDRB + oai_emulation.info.first_ue_local]; + rab_id = pc5s_header->rb_id % LTE_maxDRB; } else { ctxt.frame = ctxt_cpy.frame; ctxt.enb_flag = ENB_FLAG_NO; ctxt.module_id = pc5s_header->inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; - rab_id = pc5s_header->rb_id % maxDRB; + rab_id = pc5s_header->rb_id % LTE_maxDRB; } CHECK_CTXT_ARGS(&ctxt); - AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB); + AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB); /*LGpdcp_read_header.inst = (pc5s_header.inst >= oai_emulation.info.nb_enb_local) ? \ pc5s_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : pc5s_header.inst + oai_emulation.info.first_enb_local;*/ @@ -706,11 +714,11 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) if (ctxt_cpy.enb_flag) { ctxt.module_id = 0; - rab_id = pc5s_header->rb_id % maxDRB; + rab_id = pc5s_header->rb_id % LTE_maxDRB; ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index]; } else { ctxt.module_id = 0; - rab_id = pc5s_header->rb_id % maxDRB; + rab_id = pc5s_header->rb_id % LTE_maxDRB; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; } #endif @@ -719,14 +727,14 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) if (!ctxt.enb_flag) { if (rab_id != 0) { if (rab_id == UE_IP_DEFAULT_RAB_ID) { - LOG_I(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", ctxt.module_id, ctxt.rnti, ctxt.enb_flag); key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); - LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n", + LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n", (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); } else { - rab_id = rab_id % maxDRB; + rab_id = rab_id % LTE_maxDRB; LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n", ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); @@ -774,7 +782,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pc5s_header->data_size, (unsigned char *)receive_buf, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,&pc5s_header->sourceL2Id ,&pc5s_header->destinationL2Id #endif @@ -832,7 +840,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pc5s_header->data_size, (unsigned char *)receive_buf, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,&pc5s_header->sourceL2Id ,&pc5s_header->destinationL2Id #endif @@ -897,18 +905,18 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ctxt.frame = ctxt_cpy.frame; ctxt.enb_flag = ENB_FLAG_YES; ctxt.module_id = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local; - ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local]; - rab_id = pdcp_read_header_g.rb_id % maxDRB; + ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / LTE_maxDRB + oai_emulation.info.first_ue_local]; + rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; } else { ctxt.frame = ctxt_cpy.frame; ctxt.enb_flag = ENB_FLAG_NO; ctxt.module_id = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; - rab_id = pdcp_read_header_g.rb_id % maxDRB; + rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; } CHECK_CTXT_ARGS(&ctxt); - AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB); + AssertFatal (rab_id < LTE_maxDRB, "RB id is too high (%u/%d)!\n", rab_id, LTE_maxDRB); /*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \ pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;*/ @@ -924,11 +932,19 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #endif if (ctxt_cpy.enb_flag) { ctxt.module_id = 0; - rab_id = pdcp_read_header_g.rb_id % maxDRB; - ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB]; + rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; + ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB]; } else { - ctxt.module_id = 0; - rab_id = pdcp_read_header_g.rb_id % maxDRB; + if (nfapi_mode == 3) { +#ifdef UESIM_EXPANSION + ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; +#else + ctxt.module_id = pdcp_read_header_g.inst; +#endif + } else { + ctxt.module_id = 0; + } + rab_id = pdcp_read_header_g.rb_id % LTE_maxDRB; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; } @@ -936,7 +952,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) if (ctxt.enb_flag) { if (rab_id != 0) { - rab_id = rab_id % maxDRB; + rab_id = rab_id % LTE_maxDRB; key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -979,7 +995,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -1016,7 +1032,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -1033,7 +1049,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n", (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id); } else { - rab_id = rab_id % maxDRB; + rab_id = rab_id % LTE_maxDRB; LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n", ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); @@ -1072,7 +1088,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.rb_id, rab_id, pdcp_read_header_g.data_size); - + if(nfapi_mode == 3){ pdcp_data_req( &ctxt, SRB_FLAG_NO, @@ -1082,11 +1098,27 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,NULL + ,NULL +#endif + ); + }else{ + pdcp_data_req( + &ctxt, + SRB_FLAG_NO, + rab_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header_g.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_TRANSMISSION_MODE_DATA +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,&pdcp_read_header_g.sourceL2Id ,&pdcp_read_header_g.destinationL2Id #endif ); + } } else { MSC_LOG_RX_DISCARDED_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, @@ -1130,7 +1162,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.rb_id, DEFAULT_RAB_ID, pdcp_read_header_g.data_size); - + if(nfapi_mode == 3){ pdcp_data_req ( &ctxt, SRB_FLAG_NO, @@ -1140,11 +1172,27 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,NULL + ,NULL +#endif + ); + }else{ + pdcp_data_req ( + &ctxt, + SRB_FLAG_NO, + DEFAULT_RAB_ID, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header_g.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_TRANSMISSION_MODE_DATA +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,&pdcp_read_header_g.sourceL2Id ,&pdcp_read_header_g.destinationL2Id #endif ); + } } } @@ -1188,7 +1236,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP) } //TTN for D2D (PC5S) -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void pdcp_pc5_socket_init() { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h index 291ec5e2a7..676ece7b3a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_proto_extern.h @@ -53,7 +53,7 @@ extern int reception_from_rohc_bs(void); extern BOOL pdcp_data_ind (module_id_t module_idP, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sduP, uint8_t is_data_plane); extern BOOL pdcp_data_req (module_id_t module_id, uint32_t frame, uint8_t eNB_flag, rb_id_t rab_id, uint32_t muiP, uint32_t confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, uint8_t is_data_pdu -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id #endif diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index 95a6c28ae6..83293a709d 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -62,7 +62,7 @@ uint32_t pdcp_get_next_count_tx( /* 5 bits length SN */ count = ((pdcp_pP->tx_hfn << 5) | (pdcp_sn & 0x001F)); } else { - if (pdcp_pP->seq_num_size == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { + if (pdcp_pP->seq_num_size == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { count = ((pdcp_pP->tx_hfn << 7) | (pdcp_sn & 0x07F)); } else { /*Default is the 12 bits length SN */ count = ((pdcp_pP->tx_hfn << 12) | (pdcp_sn & 0x0FFF)); @@ -88,7 +88,7 @@ uint32_t pdcp_get_next_count_rx( /* 5 bits length SN */ count = (((pdcp_pP->rx_hfn + pdcp_pP->rx_hfn_offset) << 5) | (pdcp_sn & 0x001F)); } else { - if (pdcp_pP->seq_num_size == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { + if (pdcp_pP->seq_num_size == LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { /* 7 bits length SN */ count = (((pdcp_pP->rx_hfn + pdcp_pP->rx_hfn_offset) << 7) | (pdcp_sn & 0x007F)); } else { // default diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index d4e43fda47..e2911efcaf 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -39,8 +39,8 @@ #include "list.h" #include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "UL-AM-RLC.h" -#include "DL-AM-RLC.h" +#include "LTE_UL-AM-RLC.h" +#include "LTE_DL-AM-RLC.h" //----------------------------------------------------------------------------- @@ -237,24 +237,24 @@ config_req_rlc_am ( PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p)); } } -uint16_t pollPDU_tab[PollPDU_pInfinity+1]= {4,8,16,32,64,128,256,RLC_AM_POLL_PDU_INFINITE}; //PollPDU_pInfinity is chosen to 0xFFFF for now -uint32_t maxRetxThreshold_tab[UL_AM_RLC__maxRetxThreshold_t32+1]= {1,2,3,4,6,8,16,32}; -uint32_t pollByte_tab[PollByte_spare1]= {25000,50000,75000,100000,125000,250000,375000,500000,750000,1000000,1250000,1500000,2000000,3000000,RLC_AM_POLL_BYTE_INFINITE}; // PollByte_kBinfinity is chosen to 0xFFFFFFFF for now -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -uint32_t PollRetransmit_tab[T_PollRetransmit_spare5]= {5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,2000,4000}; +uint16_t pollPDU_tab[LTE_PollPDU_pInfinity+1]= {4,8,16,32,64,128,256,RLC_AM_POLL_PDU_INFINITE}; //PollPDU_pInfinity is chosen to 0xFFFF for now +uint32_t maxRetxThreshold_tab[LTE_UL_AM_RLC__maxRetxThreshold_t32+1]= {1,2,3,4,6,8,16,32}; +uint32_t pollByte_tab[LTE_PollByte_spare1]= {25000,50000,75000,100000,125000,250000,375000,500000,750000,1000000,1250000,1500000,2000000,3000000,RLC_AM_POLL_BYTE_INFINITE}; // PollByte_kBinfinity is chosen to 0xFFFFFFFF for now +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +uint32_t PollRetransmit_tab[LTE_T_PollRetransmit_spare5]= {5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,2000,4000}; uint32_t am_t_Reordering_tab[32]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600}; -uint32_t t_StatusProhibit_tab[T_StatusProhibit_spare2]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,1200,1600,2000,2400}; +uint32_t t_StatusProhibit_tab[LTE_T_StatusProhibit_spare2]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,1200,1600,2000,2400}; #else -uint32_t PollRetransmit_tab[T_PollRetransmit_spare9]= {5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500}; -uint32_t am_t_Reordering_tab[T_Reordering_spare1]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; -uint32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500}; +uint32_t PollRetransmit_tab[LTE_T_PollRetransmit_spare9]= {5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500}; +uint32_t am_t_Reordering_tab[LTE_T_Reordering_spare1]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; +uint32_t t_StatusProhibit_tab[LTE_T_StatusProhibit_spare8]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500}; #endif //----------------------------------------------------------------------------- void config_req_rlc_am_asn1 ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, - const struct RLC_Config__am * const config_am_pP, + const struct LTE_RLC_Config__am * const config_am_pP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP) { @@ -268,17 +268,17 @@ void config_req_rlc_am_asn1 ( if (h_rc == HASH_TABLE_OK) { l_rlc_p = &rlc_union_p->rlc.am; - if ((config_am_pP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) && - (config_am_pP->ul_AM_RLC.pollPDU<=PollPDU_pInfinity) && - (config_am_pP->ul_AM_RLC.pollByte= MAKE_VERSION(14, 0, 0)) - (config_am_pP->ul_AM_RLC.t_PollRetransmitul_AM_RLC.maxRetxThreshold <= LTE_UL_AM_RLC__maxRetxThreshold_t32) && + (config_am_pP->ul_AM_RLC.pollPDU<=LTE_PollPDU_pInfinity) && + (config_am_pP->ul_AM_RLC.pollByte= MAKE_VERSION(14, 0, 0)) + (config_am_pP->ul_AM_RLC.t_PollRetransmitdl_AM_RLC.t_Reordering<32) && - (config_am_pP->dl_AM_RLC.t_StatusProhibitdl_AM_RLC.t_StatusProhibitul_AM_RLC.t_PollRetransmitdl_AM_RLC.t_Reorderingdl_AM_RLC.t_StatusProhibitul_AM_RLC.t_PollRetransmitLTE_T_PollRetransmit_spare9) && + (config_am_pP->dl_AM_RLC.t_Reorderingdl_AM_RLC.t_StatusProhibit $@ ;\ - [ -s $@ ] || rm -f $@' -.PRECIOUS: %.d - -all: ${TARGETLIB} - -${TARGETLIB}: ${TARGETOBJ} - ar -rv ${TARGETLIB} ${TARGETOBJ} - -clean: - rm -f ${TARGETDIR}/*.o ${TARGETDIR}/*.a - -clean_dep: - rm -f ${TARGETDIR}/*.d diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index b422748292..6cb849091a 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -32,7 +32,7 @@ #include "common/utils/LOG/log.h" #include "rlc_um_control_primitives.h" -#include "T-Reordering.h" +#include "LTE_T-Reordering.h" #include "msc.h" //----------------------------------------------------------------------------- @@ -78,10 +78,10 @@ void config_req_rlc_um ( } } //----------------------------------------------------------------------------- -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) const uint32_t t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600}; #else -const uint32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; +const uint32_t t_Reordering_tab[LTE_T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; #endif void config_req_rlc_um_asn1 ( @@ -90,11 +90,11 @@ void config_req_rlc_um_asn1 ( const MBMS_flag_t mbms_flagP, const mbms_session_id_t mbms_session_idP, const mbms_service_id_t mbms_service_idP, - const UL_UM_RLC_t * const ul_rlc_pP, - const DL_UM_RLC_t * const dl_rlc_pP, + const LTE_UL_UM_RLC_t * const ul_rlc_pP, + const LTE_DL_UM_RLC_t * const dl_rlc_pP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -108,7 +108,7 @@ void config_req_rlc_um_asn1 ( hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (mbms_flagP) { //AssertFatal(dl_rlc_pP, "No RLC UM DL config"); @@ -173,11 +173,11 @@ void config_req_rlc_um_asn1 ( if (ul_rlc_pP != NULL) { switch (ul_rlc_pP->sn_FieldLength) { - case SN_FieldLength_size5: + case LTE_SN_FieldLength_size5: ul_sn_FieldLength = 5; break; - case SN_FieldLength_size10: + case LTE_SN_FieldLength_size10: ul_sn_FieldLength = 10; break; @@ -201,11 +201,11 @@ void config_req_rlc_um_asn1 ( if (dl_rlc_pP != NULL) { switch (dl_rlc_pP->sn_FieldLength) { - case SN_FieldLength_size5: + case LTE_SN_FieldLength_size5: dl_sn_FieldLength = 5; break; - case SN_FieldLength_size10: + case LTE_SN_FieldLength_size10: dl_sn_FieldLength = 10; break; @@ -226,7 +226,7 @@ void config_req_rlc_um_asn1 ( return; } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (dl_rlc_pP->t_Reordering<32) { #else if (dl_rlc_pP->t_Reordering= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 846d406319..428f3c19c7 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -34,7 +34,7 @@ #include "common/utils/LOG/log.h" #include "UTIL/OCG/OCG_vars.h" #include "common/utils/LOG/vcd_signal_dumper.h" - +#include "targets/COMMON/openairinterface5g_limits.h" #include "assertions.h" extern boolean_t pdcp_data_ind( @@ -320,7 +320,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t * const sourceL2Id ,const uint32_t * const destinationL2Id #endif @@ -333,7 +333,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) rlc_mbms_id_t *mbms_id_p = NULL; logical_chan_id_t log_ch_id = 0; #endif @@ -347,7 +347,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, sdu_sizeP, sdu_pP); #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) #else AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP); #endif @@ -383,13 +383,13 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, return RLC_OP_STATUS_BAD_PARAMETER; } -#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0); #endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_IN); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flagP == TRUE) { if (ctxt_pP->enb_flag) { @@ -403,11 +403,18 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } if (sourceL2Id && destinationL2Id){ - key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP); + LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); + + //Thinh's line originally uncommented + //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP); + + //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP); } else #endif { + LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); } @@ -534,7 +541,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) } else { /* MBMS_flag != 0 */ // LOG_I(RLC,"DUY rlc_data_req: mbms_rb_id in RLC instant is: %d\n", mbms_rb_id); if (sdu_pP != NULL) { @@ -649,7 +656,7 @@ rlc_module_init (void) rlc_rrc_data_ind = NULL; rlc_rrc_data_conf = NULL; - rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union); + rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union); //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); if(rlc_coll_p == NULL) { LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n"); @@ -657,7 +664,7 @@ rlc_module_init (void) } for (module_id1=0; module_id1 < MAX_MOBILES_PER_ENB; module_id1++) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) for (k=0; k < RLC_MAX_MBMS_LC; k++) { rlc_mbms_lcid2service_session_id_ue[module_id1][k].service_id = 0; @@ -672,7 +679,7 @@ rlc_module_init (void) } for (module_id1=0; module_id1 < NUMBER_OF_eNB_MAX; module_id1++) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) for (k=0; k < RLC_MAX_MBMS_LC; k++) { rlc_mbms_lcid2service_session_id_eNB[module_id1][k].service_id = 0; diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 8c557188a2..fbb13373a3 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -44,19 +44,19 @@ # include "rlc_am_structs.h" # include "rlc_tm_structs.h" # include "rlc_um_structs.h" -# include "asn_constant.h" +# include "LTE_asn_constant.h" # include "common/utils/LOG/log.h" # include "mem_block.h" //# include "PHY/defs.h" -# include "RLC-Config.h" -# include "DRB-ToAddMod.h" -# include "DRB-ToAddModList.h" -# include "SRB-ToAddMod.h" -# include "SRB-ToAddModList.h" -# include "DRB-ToReleaseList.h" +# include "LTE_RLC-Config.h" +# include "LTE_DRB-ToAddMod.h" +# include "LTE_DRB-ToAddModList.h" +# include "LTE_SRB-ToAddMod.h" +# include "LTE_SRB-ToAddModList.h" +# include "LTE_DRB-ToReleaseList.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "PMCH-InfoList-r9.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_PMCH-InfoList-r9.h" #endif typedef uint64_t hash_key_t; @@ -132,8 +132,8 @@ typedef struct { // PRIVATE INTERNALS OF RLC //----------------------------------------------------------------------------- -#define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount) -#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_ENB) +#define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) +#define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) void (*rlc_rrc_data_ind)( const protocol_ctxt_t* const ctxtP, @@ -183,7 +183,7 @@ typedef struct rlc_mbms_id_s { mbms_session_id_t session_id; } rlc_mbms_id_t; -#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) # if !defined(maxServiceCount) //unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB # define maxServiceCount 1 @@ -285,7 +285,7 @@ struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, num_tb_t, crc_t //----------------------------------------------------------------------------- // PUBLIC INTERFACE WITH RRC //----------------------------------------------------------------------------- -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const SRB_ToAddMod_t* const srb2addmod, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP, const PMCH_InfoList_r9_t * const pmch_info_listP) * \brief Function for RRC to configure a Radio Bearer. * \param[in] ctxtP Running context. @@ -297,10 +297,10 @@ struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, num_tb_t, crc_t */ rlc_op_status_t rrc_rlc_config_asn1_req ( const protocol_ctxt_t* const, - const SRB_ToAddModList_t* const , - const DRB_ToAddModList_t* const , - const DRB_ToReleaseList_t* const , - const PMCH_InfoList_r9_t * const pmch_info_listP , + const LTE_SRB_ToAddModList_t* const , + const LTE_DRB_ToAddModList_t* const , + const LTE_DRB_ToReleaseList_t* const , + const LTE_PMCH_InfoList_r9_t * const pmch_info_listP , const uint32_t , const uint32_t ); #else @@ -314,9 +314,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req ( */ rlc_op_status_t rrc_rlc_config_asn1_req ( const protocol_ctxt_t* const, - const SRB_ToAddModList_t* const , - const DRB_ToAddModList_t* const , - const DRB_ToReleaseList_t* const ); + const LTE_SRB_ToAddModList_t* const , + const LTE_DRB_ToAddModList_t* const , + const LTE_DRB_ToReleaseList_t* const ); #endif @@ -358,7 +358,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const, const srb_fl * \return A status about the processing, OK or error code. */ rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id, const uint32_t destinationL2Id #endif @@ -424,7 +424,7 @@ void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t r * \return A status about the processing, OK or error code. */ tbs_size_t mac_rlc_data_req (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, const tb_size_t,char* -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -459,7 +459,7 @@ void mac_rlc_data_ind (const module_id_t, const rnti_t, con * \return The maximum number of bytes that the RLC instance can send in the next transmission sequence. */ mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t, const rnti_t, const eNB_index_t, const frame_t, const sub_frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, tb_size_t -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -514,7 +514,7 @@ rlc_op_status_t rlc_data_req ( const confirm_t , const sdu_size_t , mem_block_t * const -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t * const ,const uint32_t * const #endif diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index dbc2d1d342..d4ec487c85 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -128,7 +128,7 @@ tbs_size_t mac_rlc_data_req( const logical_chan_id_t channel_idP, const tb_size_t tb_sizeP, char *buffer_pP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -180,7 +180,7 @@ tbs_size_t mac_rlc_data_req( } } else { key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if ((sourceL2Id > 0) && (destinationL2Id > 0)) key = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag); #endif @@ -254,6 +254,7 @@ void mac_rlc_data_ind ( srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; protocol_ctxt_t ctxt; + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN); @@ -330,7 +331,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP, const tb_size_t tb_sizeP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -363,7 +364,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if ((sourceL2Id > 0) && (destinationL2Id > 0)) { key = RLC_COLL_KEY_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag); } else diff --git a/openair2/LAYER2/RLC/rlc_mpls.c b/openair2/LAYER2/RLC/rlc_mpls.c index 8c6cea379b..d6f7afa12d 100644 --- a/openair2/LAYER2/RLC/rlc_mpls.c +++ b/openair2/LAYER2/RLC/rlc_mpls.c @@ -41,7 +41,7 @@ rlc_op_status_t mpls_rlc_data_req ( //----------------------------------------------------------------------------- // third arg should be set to 1 or 0 return rlc_data_req(ctxtP, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 8977e422b6..63c24d6e3c 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -33,25 +33,25 @@ #include "rlc_um.h" #include "rlc_tm.h" #include "common/utils/LOG/log.h" -#include "RLC-Config.h" -#include "DRB-ToAddMod.h" -#include "DRB-ToAddModList.h" -#include "SRB-ToAddMod.h" -#include "SRB-ToAddModList.h" -#include "DL-UM-RLC.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "PMCH-InfoList-r9.h" +#include "LTE_RLC-Config.h" +#include "LTE_DRB-ToAddMod.h" +#include "LTE_DRB-ToAddModList.h" +#include "LTE_SRB-ToAddMod.h" +#include "LTE_SRB-ToAddModList.h" +#include "LTE_DL-UM-RLC.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#include "LTE_PMCH-InfoList-r9.h" #endif #include "LAYER2/MAC/mac_extern.h" #include "assertions.h" //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const SRB_ToAddModList_t * const srb2add_listP, - const DRB_ToAddModList_t * const drb2add_listP, - const DRB_ToReleaseList_t * const drb2release_listP -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,const PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP + const LTE_SRB_ToAddModList_t * const srb2add_listP, + const LTE_DRB_ToAddModList_t * const drb2add_listP, + const LTE_DRB_ToReleaseList_t * const drb2release_listP +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP ,const uint32_t sourceL2Id ,const uint32_t destinationL2Id #endif @@ -60,21 +60,21 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP //----------------------------------------------------------------------------- rb_id_t rb_id = 0; logical_chan_id_t lc_id = 0; - DRB_Identity_t drb_id = 0; - DRB_Identity_t* pdrb_id = NULL; + LTE_DRB_Identity_t drb_id = 0; + LTE_DRB_Identity_t* pdrb_id = NULL; long int cnt = 0; - const SRB_ToAddMod_t *srb_toaddmod_p = NULL; - const DRB_ToAddMod_t *drb_toaddmod_p = NULL; + const LTE_SRB_ToAddMod_t *srb_toaddmod_p = NULL; + const LTE_DRB_ToAddMod_t *drb_toaddmod_p = NULL; rlc_union_t *rlc_union_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) int i, j; - MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; - MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; + LTE_MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; + LTE_MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; mbms_session_id_t mbms_session_id; mbms_service_id_t mbms_service_id; - DL_UM_RLC_t dl_um_rlc; + LTE_DL_UM_RLC_t dl_um_rlc; #endif @@ -97,17 +97,17 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (srb_toaddmod_p->rlc_Config) { switch (srb_toaddmod_p->rlc_Config->present) { - case SRB_ToAddMod__rlc_Config_PR_NOTHING: + case LTE_SRB_ToAddMod__rlc_Config_PR_NOTHING: break; - case SRB_ToAddMod__rlc_Config_PR_explicitValue: + case LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue: switch (srb_toaddmod_p->rlc_Config->choice.explicitValue.present) { - case RLC_Config_PR_NOTHING: + case LTE_RLC_Config_PR_NOTHING: break; - case RLC_Config_PR_am: + case LTE_RLC_Config_PR_am: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -125,9 +125,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Bi_Directional: + case LTE_RLC_Config_PR_um_Bi_Directional: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -141,7 +141,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, rb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -153,9 +153,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Uni_Directional_UL: + case LTE_RLC_Config_PR_um_Uni_Directional_UL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -169,7 +169,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, rb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -181,9 +181,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Uni_Directional_DL: + case LTE_RLC_Config_PR_um_Uni_Directional_DL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -197,7 +197,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP NULL, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, rb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -218,19 +218,19 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case SRB_ToAddMod__rlc_Config_PR_defaultValue: + case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue: //#warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue LOG_I(RRC, "RLC SRB1 is default value !!\n"); - struct RLC_Config__am * config_am_pP = &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am; - config_am_pP->dl_AM_RLC.t_Reordering = T_Reordering_ms35; - config_am_pP->dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; - config_am_pP->ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms45; - config_am_pP->ul_AM_RLC.pollPDU = PollPDU_pInfinity; - config_am_pP->ul_AM_RLC.pollByte = PollByte_kBinfinity; - config_am_pP->ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t4; + struct LTE_RLC_Config__am * config_am_pP = &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am; + config_am_pP->dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + config_am_pP->dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0; + config_am_pP->ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms45; + config_am_pP->ul_AM_RLC.pollPDU = LTE_PollPDU_pInfinity; + config_am_pP->ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + config_am_pP->ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t4; if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -294,12 +294,12 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (drb_toaddmod_p->rlc_Config) { switch (drb_toaddmod_p->rlc_Config->present) { - case RLC_Config_PR_NOTHING: + case LTE_RLC_Config_PR_NOTHING: break; - case RLC_Config_PR_am: + case LTE_RLC_Config_PR_am: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -313,9 +313,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Bi_Directional: + case LTE_RLC_Config_PR_um_Bi_Directional: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,sourceL2Id, destinationL2Id #endif @@ -329,7 +329,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, drb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,sourceL2Id, destinationL2Id #endif @@ -338,9 +338,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Uni_Directional_UL: + case LTE_RLC_Config_PR_um_Uni_Directional_UL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -354,7 +354,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, drb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -362,9 +362,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP break; - case RLC_Config_PR_um_Uni_Directional_DL: + case LTE_RLC_Config_PR_um_Uni_Directional_DL: if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -378,7 +378,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP NULL, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, drb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -406,7 +406,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP } } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (pmch_InfoList_r9_pP != NULL) { for (i=0; ilist.count; i++) { @@ -424,13 +424,13 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP // can set the mch_id = i if (ctxt_pP->enb_flag) { - rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id;//+ (maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1 + rb_id = (mbms_service_id * LTE_maxSessionPerPMCH ) + mbms_session_id;//+ (LTE_maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1 rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].service_id = mbms_service_id; rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].session_id = mbms_session_id; rlc_mbms_enb_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id); } else { - rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id; // + (maxDRB + 3); // 15 + rb_id = (mbms_service_id * LTE_maxSessionPerPMCH ) + mbms_session_id; // + (LTE_maxDRB + 3); // 15 rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].service_id = mbms_service_id; rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].session_id = mbms_session_id; rlc_mbms_ue_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id); @@ -461,8 +461,8 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP mbms_session_id, mbms_service_id ); - dl_um_rlc.sn_FieldLength = SN_FieldLength_size5; - dl_um_rlc.t_Reordering = T_Reordering_ms0; + dl_um_rlc.sn_FieldLength = LTE_SN_FieldLength_size5; + dl_um_rlc.t_Reordering = LTE_T_Reordering_ms0; config_req_rlc_um_asn1 ( ctxt_pP, @@ -473,7 +473,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP NULL, &dl_um_rlc, rb_id, lc_id -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif ); @@ -536,7 +536,7 @@ rlc_op_status_t rrc_rlc_remove_ue ( rb_id); } - for (rb_id = 1; rb_id <= maxDRB; rb_id++) { + for (rb_id = 1; rb_id <= LTE_maxDRB; rb_id++) { rrc_rlc_remove_rlc(ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, @@ -560,14 +560,14 @@ rlc_op_status_t rrc_rlc_remove_rlc ( hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_lcid_rc; rlc_union_t *rlc_union_p = NULL; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) rlc_mbms_id_t *mbms_id_p = NULL; #endif /* for no gcc warnings */ (void)lcid; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flagP == TRUE) { if (ctxt_pP->enb_flag) { @@ -658,7 +658,7 @@ rlc_union_t* rrc_rlc_add_rlc ( const rb_id_t rb_idP, const logical_chan_id_t chan_idP, const rlc_mode_t rlc_modeP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t sourceL2Id, const uint32_t destinationL2Id #endif @@ -671,7 +671,7 @@ rlc_union_t* rrc_rlc_add_rlc ( hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_lcid_rc; rlc_union_t *rlc_union_p = NULL; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) rlc_mbms_id_t *mbms_id_p = NULL; logical_chan_id_t lcid = 0; #endif @@ -691,7 +691,7 @@ rlc_union_t* rrc_rlc_add_rlc ( } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flagP == TRUE) { if (ctxt_pP->enb_flag) { @@ -741,7 +741,7 @@ rlc_union_t* rrc_rlc_add_rlc ( h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p); if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flagP == TRUE) { LOG_I(RLC, PROTOCOL_CTXT_FMT" RLC service id %u session id %u rrc_rlc_add_rlc\n", @@ -806,7 +806,7 @@ rlc_op_status_t rrc_rlc_config_req ( case CONFIG_ACTION_ADD: if (rrc_rlc_add_rlc(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif @@ -885,7 +885,7 @@ rlc_op_status_t rrc_rlc_data_req ( if (sdu != NULL) { memcpy (sdu->data, sduP, sdu_sizeP); return rlc_data_req(ctxt_pP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); diff --git a/openair2/LAYER2/register.h b/openair2/LAYER2/register.h deleted file mode 100644 index 8a4aeb5b12..0000000000 --- a/openair2/LAYER2/register.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*________________________rrc_register.h________________________ - - Authors : Hicham Anouar, Raymond Knopp - Company : EURECOM - Emails : anouar@eurecom.fr, knopp@eurecom.fr -________________________________________________________________*/ - -#ifndef __MAC_RRC_REGISTER_H__ -# define __MAC_RRC_REGISTER_H__ -#include "COMMON/mac_rrc_primitives.h" -/** @defgroup _mac_impl_register RRC Registration interface - * @ingroup _mac_impl_ - *@{ - */ -MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE* RRC_xface); -int mac_rrc_unregister(RRC_XFACE *RRC_xface); -#endif diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h index e23188d357..f3f30f9224 100644 --- a/openair2/NETWORK_DRIVER/MESH/local.h +++ b/openair2/NETWORK_DRIVER/MESH/local.h @@ -64,6 +64,8 @@ #include "rrc_nas_primitives.h" #include "COMMON/platform_types.h" +#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c)) + struct rb_entity { nasRadioBearerId_t rab_id; nasSapId_t sapi; @@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t traffic_type; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint32_t sourceL2Id; + uint32_t destinationL2Id; +#endif } pdcp_data_req_header_t; typedef struct pdcp_data_ind_header_s { @@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t dummy_traffic_type; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint32_t sourceL2Id; + uint32_t destinationL2Id; +#endif } pdcp_data_ind_header_t; extern struct net_device *nasdev[NB_INSTANCES_MAX]; diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index b21ca5f2dc..1f05452708 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -248,7 +248,7 @@ ue_ip_common_ip2wireless( //--------------------------------------------------------------------------- struct pdcp_data_req_header_s pdcph; ue_ip_priv_t *priv_p=netdev_priv(ue_ip_dev[instP]); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ipversion_t *ipv_p = NULL; unsigned int hard_header_len = 0; unsigned char *src_addr = 0; @@ -304,7 +304,16 @@ ue_ip_common_ip2wireless( if (dst_addr) { printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, dst_addr[0],dst_addr[1],dst_addr[2],dst_addr[3]); } - + // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start +#ifdef UESIM_EXPANSION + if ((src_addr[3] - 2)> instP) { + pdcph.inst = src_addr[3] - 2; + printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst); + instP = src_addr[3] - 2; + priv_p=netdev_priv(ue_ip_dev[instP]); + } +#endif + // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator end //get Ipv4 address and pass to PCDP header printk("[UE_IP_DRV] source Id: 0x%08x\n",pdcph.sourceL2Id ); printk("[UE_IP_DRV] destinationL2Id Id: 0x%08x\n",pdcph.destinationL2Id ); diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index 47c820fe77..4f295543dc 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -394,7 +394,7 @@ int init_module (void) for (inst=0; inst= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif @@ -101,7 +101,7 @@ typedef struct pdcp_data_ind_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t dummy_traffic_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index bd9f4bb8b2..9ebee10f9b 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -33,13 +33,13 @@ void handle_rach(UL_IND_t *UL_info) { 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 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0 #endif ); } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) { AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n"); diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h index 0390a90551..b6ede7d598 100644 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -76,7 +76,7 @@ typedef struct{ /// RACH indication list nfapi_rach_indication_t rach_ind; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// RACH indication list for BR UEs nfapi_rach_indication_t rach_ind_br; #endif @@ -128,6 +128,17 @@ typedef struct IF_Module_s{ pthread_mutex_t if_mutex; }IF_Module_t; +// These mutex is used for multiple UEs L2 FAPI simulator. +// Each UEs set these value in UL and UL_INFO is shared in all UE's thread. +typedef struct { + pthread_mutex_t rx_mutex; + pthread_mutex_t crc_mutex; + pthread_mutex_t sr_mutex; + pthread_mutex_t harq_mutex; + pthread_mutex_t cqi_mutex; + pthread_mutex_t rach_mutex; +}FILL_UL_INFO_MUTEX_t; + /*Initial */ IF_Module_t *IF_Module_init(int Mod_id); void IF_Module_kill(int Mod_id); diff --git a/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h index 479bd47d94..954eaaa281 100644 --- a/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h +++ b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h @@ -10,7 +10,7 @@ #include "nfapi_interface.h" //#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h" -#include "PhysicalConfigDedicated-NB-r13.h" +#include "LTE_PhysicalConfigDedicated-NB-r13.h" //#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/COMMON/platform_types.h" //#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h" @@ -54,7 +54,7 @@ typedef struct{ uint16_t npdcch_Offset_USS; //Alfa_offset (see TS 36.213 ch 16.6) - ACK_NACK_NumRepetitions_NB_r13_t *ack_nack_numRepetitions_MSG4; //pointer to the first cell of a list of ack_nack_num_repetitions + LTE_ACK_NACK_NumRepetitions_NB_r13_t *ack_nack_numRepetitions_MSG4; //pointer to the first cell of a list of ack_nack_num_repetitions //ulPowerControlCommon (UE side) uint16_t p0_nominal_npusch; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 166616c368..0c961d9fbb 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -25,7 +25,11 @@ extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); - +UL_IND_t *UL_INFO = NULL; +nfapi_tx_request_pdu_t* tx_request_pdu_list = NULL; +nfapi_dl_config_request_t* dl_config_req = NULL; +nfapi_ul_config_request_t* ul_config_req = NULL; +nfapi_hi_dci0_request_t* hi_dci0_req = NULL; //extern uint8_t nfapi_pnf; //UL_IND_t *UL_INFO; @@ -47,7 +51,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND int timing_advance_update; - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + pthread_mutex_lock(&fill_ul_mutex.rx_mutex); UL_INFO->rx_ind.sfn_sf = frame<<4| subframe; @@ -65,7 +71,11 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND //pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3; pdu->rx_indication_rel8.length = buflen; pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation - pdu->data = ulsch_buffer; + + // ulsch_buffer is necessary to keep its value. + //pdu->data = ulsch_buffer; + pdu->data = malloc(buflen); + memcpy(pdu->data,ulsch_buffer,buflen); // estimate timing advance for MAC //sync_pos = lte_est_timing_advance_pusch(eNB,UE_id); timing_advance_update = 0; // Don't know what to put here @@ -80,7 +90,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND UL_INFO->rx_ind.rx_indication_body.number_of_pdus++; UL_INFO->rx_ind.sfn_sf = frame<<4 | subframe; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + pthread_mutex_unlock(&fill_ul_mutex.rx_mutex); } @@ -88,7 +100,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.sr_mutex); nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind; nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body; @@ -122,13 +136,17 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I //UL_INFO->rx_ind.rx_indication_body.number_of_pdus++; sr_ind_body->number_of_srs++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.sr_mutex); } void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t crc_flag, int index, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.crc_mutex); // REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE! nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs]; @@ -151,14 +169,21 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_ LOG_D(PHY, "%s() rnti:%04x pdus:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.crc_mutex); } void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI) { LOG_D(MAC, "fill_rach_indication_UE_MAC 1 \n"); - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); - UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); + + // change for mutiple UE's simulation. + // pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.rach_mutex); + + // memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4. + // UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); UL_INFO->rach_ind.rach_indication_body.number_of_preambles = 1; @@ -195,16 +220,22 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL // with that branch. oai_nfapi_rach_ind(&UL_INFO->rach_ind); free(UL_INFO->rach_ind.rach_indication_body.preamble_list); - free(UL_INFO); + + // memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4. + //free(UL_INFO); //} - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.rach_mutex); } void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subframe, UL_IND_t *UL_INFO, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.cqi_mutex); nfapi_cqi_indication_pdu_t *pdu = &UL_INFO->cqi_ind.cqi_pdu_list[UL_INFO->cqi_ind.number_of_cqis]; nfapi_cqi_indication_raw_pdu_t *raw_pdu = &UL_INFO->cqi_ind.cqi_raw_pdu_list[UL_INFO->cqi_ind.number_of_cqis]; @@ -233,14 +264,18 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram UL_INFO->cqi_ind.number_of_cqis++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); - + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex); } void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IND_t *UL_INFO, nfapi_ul_config_ulsch_harq_information *harq_information, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.harq_mutex); + nfapi_harq_indication_pdu_t *pdu = &UL_INFO->harq_ind.harq_indication_body.harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; int i; @@ -271,8 +306,9 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN } UL_INFO->harq_ind.harq_indication_body.number_of_harqs++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); -} + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);} void fill_uci_harq_indication_UE_MAC(int Mod_id, @@ -285,7 +321,10 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, uint16_t tdd_multiplexing_mask*/) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.harq_mutex); + nfapi_harq_indication_t *ind = &UL_INFO->harq_ind; nfapi_harq_indication_body_t *body = &ind->harq_indication_body; nfapi_harq_indication_pdu_t *pdu = &body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; @@ -311,6 +350,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, else if (SNRtimes10 > 635) pdu->ul_cqi_information.ul_cqi=255; else pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5; pdu->ul_cqi_information.channel = 0; + if(harq_information->harq_information_rel9_fdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG){ if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) && (harq_information->harq_information_rel9_fdd.harq_size == 1)) { @@ -332,12 +372,31 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX) } - else AssertFatal(1==0,"only format 1a/b for now, received \n"); + }else if(harq_information->harq_information_rel10_tdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG ){ + if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 0) && + (harq_information->harq_information_rel10_tdd.harq_size == 1)) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = 0; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; + + } else if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 1) && + (harq_information->harq_information_rel10_tdd.harq_size == 2)) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = 0; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; + pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = 1; + + } + } else AssertFatal(1==0,"only format 1a/b for now, received \n"); UL_INFO->harq_ind.harq_indication_body.number_of_harqs++; LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d\n", UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.harq_mutex); } @@ -590,7 +649,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, //Mod_id = 0; // Currently static (only for one UE) but this should change. /*struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];*/ + L1_rxtx_proc_t *proc = &eNB->proc.L1_proc;*/ nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list; nfapi_dl_config_request_pdu_t *dl_config_pdu_tmp; @@ -622,7 +681,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, //if(tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data!= NULL && tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_length >0){ */ - if(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1){ + // to avoid unexpected error , add check pdu_index is more than 0. + if((dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index >= 0) &&(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1)){ //if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){ LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems); @@ -941,14 +1001,14 @@ void UE_config_stub_pnf(void) { /* Dummy functions*/ -void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc, +void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) { } -void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc, +void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) { @@ -957,14 +1017,14 @@ void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rx void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, int frame, int subframe, - eNB_rxtx_proc_t *proc, + L1_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu) { } -void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, +void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t *sdu) { @@ -972,7 +1032,7 @@ void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, } -void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc, +void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t codeword_index, uint8_t *sdu) @@ -981,7 +1041,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr } -void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, +void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, nfapi_ul_config_request_pdu_t *ul_config_pdu, uint16_t frame,uint8_t subframe,uint8_t srs_present) { diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 9060951b26..21fb8518fa 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -17,19 +17,23 @@ //#include "openair1/PHY/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h" -UL_IND_t *UL_INFO; - -nfapi_tx_request_pdu_t* tx_request_pdu_list; +// this mutex is used to set multiple UE's UL value in L2 FAPI simulator. +FILL_UL_INFO_MUTEX_t fill_ul_mutex; +//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. +extern UL_IND_t *UL_INFO; +extern nfapi_tx_request_pdu_t* tx_request_pdu_list; // New /// Pointers to config_request types. Used from nfapi callback functions. -nfapi_dl_config_request_t* dl_config_req; -nfapi_ul_config_request_t* ul_config_req; -nfapi_hi_dci0_request_t* hi_dci0_req; +//below 3 difinitions move to phy_stub_UE.c to add initialization when difinition. +extern nfapi_dl_config_request_t* dl_config_req; +extern nfapi_ul_config_request_t* ul_config_req; +extern nfapi_hi_dci0_request_t* hi_dci0_req; int tx_req_num_elems; -int next_ra_frame; -module_id_t next_Mod_id; +//below 2 difinitions move to lte-ue.c to add initialization when difinition. +//int next_ra_frame; +//module_id_t next_Mod_id; eth_params_t stub_eth_params; diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index d201732177..4265a841e9 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -38,7 +38,7 @@ #include "common/ran_context.h" #if defined(ENABLE_ITTI) -# include "intertask_interface.h" + #include "intertask_interface.h" #endif #include "flexran_agent_extern.h" @@ -54,7 +54,7 @@ mac_rrc_data_req( const frame_t frameP, const rb_id_t Srb_id, const uint8_t Nb_tb, - uint8_t* const buffer_pP, + uint8_t *const buffer_pP, const uint8_t mbsfn_sync_area ) //-------------------------------------------------------------------------- @@ -64,164 +64,158 @@ mac_rrc_data_req( uint8_t Sdu_size = 0; uint8_t sfn = (uint8_t)((frameP>>2)&0xff); - if (LOG_DEBUGFLAG(DEBUG_RRC)) { LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); } eNB_RRC_INST *rrc; rrc_eNB_carrier_data_t *carrier; - BCCH_BCH_Message_t *mib; + LTE_BCCH_BCH_Message_t *mib; + rrc = RC.rrc[Mod_idP]; + carrier = &rrc->carrier[0]; + mib = &carrier->mib; - - rrc = RC.rrc[Mod_idP]; - carrier = &rrc->carrier[0]; - mib = &carrier->mib; - - if((Srb_id & RAB_OFFSET) == BCCH) { - if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) { - return 0; - } - - // All even frames transmit SIB in SF 5 - AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, - "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); - - if ((frameP%2) == 0) { - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB1, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); - - if (LOG_DEBUGFLAG(DEBUG_RRC)) { - LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); - - for (int i=0; icarrier[CC_id].sizeof_SIB1; i++) { - LOG_T(RRC,"%x.",buffer_pP[i]); - } - - LOG_T(RRC,"\n"); - } /* LOG_DEBUGFLAG(DEBUG_RRC) */ - - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); - } // All RFN mod 8 transmit SIB2-3 in SF 5 - else if ((frameP%8) == 1) { - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB23, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); - - if (LOG_DEBUGFLAG(DEBUG_RRC)) { - LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); - - for (int i=0; icarrier[CC_id].sizeof_SIB23; i++) { - LOG_T(RRC,"%x.",buffer_pP[i]); - } - - LOG_T(RRC,"\n"); - } /* LOG_DEBUGFLAG(DEBUG_RRC) */ - return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); - } else { - return(0); - } - } - if( (Srb_id & RAB_OFFSET ) == MIBCH) { - - mib->message.systemFrameNumber.buf = &sfn; - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, - NULL, - (void*)mib, - carrier->MIB, - 24); - LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); - buffer_pP[0]=carrier->MIB[0]; - buffer_pP[1]=carrier->MIB[1]; - buffer_pP[2]=carrier->MIB[2]; - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return(3); + if((Srb_id & RAB_OFFSET) == BCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) { + return 0; } - if( (Srb_id & RAB_OFFSET ) == CCCH) { - LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); - - if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { - LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); - return -1; - } - - Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; - - // check if data is there for MAC - if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer - LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload); - - memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); - Sdu_size = Srb_info->Tx_buffer.payload_size; - Srb_info->Tx_buffer.payload_size=0; - } - - return (Sdu_size); - } - - if( (Srb_id & RAB_OFFSET ) == PCCH) { - LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); - - // check if data is there for MAC - if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer - LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); - - memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); - Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]; - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0; - } - - return (Sdu_size); - } - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - - if((Srb_id & RAB_OFFSET) == MCCH) { - if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) { - return 0; // this parameter is set in function init_mcch in rrc_eNB.c - } + // All even frames transmit SIB in SF 5 + AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, + "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); + if ((frameP%2) == 0) { memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + RC.rrc[Mod_idP]->carrier[CC_id].SIB1, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); - if (LOG_DEBUGFLAG(DEBUG_RRC)) { - LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); + if (LOG_DEBUGFLAG(DEBUG_RRC)) { + LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); - for (int i=0; icarrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) { - LOG_T(RRC,"%x.",buffer_pP[i]); - } + for (int i=0; icarrier[CC_id].sizeof_SIB1; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } - LOG_T(RRC,"\n"); - } /* LOG_DEBUGFLAG(DEBUG_RRC) */ + LOG_T(RRC,"\n"); + } /* LOG_DEBUGFLAG(DEBUG_RRC) */ - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); + } // All RFN mod 8 transmit SIB2-3 in SF 5 + else if ((frameP%8) == 1) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); + + if (LOG_DEBUGFLAG(DEBUG_RRC)) { + LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); + + for (int i=0; icarrier[CC_id].sizeof_SIB23; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); + } /* LOG_DEBUGFLAG(DEBUG_RRC) */ + + return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); + } else { + return(0); + } + } + + if( (Srb_id & RAB_OFFSET ) == MIBCH) { + mib->message.systemFrameNumber.buf = &sfn; + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message, + NULL, + (void *)mib, + carrier->MIB, + 24); + LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); + buffer_pP[0]=carrier->MIB[0]; + buffer_pP[1]=carrier->MIB[1]; + buffer_pP[2]=carrier->MIB[2]; + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return(3); + } + + if( (Srb_id & RAB_OFFSET ) == CCCH) { + LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { + LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); + return -1; } -#endif // #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){ - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + // check if data is there for MAC + if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer + LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload); + memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); + Sdu_size = Srb_info->Tx_buffer.payload_size; + Srb_info->Tx_buffer.payload_size=0; } - if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3 - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + return (Sdu_size); + } + + if( (Srb_id & RAB_OFFSET ) == PCCH) { + LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + // check if data is there for MAC + if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer + LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); + memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); + Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]; + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0; } + return (Sdu_size); + } + +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + + if((Srb_id & RAB_OFFSET) == MCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) { + return 0; // this parameter is set in function init_mcch in rrc_eNB.c + } + + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + + if (LOG_DEBUGFLAG(DEBUG_RRC)) { + LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); + + for (int i=0; icarrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); + } /* LOG_DEBUGFLAG(DEBUG_RRC) */ + + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + } + +#endif // #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + + if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + } + + if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR) { // First SI message with SIB2/3 + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + } + #endif - - return(0); } @@ -234,7 +228,7 @@ mac_rrc_data_ind( const sub_frame_t sub_frameP, const rnti_t rntiP, const rb_id_t srb_idP, - const uint8_t* sduP, + const uint8_t *sduP, const sdu_size_t sdu_lenP, const uint8_t mbsfn_sync_areaP ) @@ -243,42 +237,44 @@ mac_rrc_data_ind( SRB_INFO *Srb_info; protocol_ctxt_t ctxt; sdu_size_t sdu_size = 0; - /* for no gcc warnings */ (void)sdu_size; - /* int si_window; */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); - if((srb_idP & RAB_OFFSET) == CCCH) { + if((srb_idP & RAB_OFFSET) == CCCH) { Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); - + // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); if (sdu_lenP > 0) { memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); Srb_info->Rx_buffer.payload_size = sdu_lenP; rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id); } + } + + if((srb_idP & RAB_OFFSET) == DCCH) { + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP); + + if(ue_context_p) { + rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, + ue_context_p, + 0); + ue_context_p->ue_context.Status = RRC_RECONFIGURED; } - if((srb_idP & RAB_OFFSET) == DCCH) { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP); - if(ue_context_p){ - rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, - ue_context_p, - 0); - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - } - } + } return(0); - } //------------------------------------------------------------------------------ +/* +* Get RRC status (Connected, Idle...) of UE from RNTI +*/ int mac_eNB_get_rrc_status( const module_id_t Mod_idP, @@ -286,10 +282,8 @@ mac_eNB_get_rrc_status( ) //------------------------------------------------------------------------------ { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[Mod_idP], - rntiP); + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP], rntiP); if (ue_context_p != NULL) { return(ue_context_p->ue_context.Status); @@ -299,60 +293,59 @@ mac_eNB_get_rrc_status( } void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[Mod_instP], rntiP); if (ue_context_p != NULL) { LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); + if(ue_context_p->ue_context.ul_failure_timer == 0) ue_context_p->ue_context.ul_failure_timer=1; - } - else { + } else { LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); } + if (rrc_agent_registered[Mod_instP]) { agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP, - rntiP, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + rntiP, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } + rrc_mac_remove_ue(Mod_instP,rntiP); } void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[Mod_instP], - rntiP); - if (ue_context_p != NULL) { - LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP); + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_instP], + rntiP); - if(ue_context_p->ue_context.ul_failure_timer == 0) - ue_context_p->ue_context.ul_failure_timer=19999; - } - else { - LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP); - } + if (ue_context_p != NULL) { + LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP); + + if(ue_context_p->ue_context.ul_failure_timer == 0) + ue_context_p->ue_context.ul_failure_timer=19999; + } else { + LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP); + } } -void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; +void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[Mod_instP], rntiP); diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index 3b7219af42..9dfbeed61e 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -63,7 +63,7 @@ mac_rrc_data_req_ue( LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LOG_D(RRC,"[UE %d] Frame %d Filling SL DISCOVERY SRB_ID %d\n",Mod_idP,frameP,Srb_id); LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size); @@ -217,7 +217,7 @@ mac_rrc_data_ind_ue( } } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if ((srb_idP & RAB_OFFSET) == MCCH) { LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n", @@ -253,7 +253,7 @@ mac_rrc_data_ind_ue( decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP); } -#endif // #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#endif // #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) return(0); @@ -327,7 +327,7 @@ rrc_data_req_ue( sdu_sizeP, buffer_pP, modeP -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); diff --git a/openair2/RRC/LTE/MESSAGES/Makefile.inc b/openair2/RRC/LTE/MESSAGES/Makefile.inc deleted file mode 100644 index aa17ad51ca..0000000000 --- a/openair2/RRC/LTE/MESSAGES/Makefile.inc +++ /dev/null @@ -1,91 +0,0 @@ - -current_release_asn1_module=$(strip $(notdir $(wildcard $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-*))) - -ifdef CBA - COMMON_CFLAGS += -DRel10 - COMMON_CFLAGS += -DCBA - ifneq ($(current_release_asn1_module), .lock-rel10-cba) - tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\ - rm EUTRA-RRC-Definitions.asn ;\ - ln -s EUTRA-RRC-Definitions-a20-lola.asn EUTRA-RRC-Definitions.asn ; \ - cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\ - rm -f $(ASN1_MSG_OBJS1) ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\ - rm -f $(L2_OBJS) ;\ - rm -f *.o ;\ - rm -f oaisim ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\ - touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10-cba ;\ - /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated ) - endif - -else ifdef Rel10 - COMMON_CFLAGS += -DRel10 - ifneq ($(current_release_asn1_module), .lock-rel10) - tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\ - rm EUTRA-RRC-Definitions.asn ;\ - ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ;\ - cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\ - rm -f $(ASN1_MSG_OBJS1) ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\ - rm -f $(L2_OBJS) ;\ - rm -f *.o ;\ - rm -f oaisim ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\ - touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10 ;\ - /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated ) - endif - -else # default is rel 8 - COMMON_CFLAGS += -DRel8 - ifneq ($(current_release_asn1_module), .lock-rel8) - tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\ - rm EUTRA-RRC-Definitions.asn ;\ - ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ;\ - cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\ - rm -f $(ASN1_MSG_OBJS1) ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\ - rm -f $(L2_OBJS);\ - rm -f *.o ;\ - rm -f oaisim ;\ - rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\ - touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8 ;\ - /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\ - cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated ) - endif - -endif - -tmp:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\ - if [ ! -s Makefile.am.sample ] ; then \ - /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\ - fi ;\ - if [ ! -s Makefile.inc.generated ] ; then \ - awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated ;\ - fi ) - -include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated - -ASN_CONVERTER_SOURCES+=asn1_msg.c - -#COMMON_CFLAGS += -DEMIT_ASN_DEBUG=1 - -EXTRA_CFLAGS += -I. -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES - -ASN1_MODULE_OBJS=${ASN_MODULE_SOURCES:.c=.o} -ASN1_CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} -ASN1_MSG_OBJS=$(ASN1_MODULE_OBJS) $(ASN1_CONVERTER_OBJS) diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index f75d73224e..6d831741c2 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -39,56 +39,56 @@ #include #include /* for _ASN_DEFAULT_STACK_MAX */ #include - +#include "targets/RT/USER/lte-softmodem.h" #include "assertions.h" -#include "RRCConnectionRequest.h" -#include "UL-CCCH-Message.h" -#include "UL-DCCH-Message.h" -#include "DL-CCCH-Message.h" -#include "DL-DCCH-Message.h" -#include "PCCH-Message.h" +#include "LTE_RRCConnectionRequest.h" +#include "LTE_UL-CCCH-Message.h" +#include "LTE_UL-DCCH-Message.h" +#include "LTE_DL-CCCH-Message.h" +#include "LTE_DL-DCCH-Message.h" +#include "LTE_PCCH-Message.h" #include "openair3/UTILS/conversions.h" -#include "EstablishmentCause.h" -#include "RRCConnectionSetup.h" -#include "SRB-ToAddModList.h" -#include "DRB-ToAddModList.h" -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "MCCH-Message.h" -//#define MRB1 1 +#include "LTE_EstablishmentCause.h" +#include "LTE_RRCConnectionSetup.h" +#include "LTE_SRB-ToAddModList.h" +#include "LTE_DRB-ToAddModList.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + #include "LTE_MCCH-Message.h" + //#define MRB1 1 #endif #include "RRC/LTE/rrc_defs.h" #include "RRC/LTE/rrc_extern.h" -#include "RRCConnectionSetupComplete.h" -#include "RRCConnectionReconfigurationComplete.h" -#include "RRCConnectionReconfiguration.h" -#include "MasterInformationBlock.h" -#include "SystemInformation.h" +#include "LTE_RRCConnectionSetupComplete.h" +#include "LTE_RRCConnectionReconfigurationComplete.h" +#include "LTE_RRCConnectionReconfiguration.h" +#include "LTE_MasterInformationBlock.h" +#include "LTE_SystemInformation.h" -#include "SystemInformationBlockType1.h" +#include "LTE_SystemInformationBlockType1.h" -#include "SIB-Type.h" +#include "LTE_SIB-Type.h" -#include "BCCH-DL-SCH-Message.h" -#include "SBCCH-SL-BCH-MessageType.h" -#include "SBCCH-SL-BCH-Message.h" +#include "LTE_BCCH-DL-SCH-Message.h" +#include "LTE_SBCCH-SL-BCH-MessageType.h" +#include "LTE_SBCCH-SL-BCH-Message.h" //#include "PHY/defs.h" -#include "MeasObjectToAddModList.h" -#include "ReportConfigToAddModList.h" -#include "MeasIdToAddModList.h" +#include "LTE_MeasObjectToAddModList.h" +#include "LTE_ReportConfigToAddModList.h" +#include "LTE_MeasIdToAddModList.h" #include "enb_config.h" #if defined(ENABLE_ITTI) -# include "intertask_interface.h" + #include "intertask_interface.h" #endif #include "common/ran_context.h" #include "secu_defs.h" #if !defined (msg) -#define msg printf + #define msg printf #endif @@ -99,7 +99,7 @@ typedef struct xer_sprint_string_s { } xer_sprint_string_t; extern unsigned char NB_eNB_INST; -extern uint8_t usim_test; + extern RAN_CONTEXT_t RC; @@ -117,8 +117,7 @@ uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellI * This is a helper function for xer_sprint, which directs all incoming data * into the provided string. */ -static int xer__print2s (const void *buffer, size_t size, void *app_key) -{ +static int xer__print2s (const void *buffer, size_t size, void *app_key) { xer_sprint_string_t *string_buffer = (xer_sprint_string_t *) app_key; size_t string_remaining = string_buffer->string_size - string_buffer->string_index; @@ -134,15 +133,12 @@ static int xer__print2s (const void *buffer, size_t size, void *app_key) return 0; } -int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr) -{ +int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr) { asn_enc_rval_t er; xer_sprint_string_t string_buffer; - string_buffer.string = string; string_buffer.string_size = string_size; string_buffer.string_index = 0; - er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer); if (er.encoded < 0) { @@ -158,14 +154,12 @@ int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, voi return er.encoded; } -uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) -{ +uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) { return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]); } /* This only works for the hexagonal topology...need a more general function for other topologies */ -uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) -{ +uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) { uint8_t i; for(i=0; i<7; i++) { @@ -178,59 +172,57 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) return 0xFF; //error! } -uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) -{ - +uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) { asn_enc_rval_t enc_rval; - BCCH_BCH_Message_t *mib=&carrier->mib ; + LTE_BCCH_BCH_Message_t *mib=&carrier->mib ; uint8_t sfn = (uint8_t)((frame>>2)&0xff); - uint16_t *spare= calloc(1, sizeof(uint16_t)); + uint16_t *spare = calloc(1, sizeof(uint16_t)); + if (spare == NULL) abort(); switch (N_RB_DL) { + case 6: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n6; + break; - case 6: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6; - break; + case 15: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n15; + break; - case 15: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15; - break; + case 25: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n25; + break; - case 25: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25; - break; + case 50: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n50; + break; - case 50: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50; - break; + case 75: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n75; + break; - case 75: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75; - break; + case 100: + mib->message.dl_Bandwidth = LTE_MasterInformationBlock__dl_Bandwidth_n100; + break; - case 100: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100; - break; - default: - AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + default: + AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); } - AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); + AssertFatal(phich_Resource <= LTE_PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); mib->message.phich_Config.phich_Resource = phich_Resource; - AssertFatal(phich_duration <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n"); + AssertFatal(phich_duration <= LTE_PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n"); mib->message.phich_Config.phich_Duration = phich_duration; - LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n", - (uint32_t)mib->message.dl_Bandwidth, - (uint32_t)phich_duration, - (uint32_t)phich_Resource, - (uint32_t)sfn); - + LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x, sfn %x\n", + (uint32_t)mib->message.dl_Bandwidth, + (uint32_t)phich_duration, + (uint32_t)phich_Resource, + (uint32_t)sfn); mib->message.systemFrameNumber.buf = &sfn; mib->message.systemFrameNumber.size = 1; mib->message.systemFrameNumber.bits_unused=0; mib->message.spare.buf = (uint8_t *)spare; -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0)) mib->message.spare.size = 2; mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits #else @@ -238,35 +230,14 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC #endif - - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message, NULL, - (void*)mib, + (void *)mib, carrier->MIB, 24); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_BCH_Message, (void *) &mib)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p); - } - } -# endif -#endif - */ if (enc_rval.encoded==-1) { return(-1); } @@ -276,58 +247,55 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich //TTN for D2D // 3GPP 36.331 (Section 5.10.7.4) -uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, uint32_t frame, uint8_t subframe, uint8_t in_coverage, uint8_t mode) -{ +uint8_t do_MIB_SL(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, uint32_t frame, uint8_t subframe, uint8_t in_coverage, uint8_t mode) { + asn_enc_rval_t enc_rval; + LTE_SBCCH_SL_BCH_MessageType_t *mib_sl = &UE_rrc_inst[ctxt_pP->module_id].mib_sl[eNB_index]; + uint8_t sfn = (uint8_t)((frame>>2)&0xff); + UE_rrc_inst[ctxt_pP->module_id].MIB = (uint8_t *) malloc16(4); - asn_enc_rval_t enc_rval; - SBCCH_SL_BCH_MessageType_t *mib_sl = &UE_rrc_inst[ctxt_pP->module_id].mib_sl[eNB_index]; - uint8_t sfn = (uint8_t)((frame>>2)&0xff); - UE_rrc_inst[ctxt_pP->module_id].MIB = (uint8_t*) malloc16(4); + if (in_coverage > 0 ) { + //in coverage + mib_sl->inCoverage_r12 = TRUE; + mib_sl->sl_Bandwidth_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth; - if (in_coverage > 0 ){ - //in coverage - mib_sl->inCoverage_r12 = TRUE; - mib_sl->sl_Bandwidth_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth; - if (UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config) { - mib_sl->tdd_ConfigSL_r12.subframeAssignmentSL_r12 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config->subframeAssignment; - } else { - mib_sl->tdd_ConfigSL_r12.subframeAssignmentSL_r12 = TDD_ConfigSL_r12__subframeAssignmentSL_r12_none; - } - //if triggered by sl communication - if (UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12){ - mib_sl->reserved_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12; - } - //if triggered by sl discovery - if (UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12){ - mib_sl->reserved_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12; - } - //Todo - if triggered by v2x - } else { - //Todo - out of coverage for V2X - // Todo - UE has a selected SyncRef UE - mib_sl->inCoverage_r12 = FALSE; - //set sl-Bandwidth, subframeAssignmentSL and reserved from the pre-configured parameters - } + if (UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config) { + mib_sl->tdd_ConfigSL_r12.subframeAssignmentSL_r12 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config->subframeAssignment; + } else { + mib_sl->tdd_ConfigSL_r12.subframeAssignmentSL_r12 = LTE_TDD_ConfigSL_r12__subframeAssignmentSL_r12_none; + } - //set FrameNumber, subFrameNumber - mib_sl->directFrameNumber_r12.buf = &sfn; - mib_sl->directFrameNumber_r12.size = 1; - mib_sl->directFrameNumber_r12.bits_unused=0; - mib_sl->directSubframeNumber_r12 = subframe; + //if triggered by sl communication + if (UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12) { + mib_sl->reserved_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12; + } + //if triggered by sl discovery + if (UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12) { + mib_sl->reserved_r12 = *UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->txParameters_r12->syncInfoReserved_r12; + } + //Todo - if triggered by v2x + } else { + //Todo - out of coverage for V2X + // Todo - UE has a selected SyncRef UE + mib_sl->inCoverage_r12 = FALSE; + //set sl-Bandwidth, subframeAssignmentSL and reserved from the pre-configured parameters + } + + //set FrameNumber, subFrameNumber + mib_sl->directFrameNumber_r12.buf = &sfn; + mib_sl->directFrameNumber_r12.size = 1; + mib_sl->directFrameNumber_r12.bits_unused=0; + mib_sl->directSubframeNumber_r12 = subframe; LOG_I(RRC,"[MIB-SL] sfn %x, subframe %x\n", (uint32_t)sfn, (uint8_t)subframe); - - - enc_rval = uper_encode_to_buffer(&asn_DEF_SBCCH_SL_BCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_SBCCH_SL_BCH_Message, NULL, - (void*)mib_sl, + (void *)mib_sl, UE_rrc_inst[ctxt_pP->module_id].MIB, 24); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - if (enc_rval.encoded==-1) { return(-1); } @@ -337,49 +305,40 @@ uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, - int Mod_id,int CC_id + int Mod_id,int CC_id #if defined(ENABLE_ITTI) - , RrcConfigurationReq *configuration + , RrcConfigurationReq *configuration #endif - ) -{ - + ) { // SystemInformation_t systemInformation; #if defined(ENABLE_ITTI) int num_plmn = configuration->num_plmn; #else int num_plmn = 1; #endif - PLMN_IdentityInfo_t PLMN_identity_info[num_plmn]; - MCC_MNC_Digit_t dummy_mcc[num_plmn][3], dummy_mnc[num_plmn][3]; + LTE_PLMN_IdentityInfo_t PLMN_identity_info[num_plmn]; + LTE_MCC_MNC_Digit_t dummy_mcc[num_plmn][3], dummy_mnc[num_plmn][3]; asn_enc_rval_t enc_rval; - SchedulingInfo_t schedulingInfo; - SIB_Type_t sib_type; - + LTE_SchedulingInfo_t schedulingInfo; + LTE_SIB_Type_t sib_type; uint8_t *buffer = carrier->SIB1; - BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1; - SystemInformationBlockType1_t **sib1 = &carrier->sib1; + LTE_BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1; + LTE_SystemInformationBlockType1_t **sib1 = &carrier->sib1; int i; - - - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); - bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; - bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; + memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_t)); + bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_PR_c1; + bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; // memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t)); - *sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; - - memset(PLMN_identity_info,0,num_plmn * sizeof(PLMN_IdentityInfo_t)); - memset(&schedulingInfo,0,sizeof(SchedulingInfo_t)); - memset(&sib_type,0,sizeof(SIB_Type_t)); + memset(PLMN_identity_info,0,num_plmn * sizeof(LTE_PLMN_IdentityInfo_t)); + memset(&schedulingInfo,0,sizeof(LTE_SchedulingInfo_t)); + memset(&sib_type,0,sizeof(LTE_SIB_Type_t)); /* as per TS 36.311, up to 6 PLMN_identity_info are allowed in list -> add one by one */ for (i = 0; i < configuration->num_plmn; ++i) { PLMN_identity_info[i].plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info[i].plmn_Identity.mcc)); memset(PLMN_identity_info[i].plmn_Identity.mcc,0,sizeof(*PLMN_identity_info[i].plmn_Identity.mcc)); - asn_set_empty(&PLMN_identity_info[i].plmn_Identity.mcc->list);//.size=0; - #if defined(ENABLE_ITTI) dummy_mcc[i][0] = (configuration->mcc[i] / 100) % 10; dummy_mcc[i][1] = (configuration->mcc[i] / 10) % 10; @@ -392,7 +351,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list,&dummy_mcc[i][0]); ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list,&dummy_mcc[i][1]); ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list,&dummy_mcc[i][2]); - PLMN_identity_info[i].plmn_Identity.mnc.list.size=0; PLMN_identity_info[i].plmn_Identity.mnc.list.count=0; #if defined(ENABLE_ITTI) @@ -426,12 +384,10 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, } //assign_enum(&PLMN_identity_info.cellReservedForOperatorUse,PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved); - PLMN_identity_info[i].cellReservedForOperatorUse=PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; - + PLMN_identity_info[i].cellReservedForOperatorUse=LTE_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; ASN_SEQUENCE_ADD(&(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list,&PLMN_identity_info[i]); } - // 16 bits (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2); #if defined(ENABLE_ITTI) @@ -443,7 +399,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #endif (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2; (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0; - // 28 bits (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8); #if defined(ENABLE_ITTI) @@ -459,89 +414,62 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #endif (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4; (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4; - // assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred); - (*sib1)->cellAccessRelatedInfo.cellBarred=SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred; - + (*sib1)->cellAccessRelatedInfo.cellBarred=LTE_SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred; // assign_enum(&(*sib1)->cellAccessRelatedInfo.intraFreqReselection,SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_allowed); - (*sib1)->cellAccessRelatedInfo.intraFreqReselection=SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed; + (*sib1)->cellAccessRelatedInfo.intraFreqReselection=LTE_SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed; (*sib1)->cellAccessRelatedInfo.csg_Indication=0; - (*sib1)->cellSelectionInfo.q_RxLevMin=-65; (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL; //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t)); - //*((*sib1)->p_Max) = 23; + // *((*sib1)->p_Max) = 23; (*sib1)->freqBandIndicator = #if defined(ENABLE_ITTI) configuration->eutra_band[CC_id]; #else 7; #endif - - schedulingInfo.si_Periodicity=SchedulingInfo__si_Periodicity_rf8; - + schedulingInfo.si_Periodicity=LTE_SchedulingInfo__si_Periodicity_rf8; // This is for SIB2/3 - sib_type=SIB_Type_sibType3; + sib_type=LTE_SIB_Type_sibType3; ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type); ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo); - // ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL); - #if defined(ENABLE_ITTI) if (configuration->frame_type[CC_id] == TDD) #endif { - (*sib1)->tdd_Config = CALLOC(1,sizeof(struct TDD_Config)); - + (*sib1)->tdd_Config = CALLOC(1,sizeof(struct LTE_TDD_Config)); (*sib1)->tdd_Config->subframeAssignment = #if defined(ENABLE_ITTI) configuration->tdd_config[CC_id]; #else 3; #endif - (*sib1)->tdd_Config->specialSubframePatterns = #if defined(ENABLE_ITTI) configuration->tdd_config_s[CC_id]; #else - 0; + 0; #endif } - (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20; + (*sib1)->si_WindowLength=LTE_SystemInformationBlockType1__si_WindowLength_ms20; (*sib1)->systemInfoValueTag=0; // (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension)); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); -#endif - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message, (void *)bcch_message); + } + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message, NULL, - (void*)bcch_message, + (void *)bcch_message, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif - LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); if (enc_rval.encoded==-1) { @@ -555,51 +483,45 @@ uint8_t do_SIB23(uint8_t Mod_id, int CC_id #if defined(ENABLE_ITTI) - , RrcConfigurationReq *configuration + , RrcConfigurationReq *configuration #endif - ) -{ - - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part; - -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ) { + struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) //TTN - for D2D - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib18_part, *sib19_part, *sib21_part; - SL_CommRxPoolList_r12_t *SL_CommRxPoolList; //for SIB18 - struct SL_CommResourcePool_r12 *SL_CommResourcePool; //for SIB18 - SL_DiscRxPoolList_r12_t *SL_DiscRxPoolList; //for SIB19 (discRxPool) - struct SL_DiscResourcePool_r12 *SL_DiscResourcePool; //for SIB19 (discRxPool) + struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib18_part, *sib19_part, *sib21_part; + LTE_SL_CommRxPoolList_r12_t *SL_CommRxPoolList; //for SIB18 + struct LTE_SL_CommResourcePool_r12 *SL_CommResourcePool; //for SIB18 + LTE_SL_DiscRxPoolList_r12_t *SL_DiscRxPoolList; //for SIB19 (discRxPool) + struct LTE_SL_DiscResourcePool_r12 *SL_DiscResourcePool; //for SIB19 (discRxPool) //SL_DiscRxPoolList_r12_t *SL_DiscRxPoolPSList; //for SIB19 (discRxPoolPS) //struct SL_DiscResourcePool_r12 *SL_DiscResourcePoolPS; //for SIB19 (discRxPoolPS) //struct SL_V2X_ConfigCommon_r14 *SL_V2X_ConfigCommon; #endif - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part; - MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList; - MBSFN_AreaInfoList_r9_t *MBSFNArea_list; - struct MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part; + LTE_MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList; + LTE_MBSFN_AreaInfoList_r9_t *MBSFNArea_list; + struct LTE_MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2; #endif asn_enc_rval_t enc_rval; - uint8_t *buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23; - BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation; - SystemInformationBlockType2_t **sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2; - SystemInformationBlockType3_t **sib3 = &RC.rrc[Mod_id]->carrier[CC_id].sib3; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SystemInformationBlockType13_r9_t **sib13 = &RC.rrc[Mod_id]->carrier[CC_id].sib13; + LTE_BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation; + LTE_SystemInformationBlockType2_t **sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2; + LTE_SystemInformationBlockType3_t **sib3 = &RC.rrc[Mod_id]->carrier[CC_id].sib3; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SystemInformationBlockType13_r9_t **sib13 = &RC.rrc[Mod_id]->carrier[CC_id].sib13; uint8_t MBMS_flag = RC.rrc[Mod_id]->carrier[CC_id].MBMS_flag; #endif - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //TTN - for D2D - SystemInformationBlockType18_r12_t **sib18 = &RC.rrc[Mod_id]->carrier[CC_id].sib18; - SystemInformationBlockType19_r12_t **sib19 = &RC.rrc[Mod_id]->carrier[CC_id].sib19; - SystemInformationBlockType21_r14_t **sib21 = &RC.rrc[Mod_id]->carrier[CC_id].sib21; + LTE_SystemInformationBlockType18_r12_t **sib18 = &RC.rrc[Mod_id]->carrier[CC_id].sib18; + LTE_SystemInformationBlockType19_r12_t **sib19 = &RC.rrc[Mod_id]->carrier[CC_id].sib19; + LTE_SystemInformationBlockType21_r14_t **sib21 = &RC.rrc[Mod_id]->carrier[CC_id].sib21; #endif if (bcch_message) { - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); + memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_t)); } else { LOG_E(RRC,"[eNB %d] BCCH_MESSAGE is null, exiting\n", Mod_id); exit(-1); @@ -615,69 +537,57 @@ uint8_t do_SIB23(uint8_t Mod_id, exit(-1); } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) LOG_I(RRC,"[eNB %d] Configuration SIB2/3, MBMS = %d\n", Mod_id, MBMS_flag); #else LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id); #endif - sib2_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - sib3_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib2_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib3_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - - sib2_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2; - sib3_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3; - + sib2_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib3_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib2_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib3_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib2_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2; + sib3_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3; *sib2 = &sib2_part->choice.sib2; *sib3 = &sib3_part->choice.sib3; - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flag > 0) { - sib13_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib13_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - sib13_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920; + sib13_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib13_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib13_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920; *sib13 = &sib13_part->choice.sib13_v920; } #endif - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //TTN - for D2D - sib18_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - sib19_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - sib21_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib18_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib19_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - memset(sib21_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - - sib18_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250; - sib19_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250; - sib21_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430; - + sib18_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib19_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib21_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib18_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib19_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib21_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib18_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250; + sib19_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250; + sib21_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430; *sib18 = &sib18_part->choice.sib18_v1250; *sib19 = &sib19_part->choice.sib19_v1250; *sib21 = &sib21_part->choice.sib21_v1430; - #endif - - // sib2 - (*sib2)->ac_BarringInfo = NULL; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) (*sib2)->ext1 = NULL; (*sib2)->ext2 = NULL; #endif - #if defined(ENABLE_ITTI) - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles = configuration->rach_numberOfRA_Preambles[CC_id]; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; if (configuration->rach_preamblesGroupAConfig[CC_id]) { (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig - = CALLOC(1,sizeof(struct RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig)); + = CALLOC(1,sizeof(struct LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig)); (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA = configuration->rach_sizeOfRA_PreamblesGroupA[CC_id]; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA @@ -694,17 +604,17 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer = configuration->rach_macContentionResolutionTimer[CC_id]; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = configuration->rach_maxHARQ_Msg3Tx[CC_id]; - // BCCH-Config (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff = configuration->bcch_modificationPeriodCoeff[CC_id]; - // PCCH-Config (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = configuration->pcch_defaultPagingCycle[CC_id]; (*sib2)->radioResourceConfigCommon.pcch_Config.nB = configuration->pcch_nB[CC_id]; - + LOG_I(RRC,"[SIB2] With ITTI. Basic config of paging cycle DRX: radio frame cycle length %x, paging occasion number %x\n", + (uint32_t)configuration->pcch_defaultPagingCycle[CC_id], + (uint32_t)configuration->pcch_nB[CC_id]); // PRACH-Config (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex = configuration->prach_root[CC_id]; @@ -716,13 +626,11 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->prach_zero_correlation[CC_id]; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = configuration->prach_freq_offset[CC_id]; - // PDSCH-Config (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower = configuration->pdsch_referenceSignalPower[CC_id]; (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b = configuration->pdsch_p_b[CC_id]; - // PUSCH-Config (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB = configuration->pusch_n_SB[CC_id]; @@ -740,24 +648,22 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->pusch_sequenceHoppingEnabled[CC_id]; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift = configuration->pusch_nDMRS1[CC_id]; - // PUCCH-Config - (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift = configuration->pucch_delta_shift[CC_id]; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = configuration->pucch_nRB_CQI[CC_id]; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = configuration->pucch_nCS_AN[CC_id]; -//#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) + //#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = configuration->pucch_n1_AN[CC_id]; -//#endif + //#endif // SRS Config if (configuration->srs_enable[CC_id]==1) { (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - = SoundingRS_UL_ConfigCommon_PR_setup; + = LTE_SoundingRS_UL_ConfigCommon_PR_setup; (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig = configuration->srs_BandwidthConfig[CC_id]; (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig @@ -772,15 +678,15 @@ uint8_t do_SIB23(uint8_t Mod_id, } else { (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL; } + RC.rrc[Mod_id]->srs_enable[CC_id] = 1; } else { RC.rrc[Mod_id]->srs_enable[CC_id] = 0; - (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=LTE_SoundingRS_UL_ConfigCommon_PR_release; (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0; } // uplinkPowerControlCommon - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = configuration->pusch_p0_Nominal[CC_id]; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH @@ -801,9 +707,7 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->msg3_delta_Preamble[CC_id]; (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength = configuration->ul_CyclicPrefixLength[CC_id]; - // UE Timers and Constants - (*sib2)->ue_TimersAndConstants.t300 = configuration->ue_TimersAndConstants_t300[CC_id]; (*sib2)->ue_TimersAndConstants.t301 @@ -816,135 +720,99 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->ue_TimersAndConstants_t311[CC_id]; (*sib2)->ue_TimersAndConstants.n311 = configuration->ue_TimersAndConstants_n311[CC_id]; - #else - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=LTE_RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=LTE_RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower= RACH_ConfigCommon__powerRampingParameters__preambleInitialReceivedTargetPower_dBm_100; - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=LTE_RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer= - RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48; + LTE_RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4; - // BCCH-Config (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2; - // PCCH-Config - (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = PCCH_Config__defaultPagingCycle_rf128; - (*sib2)->radioResourceConfigCommon.pcch_Config.nB=PCCH_Config__nB_oneT; - + (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = LTE_PCCH_Config__defaultPagingCycle_rf128; + (*sib2)->radioResourceConfigCommon.pcch_Config.nB=LTE_PCCH_Config__nB_oneT; // PRACH-Config (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 2; - // PDSCH-Config (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0; // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz - - (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0; - // PUSCH-Config (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1; - (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled=1; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift=0; - // PUCCH-Config - - (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=LTE_PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = 1; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = 0; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = 32; - - - (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=LTE_SoundingRS_UL_ConfigCommon_PR_release; (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0; - // uplinkPowerControlCommon - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=UplinkPowerControlCommon__alpha_al1; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; - - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; - - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; - - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; - + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=LTE_UplinkPowerControlCommon__alpha_al1; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6; - (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1; - (*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000; - (*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000; - (*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000; - (*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20; - (*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000; - (*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1; - #endif - (*sib2)->freqInfo.additionalSpectrumEmission = 1; (*sib2)->freqInfo.ul_CarrierFreq = NULL; (*sib2)->freqInfo.ul_Bandwidth = NULL; // (*sib2)->mbsfn_SubframeConfigList = NULL; - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flag > 0) { LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2\n"); - MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1; - (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct MBSFN_SubframeConfigList)); + LTE_MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1; + (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct LTE_MBSFN_SubframeConfigList)); MBSFNSubframeConfigList = (*sib2)->mbsfn_SubframeConfigList; - sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1)); - memset((void*)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1)); - - sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + memset((void *)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1)); + sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= LTE_MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; - sib2_mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + sib2_mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1); sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1; sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2; - sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; - ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1); if (MBMS_flag == 4 ) { LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n"); - MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2; + LTE_MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2; sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2)); - memset((void*)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2)); - - sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + memset((void *)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2)); + sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= LTE_MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; sib2_mbsfn_SubframeConfig2->radioframeAllocationOffset= 1; - sib2_mbsfn_SubframeConfig2->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + sib2_mbsfn_SubframeConfig2->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf= MALLOC(1); sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1; sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2; - sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; - - ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2); } } @@ -952,90 +820,72 @@ uint8_t do_SIB23(uint8_t Mod_id, #else // no MBMS transmission (*sib2)->mbsfn_SubframeConfigList = NULL; #endif - - (*sib2)->timeAlignmentTimerCommon=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; - + (*sib2)->timeAlignmentTimerCommon=LTE_TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; /// (*SIB3) -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) (*sib3)->ext1 = NULL; #endif - (*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4; - + (*sib3)->cellReselectionInfoCommon.q_Hyst=LTE_SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4; (*sib3)->cellReselectionInfoCommon.speedStateReselectionPars=NULL; - (*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL; (*sib3)->cellReselectionServingFreqInfo.threshServingLow=31; (*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7; - (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70; (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL; (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch)); *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31; (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth)); - - *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = AllowedMeasBandwidth_mbw6; - + *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw6; (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0; (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1); (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1; (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1 << 6; (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6; (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1; - (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL; - + (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct LTE_SpeedStateScaleFactors *)NULL; // SIB13 // fill in all elements of SIB13 if present -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) if (MBMS_flag > 0 ) { // Notification for mcch change - (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2; + (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= LTE_MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2; (*sib13)->notificationConfig_r9.notificationOffset_r9= 0; (*sib13)->notificationConfig_r9.notificationSF_Index_r9= 1; - // MBSFN-AreaInfoList MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list)); memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list)); // MBSFN Area 1 MBSFN_Area1= CALLOC(1, sizeof(*MBSFN_Area1)); MBSFN_Area1->mbsfn_AreaId_r9= 1; - MBSFN_Area1->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; + MBSFN_Area1->non_MBSFNregionLength= LTE_MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; MBSFN_Area1->notificationIndicator_r9= 0; - MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; + MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; MBSFN_Area1->mcch_Config_r9.mcch_Offset_r9= 1; // in accordance with mbsfn subframe configuration in sib2 - MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; + MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; // Subframe Allocation Info MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1; - MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x20<<2; // FDD: SF1 - - MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; - - MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; - + MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1); //MBSFN Area 2: currently only activated for eMBMS relaying if (MBMS_flag == 4 ) { MBSFN_Area2= CALLOC(1, sizeof(*MBSFN_Area2)); MBSFN_Area2->mbsfn_AreaId_r9= 2; - MBSFN_Area2->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; + MBSFN_Area2->non_MBSFNregionLength= LTE_MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; MBSFN_Area2->notificationIndicator_r9= 1; - MBSFN_Area2->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; + MBSFN_Area2->mcch_Config_r9.mcch_RepetitionPeriod_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; MBSFN_Area2->mcch_Config_r9.mcch_Offset_r9= 1; - MBSFN_Area2->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; + MBSFN_Area2->mcch_Config_r9.mcch_ModificationPeriod_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; // Subframe Allocation Info MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.size= 1; MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; - MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x04<<2; // FDD: SF6 - - - MBSFN_Area2->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; - + MBSFN_Area2->mcch_Config_r9.signallingMCS_r9= LTE_MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area2); } @@ -1043,19 +893,15 @@ uint8_t do_SIB23(uint8_t Mod_id, } #endif - - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //TTN - for D2D // SIB18 //commRxPool_r12 (*sib18)->commConfig_r12 = CALLOC (1, sizeof(*(*sib18)->commConfig_r12)); SL_CommRxPoolList= &(*sib18)->commConfig_r12->commRxPool_r12; memset(SL_CommRxPoolList,0,sizeof(*SL_CommRxPoolList)); - SL_CommResourcePool = CALLOC(1, sizeof(*SL_CommResourcePool)); memset(SL_CommResourcePool,0,sizeof(*SL_CommResourcePool)); - SL_CommResourcePool->sc_CP_Len_r12 = configuration->rxPool_sc_CP_Len[CC_id]; SL_CommResourcePool->sc_Period_r12 = configuration->rxPool_sc_Period[CC_id]; SL_CommResourcePool->data_CP_Len_r12 = configuration->rxPool_data_CP_Len[CC_id]; @@ -1065,63 +911,63 @@ uint8_t do_SIB23(uint8_t Mod_id, SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_End_r12 = configuration->rxPool_ResourceConfig_prb_End[CC_id]; SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = configuration->rxPool_ResourceConfig_offsetIndicator_present[CC_id]; - if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12 ) { - SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; - } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_large_r12 ){ - SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; + if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) { + SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) { + SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; } SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = configuration->rxPool_ResourceConfig_subframeBitmap_present[CC_id]; - if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){ - //for BS4 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){ - //for BS8 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){ - //for BS12 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){ - //for BS16 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){ - //for BS30 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){ - //for BS40 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){ - //for BS42 - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + + if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) { + //for BS4 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) { + //for BS8 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) { + //for BS12 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) { + //for BS16 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) { + //for BS30 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) { + //for BS40 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) { + //for BS42 + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; } //dataHoppingConfig_r12 SL_CommResourcePool->dataHoppingConfig_r12.hoppingParameter_r12 = 0; - SL_CommResourcePool->dataHoppingConfig_r12.numSubbands_r12 = SL_HoppingConfigComm_r12__numSubbands_r12_ns1; + SL_CommResourcePool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; SL_CommResourcePool->dataHoppingConfig_r12.rb_Offset_r12 = 0; - //ue_SelectedResourceConfig_r12 SL_CommResourcePool->ue_SelectedResourceConfig_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->ue_SelectedResourceConfig_r12)); SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Num_r12 = 20; SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Start_r12 = 5; SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_End_r12 = 44; - SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = SL_OffsetIndicator_r12_PR_small_r12; + SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12; SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0 ; - SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = SubframeBitmapSL_r12_PR_bs40_r12; + SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = 5; SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = CALLOC(1,5); SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = 0; @@ -1139,15 +985,13 @@ uint8_t do_SIB23(uint8_t Mod_id, SL_CommResourcePool->rxParametersNCell_r12->syncConfigIndex_r12 = 0; //txParameters_r12 SL_CommResourcePool->txParameters_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->txParameters_r12)); - SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.alpha_r12 = Alpha_r12_al0; + SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.alpha_r12 = LTE_Alpha_r12_al0; SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.p0_r12 = 0; - SL_CommResourcePool->ext1 = NULL ; //end SL_CommResourcePool //add SL_CommResourcePool to SL_CommRxPoolList ASN_SEQUENCE_ADD(&SL_CommRxPoolList->list,SL_CommResourcePool); //end commRxPool_r12 - //TODO: commTxPoolNormalCommon_r12, similar to commRxPool_r12 //TODO: commTxPoolExceptional_r12 //TODO: commSyncConfig_r12 @@ -1155,17 +999,14 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib18)->ext1 = NULL; (*sib18)->lateNonCriticalExtension = NULL; // end SIB18 - // SIB19 // fill in all elements of SIB19 if present - //discConfig_r12 (*sib19)->discConfig_r12 = CALLOC (1, sizeof(*(*sib19)->discConfig_r12)); SL_DiscRxPoolList = &(*sib19)->discConfig_r12->discRxPool_r12; memset(SL_DiscRxPoolList,0,sizeof(*SL_DiscRxPoolList)); //fill SL_DiscResourcePool SL_DiscResourcePool = CALLOC(1, sizeof(*SL_DiscResourcePool)); - SL_DiscResourcePool->cp_Len_r12 = configuration->discRxPool_cp_Len[CC_id]; SL_DiscResourcePool->discPeriod_r12 = configuration->discRxPool_discPeriod[CC_id]; //sc_TF_ResourceConfig_r12 @@ -1175,141 +1016,138 @@ uint8_t do_SIB23(uint8_t Mod_id, SL_DiscResourcePool->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPool_ResourceConfig_prb_Start[CC_id]; SL_DiscResourcePool->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPool_ResourceConfig_prb_End[CC_id]; SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPool_ResourceConfig_offsetIndicator_present[CC_id]; - if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12 ) { - SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; - } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_large_r12 ){ - SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; + + if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) { + SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) { + SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ; } + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPool_ResourceConfig_subframeBitmap_present[CC_id]; - if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){ - //for BS4 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){ - //for BS8 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){ - //for BS12 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){ - //for BS16 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){ - //for BS30 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){ - //for BS40 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){ - //for BS42 - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + + if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) { + //for BS4 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) { + //for BS8 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) { + //for BS12 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) { + //for BS16 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) { + //for BS30 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) { + //for BS40 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) { + //for BS42 + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; } //add SL_DiscResourcePool to SL_DiscRxPoolList ASN_SEQUENCE_ADD(&SL_DiscRxPoolList->list,SL_DiscResourcePool); + /* + //for DiscRxPoolPS + (*sib19)->ext1 = CALLOC (1, sizeof(*(*sib19)->ext1)); + (*sib19)->ext1->discConfigPS_13 = CALLOC (1, sizeof(*((*sib19)->ext1->discConfigPS_13))); -/* - //for DiscRxPoolPS - (*sib19)->ext1 = CALLOC (1, sizeof(*(*sib19)->ext1)); - (*sib19)->ext1->discConfigPS_13 = CALLOC (1, sizeof(*((*sib19)->ext1->discConfigPS_13))); + SL_DiscRxPoolPSList = &(*sib19)->ext1->discConfigPS_13->discRxPoolPS_r13; + memset(SL_DiscRxPoolPSList,0,sizeof(*SL_DiscRxPoolPSList)); + //fill SL_DiscResourcePool + SL_DiscResourcePoolPS = CALLOC(1, sizeof(*SL_DiscResourcePoolPS)); - SL_DiscRxPoolPSList = &(*sib19)->ext1->discConfigPS_13->discRxPoolPS_r13; - memset(SL_DiscRxPoolPSList,0,sizeof(*SL_DiscRxPoolPSList)); - //fill SL_DiscResourcePool - SL_DiscResourcePoolPS = CALLOC(1, sizeof(*SL_DiscResourcePoolPS)); + SL_DiscResourcePoolPS->cp_Len_r12 = configuration->discRxPoolPS_cp_Len[CC_id]; + SL_DiscResourcePoolPS->discPeriod_r12 = configuration->discRxPoolPS_discPeriod[CC_id]; + //sc_TF_ResourceConfig_r12 + SL_DiscResourcePoolPS->numRetx_r12 = configuration->discRxPoolPS_numRetx[CC_id]; + SL_DiscResourcePoolPS->numRepetition_r12 = configuration->discRxPoolPS_numRepetition[CC_id]; - SL_DiscResourcePoolPS->cp_Len_r12 = configuration->discRxPoolPS_cp_Len[CC_id]; - SL_DiscResourcePoolPS->discPeriod_r12 = configuration->discRxPoolPS_discPeriod[CC_id]; - //sc_TF_ResourceConfig_r12 - SL_DiscResourcePoolPS->numRetx_r12 = configuration->discRxPoolPS_numRetx[CC_id]; - SL_DiscResourcePoolPS->numRepetition_r12 = configuration->discRxPoolPS_numRepetition[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Num_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Num[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Start[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPoolPS_ResourceConfig_prb_End[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Num_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Num[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Start[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPoolPS_ResourceConfig_prb_End[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_present[CC_id]; + if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12 ) { + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ; + } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_large_r12 ){ + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ; + } - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_present[CC_id]; - if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12 ) { - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ; - } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_large_r12 ){ - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ; - } - - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_present[CC_id]; - if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){ - //for BS4 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){ - //for BS8 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){ - //for BS12 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){ - //for BS16 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){ - //for BS30 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){ - //for BS40 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){ - //for BS42 - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; - SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; - } - - //add SL_DiscResourcePool to SL_DiscRxPoolList - ASN_SEQUENCE_ADD(&SL_DiscRxPoolPSList->list,SL_DiscResourcePoolPS); -*/ + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_present[CC_id]; + if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){ + //for BS4 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){ + //for BS8 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){ + //for BS12 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){ + //for BS16 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){ + //for BS30 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){ + //for BS40 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + }else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){ + //for BS42 + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id]; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];; + SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id]; + } + //add SL_DiscResourcePool to SL_DiscRxPoolList + ASN_SEQUENCE_ADD(&SL_DiscRxPoolPSList->list,SL_DiscResourcePoolPS); + */ (*sib19)->lateNonCriticalExtension = NULL; //end SIB19 - //SIB21 (*sib21)->sl_V2X_ConfigCommon_r14 = CALLOC (1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14)); //SL_V2X_ConfigCommon= (*sib21)->sl_V2X_ConfigCommon_r14; memset((*sib21)->sl_V2X_ConfigCommon_r14,0,sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14)); - - struct SL_CommRxPoolListV2X_r14 *SL_CommRxPoolListV2X; - struct SL_CommResourcePoolV2X_r14 *SL_CommResourcePoolV2X; + struct LTE_SL_CommRxPoolListV2X_r14 *SL_CommRxPoolListV2X; + struct LTE_SL_CommResourcePoolV2X_r14 *SL_CommResourcePoolV2X; (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 = CALLOC(1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14)); SL_CommRxPoolListV2X = (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14; - SL_CommResourcePoolV2X = CALLOC(1, sizeof(*SL_CommResourcePoolV2X)); memset(SL_CommResourcePoolV2X,0,sizeof(*SL_CommResourcePoolV2X)); - SL_CommResourcePoolV2X->sl_OffsetIndicator_r14 = CALLOC(1, sizeof(*SL_CommResourcePoolV2X->sl_OffsetIndicator_r14)); - SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->present = SL_OffsetIndicator_r12_PR_small_r12; + SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->present = LTE_SL_OffsetIndicator_r12_PR_small_r12; SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->choice.small_r12 = 0; - SL_CommResourcePoolV2X->sl_Subframe_r14.present = SubframeBitmapSL_r14_PR_bs40_r14; + SL_CommResourcePoolV2X->sl_Subframe_r14.present = LTE_SubframeBitmapSL_r14_PR_bs40_r14; SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.size = 5; SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf = CALLOC(1,5); SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.bits_unused = 0; @@ -1318,78 +1156,51 @@ uint8_t do_SIB23(uint8_t Mod_id, SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[2] = 0xFF; SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[3] = 0xFF; SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[4] = 0xFF; - SL_CommResourcePoolV2X->adjacencyPSCCH_PSSCH_r14 = 1; SL_CommResourcePoolV2X->sizeSubchannel_r14 = 10; SL_CommResourcePoolV2X->numSubchannel_r14 = 5; SL_CommResourcePoolV2X->startRB_Subchannel_r14 = 10; - //rxParametersNCell_r12 SL_CommResourcePoolV2X->rxParametersNCell_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14)); SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14)); SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->subframeAssignment = 0 ; SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->specialSubframePatterns = 0; SL_CommResourcePoolV2X->rxParametersNCell_r14->syncConfigIndex_r14 = 0; - ASN_SEQUENCE_ADD(&SL_CommRxPoolListV2X->list,SL_CommResourcePoolV2X); //end SIB21 #endif - - - bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; - bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformation; - + bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_PR_c1; + bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformation; /* memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation, (void*)systemInformation, sizeof(SystemInformation_t));*/ - - bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = SystemInformation__criticalExtensions_PR_systemInformation_r8; + bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = LTE_SystemInformation__criticalExtensions_PR_systemInformation_r8; bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; - // asn_set_empty(&systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list);//.size=0; // systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib2_part); ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib3_part); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (MBMS_flag > 0) { ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,sib13_part); } + #endif if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message, (void *)bcch_message); } - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message, NULL, - (void*)bcch_message, + (void *)bcch_message, buffer, 900); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[15000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif - LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); if (enc_rval.encoded==-1) { @@ -1400,26 +1211,19 @@ uint8_t do_SIB23(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } -uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) -{ - +uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { asn_enc_rval_t enc_rval; uint8_t buf[5],buf2=0; - - UL_CCCH_Message_t ul_ccch_msg; - - RRCConnectionRequest_t *rrcConnectionRequest; - - memset((void *)&ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - - ul_ccch_msg.message.present = UL_CCCH_MessageType_PR_c1; - ul_ccch_msg.message.choice.c1.present = UL_CCCH_MessageType__c1_PR_rrcConnectionRequest; + LTE_UL_CCCH_Message_t ul_ccch_msg; + LTE_RRCConnectionRequest_t *rrcConnectionRequest; + memset((void *)&ul_ccch_msg,0,sizeof(LTE_UL_CCCH_Message_t)); + ul_ccch_msg.message.present = LTE_UL_CCCH_MessageType_PR_c1; + ul_ccch_msg.message.choice.c1.present = LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionRequest; rrcConnectionRequest = &ul_ccch_msg.message.choice.c1.choice.rrcConnectionRequest; - - rrcConnectionRequest->criticalExtensions.present = RRCConnectionRequest__criticalExtensions_PR_rrcConnectionRequest_r8; + rrcConnectionRequest->criticalExtensions.present = LTE_RRCConnectionRequest__criticalExtensions_PR_rrcConnectionRequest_r8; if (1) { - rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_randomValue; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = LTE_InitialUE_Identity_PR_randomValue; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.size = 5; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.bits_unused = 0; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf = buf; @@ -1429,7 +1233,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[3] = rv[3]; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[4] = rv[4]; } else { - rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_s_TMSI; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = LTE_InitialUE_Identity_PR_s_TMSI; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.size = 1; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.bits_unused = 0; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.buf = buf; @@ -1443,242 +1247,186 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[3] = 0x9a; } - rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.establishmentCause = EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; - + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.establishmentCause = LTE_EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.buf = &buf2; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.size=1; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7; + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_CCCH_Message, (void *)&ul_ccch_msg); + } - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_CCCH_Message, NULL, - (void*)&ul_ccch_msg, + (void *)&ul_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *) &ul_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); - } - } -# endif -#endif - LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes) \n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); - } //TTN for D2D - 3GPP TS 36.331 (Section 5.10.2.3) -uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode) -{ +uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode) { + asn_enc_rval_t enc_rval; + LTE_UL_DCCH_Message_t ul_dcch_msg; + LTE_SidelinkUEInformation_r12_t *sidelinkUEInformation; + LTE_ARFCN_ValueEUTRA_r9_t carrierFreq = 25655;//sidelink communication frequency (hardcoded - should come from SIB2) + memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_messageClassExtension; + ul_dcch_msg.message.choice.messageClassExtension.present = LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2; + ul_dcch_msg.message.choice.messageClassExtension.choice.c2.present = LTE_UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12; + sidelinkUEInformation = &ul_dcch_msg.message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12; + //3GPP TS 36.331 (Section 5.10.2.3) + sidelinkUEInformation->criticalExtensions.present = LTE_SidelinkUEInformation_r12__criticalExtensions_PR_c1; + sidelinkUEInformation->criticalExtensions.choice.c1.present = LTE_SidelinkUEInformation_r12__criticalExtensions__c1_PR_sidelinkUEInformation_r12; - asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; - SidelinkUEInformation_r12_t *sidelinkUEInformation; - ARFCN_ValueEUTRA_r9_t carrierFreq = 25655;//sidelink communication frequency (hardcoded - should come from SIB2) - - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_messageClassExtension; - ul_dcch_msg.message.choice.messageClassExtension.present = UL_DCCH_MessageType__messageClassExtension_PR_c2; - ul_dcch_msg.message.choice.messageClassExtension.choice.c2.present = UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12; - sidelinkUEInformation = &ul_dcch_msg.message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12; - - //3GPP TS 36.331 (Section 5.10.2.3) - sidelinkUEInformation->criticalExtensions.present = SidelinkUEInformation_r12__criticalExtensions_PR_c1; - sidelinkUEInformation->criticalExtensions.choice.c1.present = SidelinkUEInformation_r12__criticalExtensions__c1_PR_sidelinkUEInformation_r12; - switch(mode) { - //if SIB18 is available - case SL_RECEIVE_COMMUNICATION: // to receive sidelink communication + switch(mode) { + //if SIB18 is available + case SL_RECEIVE_COMMUNICATION: // to receive sidelink communication sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12)); - memcpy((void*)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12, (void*)&carrierFreq, - sizeof(ARFCN_ValueEUTRA_r9_t)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12)); + memcpy((void *)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12, (void *)&carrierFreq, + sizeof(LTE_ARFCN_ValueEUTRA_r9_t)); break; - case SL_TRANSMIT_NON_RELAY_ONE_TO_MANY: //to transmit non-relay related one-to-many sidelink communication + case SL_TRANSMIT_NON_RELAY_ONE_TO_MANY: //to transmit non-relay related one-to-many sidelink communication //commTxResourceReq sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12)); - memcpy((void*)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12, (void*)&carrierFreq, - sizeof(ARFCN_ValueEUTRA_r9_t)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12)); + memcpy((void *)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12, (void *)&carrierFreq, + sizeof(LTE_ARFCN_ValueEUTRA_r9_t)); memcpy(&sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12, - destinationInfoList, - sizeof(SL_DestinationInfoList_r12_t)); + destinationInfoList, + sizeof(LTE_SL_DestinationInfoList_r12_t)); break; - case SL_TRANSMIT_NON_RELAY_ONE_TO_ONE://transmit non-relay related one-to-one sidelink communication + case SL_TRANSMIT_NON_RELAY_ONE_TO_ONE://transmit non-relay related one-to-one sidelink communication //if commTxResourceUC-ReqAllowed is included in SIB18 sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); - + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12)); - memcpy((void*)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12, (void*)&carrierFreq, - sizeof (ARFCN_ValueEUTRA_r9_t)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12)); + memcpy((void *)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12, (void *)&carrierFreq, + sizeof (LTE_ARFCN_ValueEUTRA_r9_t)); memcpy(&sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12, - destinationInfoList, - sizeof(SL_DestinationInfoList_r12_t)); + destinationInfoList, + sizeof(LTE_SL_DestinationInfoList_r12_t)); break; - case SL_TRANSMIT_RELAY_ONE_TO_ONE: //transmit relay related one-to-one sidelink communication + case SL_TRANSMIT_RELAY_ONE_TO_ONE: //transmit relay related one-to-one sidelink communication //if SIB19 includes discConfigRelay and UE acts a relay or UE has a selected relay sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13= CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13)); memcpy(&sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12, - destinationInfoList, - sizeof(*destinationInfoList)); + destinationInfoList, + sizeof(*destinationInfoList)); //set ue-type to relayUE or remoteUE - sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE; + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 + =LTE_SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE; //sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12->nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_remoteUE; break; - case SL_TRANSMIT_RELAY_ONE_TO_MANY: //transmit relay related one-to-many sidelink communication + case SL_TRANSMIT_RELAY_ONE_TO_MANY: //transmit relay related one-to-many sidelink communication //if SIB19 includes discConfigRelay and UE acts a relay //set ue-type to relayUE sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13= CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13)); - sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 =SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE; + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13)); + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->ue_Type_r13 = + LTE_SidelinkUEInformation_v1310_IEs__commTxResourceInfoReqRelay_r13__ue_Type_r13_relayUE; memcpy(&sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12, - destinationInfoList, - sizeof(*destinationInfoList)); + destinationInfoList, + sizeof(*destinationInfoList)); break; - //if SIB19 is available - //we consider only one frequency - a serving frequency - case SL_RECEIVE_DISCOVERY: //receive sidelink discovery announcements - + //if SIB19 is available + //we consider only one frequency - a serving frequency + case SL_RECEIVE_DISCOVERY: //receive sidelink discovery announcements sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12)); - *sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12 = SidelinkUEInformation_r12_IEs__discRxInterest_r12_true; + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12)); + *sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discRxInterest_r12 = LTE_SidelinkUEInformation_r12_IEs__discRxInterest_r12_true; break; - case SL_TRANSMIT_NON_PS_DISCOVERY://to transmit non-PS related sidelink discovery announcements + + case SL_TRANSMIT_NON_PS_DISCOVERY://to transmit non-PS related sidelink discovery announcements //for the first frequency sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12)); - - memcpy((void*)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12, - (void*)discTxResourceReq, - sizeof(long)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12)); + memcpy((void *)sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12, + (void *)discTxResourceReq, + sizeof(long)); //for additional frequency break; - case SL_TRANSMIT_PS_DISCOVERY://to transmit PS related sidelink discovery announcements + case SL_TRANSMIT_PS_DISCOVERY://to transmit PS related sidelink discovery announcements //if to transmit non-relay PS related discovery announcements and SIB19 includes discConfigPS //if UE is acting as relay UE and SIB includes discConfigRelay (relay threshold condition) //if relay UE/has a selected relay UE and if SIB19 includes discConfigRelay sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13 = CALLOC(1, - sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13)); + sizeof(*sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13)); sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13 = *discTxResourceReq; break; - //SIB21 - case SL_RECEIVE_V2X: + + //SIB21 + case SL_RECEIVE_V2X: //TODO break; - case SL_TRANSMIT_V2X: + + case SL_TRANSMIT_V2X: //TODO break; - //TODO: request sidelink discovery transmission/reception gaps - //TODO: report the system information parameters related to sidelink discovery of carriers other than the primary - default: + + //TODO: request sidelink discovery transmission/reception gaps + //TODO: report the system information parameters related to sidelink discovery of carriers other than the primary + default: break; - } + } - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); - } - - - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - NULL, - (void*)&ul_dcch_msg, - buffer, - 100); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); - } - } -# endif -#endif - -#ifdef USER_MODE - LOG_D(RRC,"SidelinkUEInformation Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif - - return((enc_rval.encoded+7)/8); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg); + } + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, + NULL, + (void *)&ul_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + LOG_D(RRC,"SidelinkUEInformation Encoded %d bits (%d bytes)\n",(uint32_t)enc_rval.encoded,(uint32_t)((enc_rval.encoded+7)/8)); + return((enc_rval.encoded+7)/8); } -uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) -{ - - +uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) { asn_enc_rval_t enc_rval; - - UL_DCCH_Message_t ul_dcch_msg; - - RRCConnectionSetupComplete_t *rrcConnectionSetupComplete; - - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete; + LTE_UL_DCCH_Message_t ul_dcch_msg; + LTE_RRCConnectionSetupComplete_t *rrcConnectionSetupComplete; + memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete; rrcConnectionSetupComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionSetupComplete; - rrcConnectionSetupComplete->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionSetupComplete->criticalExtensions.present = RRCConnectionSetupComplete__criticalExtensions_PR_c1; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.present = RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8; - + rrcConnectionSetupComplete->criticalExtensions.present = LTE_RRCConnectionSetupComplete__criticalExtensions_PR_c1; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.present = LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension)); - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME = NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME)); /* @@ -1699,97 +1447,54 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; */ + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg); + } - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, - (void*)&ul_dcch_msg, + (void *)&ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); - } - } -# endif -#endif - LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); - } //------------------------------------------------------------------------------ uint8_t do_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, const uint8_t Transaction_id ) //------------------------------------------------------------------------------ { - - asn_enc_rval_t enc_rval; - - UL_DCCH_Message_t ul_dcch_msg; - - RRCConnectionReconfigurationComplete_t *rrcConnectionReconfigurationComplete; - - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete; + LTE_UL_DCCH_Message_t ul_dcch_msg; + LTE_RRCConnectionReconfigurationComplete_t *rrcConnectionReconfigurationComplete; + memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete; rrcConnectionReconfigurationComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionReconfigurationComplete; - rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReconfigurationComplete->criticalExtensions.present = - RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; + LTE_RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg); + } + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, - (void*)&ul_dcch_msg, + (void *)&ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } @@ -1797,42 +1502,34 @@ do_RRCConnectionReconfigurationComplete( //------------------------------------------------------------------------------ uint8_t do_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, - SRB_ToAddModList_t **SRB_configList, - struct PhysicalConfigDedicated **physicalConfigDedicated) -{ - + LTE_SRB_ToAddModList_t **SRB_configList, + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated) { asn_enc_rval_t enc_rval; eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id]; - - long* logicalchannelgroup = NULL; - struct SRB_ToAddMod* SRB1_config = NULL; - struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL; - + long *logicalchannelgroup = NULL; + struct LTE_SRB_ToAddMod *SRB1_config = NULL; + struct LTE_SRB_ToAddMod__rlc_Config *SRB1_rlc_config = NULL; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters = NULL; #ifdef CBA - struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL; - long* betaOffset_CBA_Index = NULL; - long* cShift_CBA = NULL; + struct LTE_PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola = NULL; + long *betaOffset_CBA_Index = NULL; + long *cShift_CBA = NULL; #endif - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; - - DL_CCCH_Message_t dl_ccch_msg; - - RRCConnectionSetup_t* rrcConnectionSetup = NULL; - + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL; + LTE_DL_CCCH_Message_t dl_ccch_msg; + LTE_RRCConnectionSetup_t *rrcConnectionSetup = NULL; LTE_DL_FRAME_PARMS *frame_parms = &RC.eNB[ctxt_pP->module_id][CC_id]->frame_parms; - - memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); - dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; - dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup; + memset((void *)&dl_ccch_msg,0,sizeof(LTE_DL_CCCH_Message_t)); + dl_ccch_msg.message.present = LTE_DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup; rrcConnectionSetup = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionSetup; // RRCConnectionSetup @@ -1843,17 +1540,14 @@ do_RRCConnectionSetup( free(*SRB_configList); } - *SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t)); - + *SRB_configList = CALLOC(1,sizeof(LTE_SRB_ToAddModList_t)); /// SRB1 SRB1_config = CALLOC(1,sizeof(*SRB1_config)); - SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1,sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; + SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present=LTE_RLC_Config_PR_am; #if defined(ENABLE_ITTI) SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu; @@ -1861,44 +1555,31 @@ do_RRCConnectionSetup( SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; -#else - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; -#endif - +#else + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p4;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0; +#endif SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1,sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - - SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); - SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - + SRB1_ul_SpecificParameters->prioritisedBitRate=LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); - SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + SRB1_ul_SpecificParameters->bucketSizeDuration=LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; logicalchannelgroup = CALLOC(1,sizeof(long)); *logicalchannelgroup=0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - - ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config); - // PhysicalConfigDedicated - physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); *physicalConfigDedicated = physicalConfigDedicated2; - physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); @@ -1906,10 +1587,12 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + if (rrc->srs_enable[CC_id]==1) physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); else physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); @@ -1917,12 +1600,12 @@ do_RRCConnectionSetup( //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, // PDSCH_ConfigDedicated__p_a_dB0); if (carrier->p_eNB==2) - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB_3; + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= LTE_PDSCH_ConfigDedicated__p_a_dB_3; else - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB0; + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= LTE_PDSCH_ConfigDedicated__p_a_dB0; // PUCCH - physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release; physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release=0; if (carrier->sib1->tdd_Config == NULL) { @@ -1930,351 +1613,317 @@ do_RRCConnectionSetup( } else { //TDD physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode= CALLOC(1,sizeof(long)); *(physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) = - PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + LTE_PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; } // Pusch_config_dedicated physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 - // UplinkPowerControlDedicated physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); - physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled= UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled= LTE_UplinkPowerControlDedicated__deltaMCS_Enabled_en1; physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // TRUE physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB - *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=FilterCoefficient_fc4; // fc4 dB - + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=LTE_FilterCoefficient_fc4; // fc4 dB // TPC-PDCCH-Config - - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present=TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present=LTE_TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = LTE_TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2); physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size=2; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0]=0x12; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused=0; - - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present=TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present=LTE_TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = LTE_TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size=2; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0]=0x22; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0; - // CQI ReportConfig - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= LTE_CQI_ReportModeAperiodic_rm30; #else - *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=LTE_CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI #endif physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; - /* - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = LTE_CQI_ReportPeriodic_PR_release; + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; - */ + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ //soundingRS-UL-ConfigDedicated if (rrc->srs_enable[CC_id]==1) { - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = LTE_SoundingRS_UL_ConfigDedicated_PR_setup; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + LTE_SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + LTE_SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + if (carrier->sib1->tdd_Config==NULL) { // FDD if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); - if (ue_context_pP->local_uid >=20) - LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", - ue_context_pP->local_uid); + == LTE_SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); + + if (ue_context_pP->local_uid >=20) + LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + //the current code will allow for 20 UEs - to be revised for more physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; - } - else { + } else { if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) { - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, - carrier->sib1->tdd_Config->subframeAssignment); - } - if (ue_context_pP->local_uid >=6) - LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", - ue_context_pP->local_uid); + == LTE_SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) { + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, + carrier->sib1->tdd_Config->subframeAssignment); + } + + if (ue_context_pP->local_uid >=6) + LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; } + LOG_W(RRC,"local UID %d, srs ConfigIndex %zd, TransmissionComb %zd\n",ue_context_pP->local_uid, - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); - + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= - SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; + LTE_SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; } - //AntennaInfoDedicated physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); - physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + physicalConfigDedicated2->antennaInfo->present = LTE_PhysicalConfigDedicated__antennaInfo_PR_explicitValue; //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, // AntennaInfoDedicated__transmissionMode_tm2); switch (transmission_mode) { - default: - LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); - case 1: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; - break; + default: + LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); - case 2: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; - break; - /* - case 3: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, - sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm1; + break; - break; + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm2; + break; + /* + case 3: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, + sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - case 4: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; - break; + break; - case 5: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; - break; + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; - case 6: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; - break; + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; - case 7: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; - break; - */ + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + + case 7: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; + break; + */ } - - physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; - // SchedulingRequestConfig + physicalConfigDedicated2->schedulingRequestConfig->present = LTE_SchedulingRequestConfig_PR_setup; - physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; if (carrier->sib1->tdd_Config == NULL) { physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; } else { - switch (carrier->sib1->tdd_Config->subframeAssignment) { + switch (carrier->sib1->tdd_Config->subframeAssignment) { case 1: - switch(frame_parms->N_RB_UL){ + switch(frame_parms->N_RB_UL) { case 25: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 15 - ue_context_pP->local_uid/4; - break; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 15 - ue_context_pP->local_uid/4; + break; + case 50: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/4; - break; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/4; + break; + case 100: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 63 - ue_context_pP->local_uid/4; - break; - } - break; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 63 - ue_context_pP->local_uid/4; + break; + } + + break; + default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; - break; - } + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; + break; + } } if (carrier->sib1->tdd_Config == NULL) { // FDD physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) } else { switch (carrier->sib1->tdd_Config->subframeAssignment) { - case 1: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+(( - ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) - break; + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+(( + ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; - case 3: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ - (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - case 4: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ - (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) - break; + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; } } // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, //SchedulingRequestConfig__setup__dsr_TransMax_n4); // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4; rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionSetup->criticalExtensions.present = RRCConnectionSetup__criticalExtensions_PR_c1; - rrcConnectionSetup->criticalExtensions.choice.c1.present =RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ; + rrcConnectionSetup->criticalExtensions.present = LTE_RRCConnectionSetup__criticalExtensions_PR_c1; + rrcConnectionSetup->criticalExtensions.choice.c1.present = LTE_RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_Config = NULL; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2; - rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = NULL; -#ifdef CBA - betaOffset_CBA_Index = CALLOC(1,sizeof(long)); - cShift_CBA = CALLOC(1,sizeof(long)); - *betaOffset_CBA_Index=10; // need to be changed by Kaijie - *cShift_CBA=4; - physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->betaOffset_CBA_Index=betaOffset_CBA_Index; - physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->cShift_CBA=cShift_CBA; - rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_CBA_ConfigList_vlola = NULL; -#endif - + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = CALLOC(1,sizeof(struct LTE_RadioResourceConfigDedicated__mac_MainConfig)); + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig->present = LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue; + LTE_MAC_MainConfig_t *mac_MainConfig = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig->choice.explicitValue; + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + long *maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + long *periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = LTE_PeriodicBSR_Timer_r12_sf64; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = LTE_RetxBSR_Timer_r12_sf320; + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + mac_MainConfig->timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_infinity; + mac_MainConfig->drx_Config = NULL; + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + mac_MainConfig->phr_Config->present = LTE_MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message, (void *)&dl_ccch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message, NULL, - (void*)&dl_ccch_msg, + (void *)&dl_ccch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes) \n", enc_rval.encoded,(enc_rval.encoded+7)/8); - // FREEMEM(SRB_list); // free(SRB1_config); // free(SRB1_rlc_config); // free(SRB1_lchan_config); // free(SRB1_ul_SpecificParameters); - return((enc_rval.encoded+7)/8); } //------------------------------------------------------------------------------ uint8_t do_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id, const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm ) //------------------------------------------------------------------------------ { - DL_DCCH_Message_t dl_dcch_msg; + LTE_DL_DCCH_Message_t dl_dcch_msg; asn_enc_rval_t enc_rval; - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; - dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_securityModeCommand; - + memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t)); + dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand; dl_dcch_msg.message.choice.c1.choice.securityModeCommand.rrc_TransactionIdentifier = Transaction_id; - dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; - + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1; dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.present = - SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; + LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; // the two following information could be based on the mod_id dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm - = (CipheringAlgorithm_r12_t)cipheringAlgorithm; + = (LTE_CipheringAlgorithm_r12_t)cipheringAlgorithm; dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm - = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; + = (e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message, NULL, - (void*)&dl_dcch_msg, + (void *)&dl_dcch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, @@ -2297,64 +1946,41 @@ do_SecurityModeCommand( //------------------------------------------------------------------------------ uint8_t do_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id ) //------------------------------------------------------------------------------ { - - DL_DCCH_Message_t dl_dcch_msg; - - RAT_Type_t rat=RAT_Type_eutra; + LTE_DL_DCCH_Message_t dl_dcch_msg; + LTE_RAT_Type_t rat=LTE_RAT_Type_eutra; asn_enc_rval_t enc_rval; - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; - dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry; - + memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t)); + dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry; dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.rrc_TransactionIdentifier = Transaction_id; - - dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.present = UECapabilityEnquiry__criticalExtensions_PR_c1; + dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.present = LTE_UECapabilityEnquiry__criticalExtensions_PR_c1; dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.present = - UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8; + LTE_UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8; dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0; ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list, &rat); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message, NULL, - (void*)&dl_dcch_msg, + (void *)&dl_dcch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, @@ -2375,53 +2001,46 @@ do_UECapabilityEnquiry( //------------------------------------------------------------------------------ uint16_t do_RRCConnectionReconfiguration( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, uint8_t *buffer, uint8_t Transaction_id, - SRB_ToAddModList_t *SRB_list, - DRB_ToAddModList_t *DRB_list, - DRB_ToReleaseList_t *DRB_list2, - struct SPS_Config *sps_Config, - struct PhysicalConfigDedicated *physicalConfigDedicated, - MeasObjectToAddModList_t *MeasObj_list, - ReportConfigToAddModList_t *ReportConfig_list, - QuantityConfig_t *quantityConfig, - MeasIdToAddModList_t *MeasId_list, - MAC_MainConfig_t *mac_MainConfig, - MeasGapConfig_t *measGapConfig, - MobilityControlInfo_t *mobilityInfo, - struct MeasConfig__speedStatePars *speedStatePars, - RSRP_Range_t *rsrp, - C_RNTI_t *cba_rnti, - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList + LTE_SRB_ToAddModList_t *SRB_list, + LTE_DRB_ToAddModList_t *DRB_list, + LTE_DRB_ToReleaseList_t *DRB_list2, + struct LTE_SPS_Config *sps_Config, + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, + LTE_MeasObjectToAddModList_t *MeasObj_list, + LTE_ReportConfigToAddModList_t *ReportConfig_list, + LTE_QuantityConfig_t *quantityConfig, + LTE_MeasIdToAddModList_t *MeasId_list, + LTE_MAC_MainConfig_t *mac_MainConfig, + LTE_MeasGapConfig_t *measGapConfig, + LTE_MobilityControlInfo_t *mobilityInfo, + struct LTE_MeasConfig__speedStatePars *speedStatePars, + LTE_RSRP_Range_t *rsrp, + LTE_C_RNTI_t *cba_rnti, + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList, - SL_CommConfig_r12_t *sl_CommConfig, - SL_DiscConfig_r12_t *sl_DiscConfig -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , SCellToAddMod_r10_t *SCell_config + LTE_SL_CommConfig_r12_t *sl_CommConfig, + LTE_SL_DiscConfig_r12_t *sl_DiscConfig +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , LTE_SCellToAddMod_r10_t *SCell_config #endif ) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - - DL_DCCH_Message_t dl_dcch_msg; - RRCConnectionReconfiguration_t *rrcConnectionReconfiguration; - - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; - dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration; + LTE_DL_DCCH_Message_t dl_dcch_msg; + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration; + memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t)); + dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration; rrcConnectionReconfiguration = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration; - // RRCConnectionReconfiguration rrcConnectionReconfiguration->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionReconfiguration->criticalExtensions.present = RRCConnectionReconfiguration__criticalExtensions_PR_c1; - rrcConnectionReconfiguration->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ; - + rrcConnectionReconfiguration->criticalExtensions.present = LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.present = LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated)); rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list; @@ -2437,7 +2056,7 @@ do_RRCConnectionReconfiguration( rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig)); rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->present - =RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue; + =LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue; memcpy(&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue, mac_MainConfig, sizeof(*mac_MainConfig)); @@ -2448,9 +2067,8 @@ do_RRCConnectionReconfiguration( if (MeasId_list != NULL) { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); - memset((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig, + memset((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig, 0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; @@ -2482,9 +2100,8 @@ do_RRCConnectionReconfiguration( if (mobilityInfo !=NULL) { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo)); - memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void*)mobilityInfo, - sizeof(MobilityControlInfo_t)); - + memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void *)mobilityInfo, + sizeof(LTE_MobilityControlInfo_t)); } else { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = NULL; } @@ -2495,143 +2112,126 @@ do_RRCConnectionReconfiguration( //TTN for D2D //allocate dedicated resource pools for SL communication (sl_CommConfig_r12) if (sl_CommConfig != NULL) { - LOG_I(RRC,"[RRCConnectionReconfiguration] allocating a dedicated resource pool for SL communication \n"); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12 = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12)); - memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12, (void*)sl_CommConfig, - sizeof(SL_CommConfig_r12_t)); + LOG_I(RRC,"[RRCConnectionReconfiguration] allocating a dedicated resource pool for SL communication \n"); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension + = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12 + = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12)); + memcpy((void *) + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12, + (void *)sl_CommConfig, + sizeof(LTE_SL_CommConfig_r12_t)); } //allocate dedicated resource pools for SL discovery (sl_DiscConfig) - if (sl_DiscConfig != NULL){ - LOG_I(RRC,"[RRCConnectionReconfiguration] allocating a dedicated resource pool for SL discovery \n"); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12 = CALLOC(1, - sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12)); - memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12, (void*)sl_DiscConfig, - sizeof(SL_DiscConfig_r12_t)); + if (sl_DiscConfig != NULL) { + LOG_I(RRC,"[RRCConnectionReconfiguration] allocating a dedicated resource pool for SL discovery \n"); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension + = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12 + = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12)); + memcpy((void *) + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12, + (void *)sl_DiscConfig, + sizeof(LTE_SL_DiscConfig_r12_t)); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message, NULL, - (void*)&dl_dcch_msg, + (void *)&dl_dcch_msg, buffer, RRC_BUF_SIZE); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg); + xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void *)&dl_dcch_msg); } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[30000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); // for (i=0;i<30;i++) // msg("%x.",buffer[i]); // msg("\n"); - - return((enc_rval.encoded+7)/8); } //------------------------------------------------------------------------------ uint8_t do_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, - SRB_ToAddModList_t **SRB_configList, - struct PhysicalConfigDedicated **physicalConfigDedicated) -{ + LTE_SRB_ToAddModList_t **SRB_configList, + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated) { asn_enc_rval_t enc_rval; - - long* logicalchannelgroup = NULL; - struct SRB_ToAddMod* SRB1_config = NULL; - struct SRB_ToAddMod* SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL; + long *logicalchannelgroup = NULL; + struct LTE_SRB_ToAddMod *SRB1_config = NULL; + struct LTE_SRB_ToAddMod *SRB2_config = NULL; + struct LTE_SRB_ToAddMod__rlc_Config *SRB1_rlc_config = NULL; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters = NULL; eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; - #ifdef CBA - struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL; - long* betaOffset_CBA_Index = NULL; - long* cShift_CBA = NULL; + struct LTE_PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola = NULL; + long *betaOffset_CBA_Index = NULL; + long *cShift_CBA = NULL; #endif - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; - - DL_CCCH_Message_t dl_ccch_msg; - - RRCConnectionReestablishment_t* rrcConnectionReestablishment = NULL; - + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL; + LTE_DL_CCCH_Message_t dl_ccch_msg; + LTE_RRCConnectionReestablishment_t *rrcConnectionReestablishment = NULL; int i = 0; - SRB_ToAddModList_t **SRB_configList2 = NULL; + LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[Transaction_id]; + if (*SRB_configList2) { free(*SRB_configList2); } - *SRB_configList2 = CALLOC(1, sizeof(SRB_ToAddModList_t)); - memset((void *)&dl_ccch_msg, 0, sizeof(DL_CCCH_Message_t)); - dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; - dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment; + *SRB_configList2 = CALLOC(1, sizeof(LTE_SRB_ToAddModList_t)); + memset((void *)&dl_ccch_msg, 0, sizeof(LTE_DL_CCCH_Message_t)); + dl_ccch_msg.message.present = LTE_DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment; rrcConnectionReestablishment = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishment; // RRCConnectionReestablishment // Configure SRB1 - // get old configuration of SRB2 if (*SRB_configList != NULL) { for (i = 0; (i < (*SRB_configList)->list.count) && (i < 3); i++) { LOG_D(RRC, "(*SRB_configList)->list.array[%d]->srb_Identity=%ld\n", - i, (*SRB_configList)->list.array[i]->srb_Identity); - if ((*SRB_configList)->list.array[i]->srb_Identity == 2 ){ + i, (*SRB_configList)->list.array[i]->srb_Identity); + + if ((*SRB_configList)->list.array[i]->srb_Identity == 2 ) { SRB2_config = (*SRB_configList)->list.array[i]; - } else if ((*SRB_configList)->list.array[i]->srb_Identity == 1 ){ + } else if ((*SRB_configList)->list.array[i]->srb_Identity == 1 ) { SRB1_config = (*SRB_configList)->list.array[i]; } } @@ -2642,44 +2242,36 @@ do_RRCConnectionReestablishment( LOG_W(RRC,"SRB1 configuration does not exist in SRB configuration list, use default\n"); /// SRB1 SRB1_config = CALLOC(1, sizeof(*SRB1_config)); - SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; - #if defined(ENABLE_ITTI) + SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present=LTE_RLC_Config_PR_am; +#if defined(ENABLE_ITTI) SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = rrc->srb1_poll_byte; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; - #else - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; - #endif - +#else + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p4;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0; +#endif SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); - SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - + SRB1_ul_SpecificParameters->prioritisedBitRate=LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); - SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + SRB1_ul_SpecificParameters->bucketSizeDuration=LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; @@ -2695,42 +2287,40 @@ do_RRCConnectionReestablishment( free(*SRB_configList); } - *SRB_configList = CALLOC(1, sizeof(SRB_ToAddModList_t)); - + *SRB_configList = CALLOC(1, sizeof(LTE_SRB_ToAddModList_t)); ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config); - physicalConfigDedicated2 = *physicalConfigDedicated; - rrcConnectionReestablishment->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionReestablishment->criticalExtensions.present = RRCConnectionReestablishment__criticalExtensions_PR_c1; - rrcConnectionReestablishment->criticalExtensions.choice.c1.present = RRCConnectionReestablishment__criticalExtensions__c1_PR_rrcConnectionReestablishment_r8; + rrcConnectionReestablishment->criticalExtensions.present = LTE_RRCConnectionReestablishment__criticalExtensions_PR_c1; + rrcConnectionReestablishment->criticalExtensions.choice.c1.present = LTE_RRCConnectionReestablishment__criticalExtensions__c1_PR_rrcConnectionReestablishment_r8; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.sps_Config = NULL; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.mac_MainConfig = NULL; - uint8_t KeNB_star[32] = { 0 }; uint16_t pci = rrc->carrier[CC_id].physCellId; uint32_t earfcn_dl = (uint32_t)freq_to_arfcn10(RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, - rrc->carrier[CC_id].dl_CarrierFreq); + rrc->carrier[CC_id].dl_CarrierFreq); bool is_rel8_only = true; + if (earfcn_dl > 65535) { is_rel8_only = false; } LOG_D(RRC, "pci=%d, eutra_band=%d, downlink_frequency=%d, earfcn_dl=%u, is_rel8_only=%s\n", - pci, - RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, - rrc->carrier[CC_id].dl_CarrierFreq, - earfcn_dl, - is_rel8_only == true ? "true": "false"); + pci, + RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, + rrc->carrier[CC_id].dl_CarrierFreq, + earfcn_dl, + is_rel8_only == true ? "true": "false"); #if defined(ENABLE_SECURITY) + if (ue_context_pP->ue_context.nh_ncc >= 0) { derive_keNB_star(ue_context_pP->ue_context.nh, pci, earfcn_dl, is_rel8_only, KeNB_star); rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = ue_context_pP->ue_context.nh_ncc; - } else { // first HO + } else { // first HO derive_keNB_star (ue_context_pP->ue_context.kenb, pci, earfcn_dl, is_rel8_only, KeNB_star); // LG: really 1 rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0; @@ -2742,47 +2332,26 @@ do_RRCConnectionReestablishment( #else rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0; #endif - rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nonCriticalExtension = NULL; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message, (void *)&dl_ccch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message, NULL, - (void*)&dl_ccch_msg, + (void *)&dl_ccch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_E(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - -#ifdef USER_MODE - LOG_D(RRC,"RRCConnectionReestablishment Encoded %zd bits (%zd bytes)\n", - enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif + LOG_D(RRC,"RRCConnectionReestablishment Encoded %u bits (%u bytes)\n", + (uint32_t)enc_rval.encoded, (uint32_t)(enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8); } @@ -2790,59 +2359,37 @@ do_RRCConnectionReestablishment( uint8_t do_RRCConnectionReestablishmentReject( uint8_t Mod_id, - uint8_t* const buffer) + uint8_t *const buffer) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - - DL_CCCH_Message_t dl_ccch_msg; - RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; - - memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); - dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; - dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject; + LTE_DL_CCCH_Message_t dl_ccch_msg; + LTE_RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; + memset((void *)&dl_ccch_msg,0,sizeof(LTE_DL_CCCH_Message_t)); + dl_ccch_msg.message.present = LTE_DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject; rrcConnectionReestablishmentReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishmentReject; - // RRCConnectionReestablishmentReject - rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; + rrcConnectionReestablishmentReject->criticalExtensions.present = LTE_RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message, (void *)&dl_ccch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message, NULL, - (void*)&dl_ccch_msg, + (void *)&dl_ccch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_E(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } @@ -2850,192 +2397,149 @@ do_RRCConnectionReestablishmentReject( uint8_t do_RRCConnectionReject( uint8_t Mod_id, - uint8_t* const buffer) + uint8_t *const buffer) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - - DL_CCCH_Message_t dl_ccch_msg; - RRCConnectionReject_t *rrcConnectionReject; - - memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); - dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; - dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReject; + LTE_DL_CCCH_Message_t dl_ccch_msg; + LTE_RRCConnectionReject_t *rrcConnectionReject; + memset((void *)&dl_ccch_msg,0,sizeof(LTE_DL_CCCH_Message_t)); + dl_ccch_msg.message.present = LTE_DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReject; rrcConnectionReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReject; - // RRCConnectionReject - rrcConnectionReject->criticalExtensions.present = RRCConnectionReject__criticalExtensions_PR_c1; - rrcConnectionReject->criticalExtensions.choice.c1.present = RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8; + rrcConnectionReject->criticalExtensions.present = LTE_RRCConnectionReject__criticalExtensions_PR_c1; + rrcConnectionReject->criticalExtensions.choice.c1.present = LTE_RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8; /* let's put a wait time of 1s for the moment */ rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message, (void *)&dl_ccch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message, NULL, - (void*)&dl_ccch_msg, + (void *)&dl_ccch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_E(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } uint8_t do_RRCConnectionRelease( uint8_t Mod_id, uint8_t *buffer, - uint8_t Transaction_id) -{ - + uint8_t Transaction_id) { asn_enc_rval_t enc_rval; - - DL_DCCH_Message_t dl_dcch_msg; - RRCConnectionRelease_t *rrcConnectionRelease; - - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; - dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionRelease; + LTE_DL_DCCH_Message_t dl_dcch_msg; + LTE_RRCConnectionRelease_t *rrcConnectionRelease; + memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t)); + dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease; rrcConnectionRelease = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionRelease; - // RRCConnectionRelease rrcConnectionRelease->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionRelease->criticalExtensions.present = RRCConnectionRelease__criticalExtensions_PR_c1; - rrcConnectionRelease->criticalExtensions.choice.c1.present =RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8 ; - - rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause = ReleaseCause_other; + rrcConnectionRelease->criticalExtensions.present = LTE_RRCConnectionRelease__criticalExtensions_PR_c1; + rrcConnectionRelease->criticalExtensions.choice.c1.present =LTE_RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8 ; + rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause = LTE_ReleaseCause_other; rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.redirectedCarrierInfo = NULL; rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.idleModeMobilityControlInfo = NULL; - rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension)); - - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message, NULL, - (void*)&dl_dcch_msg, + (void *)&dl_dcch_msg, buffer, RRC_BUF_SIZE); - return((enc_rval.encoded+7)/8); } uint8_t TMGI[5] = {4,3,2,1,0};//TMGI is a string of octet, ref. TS 24.008 fig. 10.5.4a -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, uint8_t sync_area, uint8_t *buffer, - MCCH_Message_t *mcch_message, - MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration) -{ - + LTE_MCCH_Message_t *mcch_message, + LTE_MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration) { asn_enc_rval_t enc_rval; - MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1; - PMCH_Info_r9_t *pmch_Info_1; - MBMS_SessionInfo_r9_t *mbms_Session_1; + LTE_MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1; + LTE_PMCH_Info_r9_t *pmch_Info_1; + LTE_MBMS_SessionInfo_r9_t *mbms_Session_1; // MBMS_SessionInfo_r9_t *mbms_Session_2; eNB_RRC_INST *rrc = RC.rrc[Mod_id]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; - - - memset(mcch_message,0,sizeof(MCCH_Message_t)); - mcch_message->message.present = MCCH_MessageType_PR_c1; - mcch_message->message.choice.c1.present = MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9; + memset(mcch_message,0,sizeof(LTE_MCCH_Message_t)); + mcch_message->message.present = LTE_MCCH_MessageType_PR_c1; + mcch_message->message.choice.c1.present = LTE_MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9; *mbsfnAreaConfiguration = &mcch_message->message.choice.c1.choice.mbsfnAreaConfiguration_r9; - // Common Subframe Allocation (CommonSF-Alloc-r9) - mbsfn_SubframeConfig1= CALLOC(1,sizeof(*mbsfn_SubframeConfig1)); - memset((void*)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1)); + memset((void *)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1)); // - mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + mbsfn_SubframeConfig1->radioframeAllocationPeriod= LTE_MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; - mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + mbsfn_SubframeConfig1->subframeAllocation.present= LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1); mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1; mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2; // CURRENTLY WE ARE SUPPORITNG ONLY ONE sf ALLOCATION switch (sync_area) { - case 0: - if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. - } else { //111000 - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; - } + case 0: + if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { //111000 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; + } - break; + break; - case 1: - if (carrier->sib1->tdd_Config != NULL) { - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. - } else { // 000111 - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; - } + case 1: + if (carrier->sib1->tdd_Config != NULL) { + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { // 000111 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; + } - default : - break; + default : + break; } ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->commonSF_Alloc_r9.list,mbsfn_SubframeConfig1); - // commonSF-AllocPeriod-r9 - (*mbsfnAreaConfiguration)->commonSF_AllocPeriod_r9= MBSFNAreaConfiguration_r9__commonSF_AllocPeriod_r9_rf16; - + (*mbsfnAreaConfiguration)->commonSF_AllocPeriod_r9= LTE_MBSFNAreaConfiguration_r9__commonSF_AllocPeriod_r9_rf16; // PMCHs Information List (PMCH-InfoList-r9) // PMCH_1 Config - pmch_Info_1 = CALLOC(1,sizeof(PMCH_Info_r9_t)); - memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); - + pmch_Info_1 = CALLOC(1,sizeof(LTE_PMCH_Info_r9_t)); + memset((void *)pmch_Info_1,0,sizeof(LTE_PMCH_Info_r9_t)); /* * take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area * Note: this has to be set based on the subframeAllocation and CSA */ pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3; pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7; - pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; - + pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= LTE_PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; // MBMSs-SessionInfoList-r9 // pmch_Info_1->mbms_SessionInfoList_r9 = CALLOC(1,sizeof(struct MBMS_SessionInfoList_r9)); // Session 1 - mbms_Session_1 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); - memset(mbms_Session_1,0,sizeof(MBMS_SessionInfo_r9_t)); + mbms_Session_1 = CALLOC(1,sizeof(LTE_MBMS_SessionInfo_r9_t)); + memset(mbms_Session_1,0,sizeof(LTE_MBMS_SessionInfo_r9_t)); // TMGI value - mbms_Session_1->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; + mbms_Session_1->tmgi_r9.plmn_Id_r9.present= LTE_TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; mbms_Session_1->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; // Service ID memset(&mbms_Session_1->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check - OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char*)&TMGI[2],3); + OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char *)&TMGI[2],3); // Session ID is still missing here, it can be used as an rab id or mrb id mbms_Session_1->sessionId_r9 = CALLOC(1,sizeof(OCTET_STRING_t)); mbms_Session_1->sessionId_r9->buf= MALLOC(1); @@ -3044,7 +2548,6 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, // Logical Channel ID mbms_Session_1->logicalChannelIdentity_r9= MTCH; ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_1); - /* // Session 2 //mbms_Session_2 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t)); @@ -3065,37 +2568,20 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message); + xer_fprint(stdout,&asn_DEF_LTE_MCCH_Message,(void *)mcch_message); } - enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_MCCH_Message, NULL, - (void*)mcch_message, + (void *)mcch_message, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_MCCH_Message, (void *) &mcch_message)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_MCCH, message_string_size); - msg_p->ittiMsg.rrc_dl_mcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_mcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); @@ -3108,26 +2594,19 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, } #endif -uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) -{ - +uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) { asn_enc_rval_t enc_rval; - - UL_DCCH_Message_t ul_dcch_msg; - - MeasurementReport_t *measurementReport; - - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_measurementReport; + LTE_UL_DCCH_Message_t ul_dcch_msg; + LTE_MeasurementReport_t *measurementReport; + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_measurementReport; measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport; - - measurementReport->criticalExtensions.present=MeasurementReport__criticalExtensions_PR_c1; - measurementReport->criticalExtensions.choice.c1.present=MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8; + measurementReport->criticalExtensions.present=LTE_MeasurementReport__criticalExtensions_PR_c1; + measurementReport->criticalExtensions.choice.c1.present=LTE_MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8; measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s; measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult=rsrq_s; #else @@ -3136,40 +2615,31 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ #endif measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells=CALLOC(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=MeasResults__measResultNeighCells_PR_measResultListEUTRA; - - MeasResultListEUTRA_t *measResultListEUTRA2; + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA; + LTE_MeasResultListEUTRA_t *measResultListEUTRA2; measResultListEUTRA2 = CALLOC(1,sizeof(*measResultListEUTRA2)); - - struct MeasResultEUTRA *measresulteutra2; + struct LTE_MeasResultEUTRA *measresulteutra2; measresulteutra2 = CALLOC(1,sizeof(*measresulteutra2)); measresulteutra2->physCellId=phy_id;//1; - - struct MeasResultEUTRA__cgi_Info *measresult_cgi2; + struct LTE_MeasResultEUTRA__cgi_Info *measresult_cgi2; measresult_cgi2 = CALLOC(1,sizeof(*measresult_cgi2)); - memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity)); - // measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); measresult_cgi2->cellGlobalId.plmn_Identity.mcc = CALLOC(1, sizeof(*measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); - asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0; - - MCC_MNC_Digit_t dummy; + LTE_MCC_MNC_Digit_t dummy; dummy=2; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); dummy=6; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); dummy=2; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); - measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.size=0; measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.count=0; dummy=8; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); dummy=0; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); - measresult_cgi2->cellGlobalId.cellIdentity.buf=MALLOC(8); measresult_cgi2->cellGlobalId.cellIdentity.buf[0]=0x01; measresult_cgi2->cellGlobalId.cellIdentity.buf[1]=0x48; @@ -3177,222 +2647,154 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ measresult_cgi2->cellGlobalId.cellIdentity.buf[3]=0x03; measresult_cgi2->cellGlobalId.cellIdentity.size=4; measresult_cgi2->cellGlobalId.cellIdentity.bits_unused=4; - measresult_cgi2->trackingAreaCode.buf = MALLOC(2); measresult_cgi2->trackingAreaCode.buf[0]=0x00; measresult_cgi2->trackingAreaCode.buf[1]=0x10; measresult_cgi2->trackingAreaCode.size=2; measresult_cgi2->trackingAreaCode.bits_unused=0; - - measresulteutra2->cgi_Info=measresult_cgi2; - - struct MeasResultEUTRA__measResult meas2; + struct LTE_MeasResultEUTRA__measResult meas2; // int rsrp_va=10; - meas2.rsrpResult=&(rsrp_t); //&rsrp_va; meas2.rsrqResult=&(rsrq_t); - measresulteutra2->measResult=meas2; - ASN_SEQUENCE_ADD(&measResultListEUTRA2->list,measresulteutra2); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg); + } + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, - (void*)&ul_dcch_msg, + (void *)&ul_dcch_msg, buffer, 100); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); - } - } -# endif -#endif - - printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8); } -uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) -{ +uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; - - DL_DCCH_Message_t dl_dcch_msg; - - memset(&dl_dcch_msg, 0, sizeof(DL_DCCH_Message_t)); - - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; - dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_dlInformationTransfer; + LTE_DL_DCCH_Message_t dl_dcch_msg; + memset(&dl_dcch_msg, 0, sizeof(LTE_DL_DCCH_Message_t)); + dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.rrc_TransactionIdentifier = transaction_id; - dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.present = DLInformationTransfer__criticalExtensions_PR_c1; - dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.present = LTE_DLInformationTransfer__criticalExtensions_PR_c1; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.present = LTE_DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present = - DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; + LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; - - encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer); - - /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif - */ - + encoded = uper_encode_to_new_buffer (&asn_DEF_LTE_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **) buffer); return encoded; } -uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain) -{ +uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_paging_identity, cn_domain_t cn_domain) { LOG_D(RRC, "[eNB %d] do_Paging start\n", Mod_id); asn_enc_rval_t enc_rval; - - PCCH_Message_t pcch_msg; - PagingRecord_t *paging_record_p; + LTE_PCCH_Message_t pcch_msg; + LTE_PagingRecord_t *paging_record_p; int j; - - pcch_msg.message.present = PCCH_MessageType_PR_c1; - pcch_msg.message.choice.c1.present = PCCH_MessageType__c1_PR_paging; - + pcch_msg.message.present = LTE_PCCH_MessageType_PR_c1; + pcch_msg.message.choice.c1.present = LTE_PCCH_MessageType__c1_PR_paging; pcch_msg.message.choice.c1.choice.paging.pagingRecordList = CALLOC(1,sizeof(*pcch_msg.message.choice.c1.choice.paging.pagingRecordList)); - pcch_msg.message.choice.c1.choice.paging.systemInfoModification = NULL; pcch_msg.message.choice.c1.choice.paging.etws_Indication = NULL; pcch_msg.message.choice.c1.choice.paging.nonCriticalExtension = NULL; - asn_set_empty(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list); pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count = 0; - if ((paging_record_p = calloc(1, sizeof(PagingRecord_t))) == NULL) { + if ((paging_record_p = calloc(1, sizeof(LTE_PagingRecord_t))) == NULL) { /* Possible error on calloc */ return (-1); } - memset(paging_record_p, 0, sizeof(PagingRecord_t)); + memset(paging_record_p, 0, sizeof(LTE_PagingRecord_t)); /* convert ue_paging_identity_t to PagingUE_Identity_t */ if (ue_paging_identity.presenceMask == UE_PAGING_IDENTITY_s_tmsi) { - paging_record_p->ue_Identity.present = PagingUE_Identity_PR_s_TMSI; + paging_record_p->ue_Identity.present = LTE_PagingUE_Identity_PR_s_TMSI; MME_CODE_TO_OCTET_STRING(ue_paging_identity.choice.s_tmsi.mme_code, &paging_record_p->ue_Identity.choice.s_TMSI.mmec); paging_record_p->ue_Identity.choice.s_TMSI.mmec.bits_unused = 0; M_TMSI_TO_OCTET_STRING(ue_paging_identity.choice.s_tmsi.m_tmsi, - &paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI); + &paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI); paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI.bits_unused = 0; } else if (ue_paging_identity.presenceMask == UE_PAGING_IDENTITY_imsi) { - paging_record_p->ue_Identity.present = PagingUE_Identity_PR_imsi; - IMSI_Digit_t imsi_digit[21]; + paging_record_p->ue_Identity.present = LTE_PagingUE_Identity_PR_imsi; + LTE_IMSI_Digit_t imsi_digit[21]; + for (j = 0; j< ue_paging_identity.choice.imsi.length; j++) { /* IMSI size */ - imsi_digit[j] = (IMSI_Digit_t)ue_paging_identity.choice.imsi.buffer[j]; + imsi_digit[j] = (LTE_IMSI_Digit_t)ue_paging_identity.choice.imsi.buffer[j]; ASN_SEQUENCE_ADD(&paging_record_p->ue_Identity.choice.imsi.list, &imsi_digit[j]); } } /* set cn_domain */ if (cn_domain == CN_DOMAIN_PS) { - paging_record_p->cn_Domain = PagingRecord__cn_Domain_ps; + paging_record_p->cn_Domain = LTE_PagingRecord__cn_Domain_ps; } else { - paging_record_p->cn_Domain = PagingRecord__cn_Domain_cs; + paging_record_p->cn_Domain = LTE_PagingRecord__cn_Domain_cs; } + /* add to list */ ASN_SEQUENCE_ADD(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list, paging_record_p); LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n", - Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); + Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_PCCH_Message, NULL, (void *)&pcch_msg, buffer, RRC_BUF_SIZE); - enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, NULL, (void*)&pcch_msg, buffer, RRC_BUF_SIZE); - if(enc_rval.encoded == -1) - { - LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; + if(enc_rval.encoded == -1) { + LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return -1; } + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg); + xer_fprint(stdout, &asn_DEF_LTE_PCCH_Message, (void *)&pcch_msg); } return((enc_rval.encoded+7)/8); } -uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) -{ +uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; - - UL_DCCH_Message_t ul_dcch_msg; - - memset(&ul_dcch_msg, 0, sizeof(UL_DCCH_Message_t)); - - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ulInformationTransfer; - ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.present = ULInformationTransfer__criticalExtensions_PR_c1; - ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; + LTE_UL_DCCH_Message_t ul_dcch_msg; + memset(&ul_dcch_msg, 0, sizeof(LTE_UL_DCCH_Message_t)); + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.present = LTE_ULInformationTransfer__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.present = LTE_DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present = - ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; + LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; - - encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, (void **) buffer); - + encoded = uper_encode_to_new_buffer (&asn_DEF_LTE_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, (void **) buffer); return encoded; } -OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) -{ +OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) { static OAI_UECapability_t UECapability; /* TODO declared static to allow returning this has an address should be allocated in a cleaner way. */ - static SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it - static InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it - static BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it - + static LTE_SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it + static LTE_InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it + static LTE_BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it asn_enc_rval_t enc_rval; asn_dec_rval_t dec_rval; - - long maxNumberROHC_ContextSessions = PDCP_Parameters__maxNumberROHC_ContextSessions_cs16; + long maxNumberROHC_ContextSessions = LTE_PDCP_Parameters__maxNumberROHC_ContextSessions_cs16; int i; - - UE_EUTRA_Capability_t *UE_EUTRA_Capability; + LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability; char UE_EUTRA_Capability_xer[8192]; size_t size; - LOG_I(RRC,"Allocating %zu bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability)); - UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability)); - assert(UE_EUTRA_Capability); if (!UE_EUTRA_Capability_xer_fname) { @@ -3404,10 +2806,8 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) Bandlist[2].halfDuplex = 0; Bandlist[3].bandEUTRA = 38; // UL/DL 2570-2620, TDD Bandlist[3].halfDuplex = 0; - - memset((void*)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo)); - memset((void*)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA)); - + memset((void *)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo)); + memset((void *)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA)); InterFreqBandInfo[0][0].interFreqNeedForGaps = 0; InterFreqBandInfo[0][1].interFreqNeedForGaps = 1; InterFreqBandInfo[0][2].interFreqNeedForGaps = 1; @@ -3424,8 +2824,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) InterFreqBandInfo[3][1].interFreqNeedForGaps = 1; InterFreqBandInfo[3][2].interFreqNeedForGaps = 1; InterFreqBandInfo[3][3].interFreqNeedForGaps = 0; - - UE_EUTRA_Capability->accessStratumRelease = 0;//AccessStratumRelease_rel8; UE_EUTRA_Capability->ue_Category = 4; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0001=0; @@ -3437,47 +2835,39 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0102=0; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0103=0; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0104=0; - UE_EUTRA_Capability->pdcp_Parameters.maxNumberROHC_ContextSessions = &maxNumberROHC_ContextSessions; - UE_EUTRA_Capability->phyLayerParameters.ue_TxAntennaSelectionSupported = 0; UE_EUTRA_Capability->phyLayerParameters.ue_SpecificRefSigsSupported = 0; UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count = 0; - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][3]); // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands // UE_EUTRA_Capability->featureGroupIndicators // null - if(usim_test == 1) - { + if (get_softmodem_params()->usim_test == 1) { // featureGroup is mandatory for CMW tests // featureGroup is filled only for usim-test mode BIT_STRING_t *bit_string = CALLOC(1, sizeof(*bit_string)); @@ -3491,8 +2881,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) // UE_EUTRA_Capability->interRAT_Parameters // null } else { - - FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r"); + FILE *f = fopen(UE_EUTRA_Capability_xer_fname, "r"); assert(f); size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f); fclose(f); @@ -3503,50 +2892,23 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) return(NULL); } - dec_rval = xer_decode(0, &asn_DEF_UE_EUTRA_Capability, (void*)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size); + dec_rval = xer_decode(0, &asn_DEF_LTE_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size); assert(dec_rval.code == RC_OK); } UECapability.UE_EUTRA_Capability = UE_EUTRA_Capability; + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability); + xer_fprint(stdout,&asn_DEF_LTE_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability); } - enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, + + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_EUTRA_Capability, NULL, - (void*)UE_EUTRA_Capability, + (void *)UE_EUTRA_Capability, &UECapability.sdu[0], MAX_UE_CAPABILITY_SIZE); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - -#if defined(ENABLE_ITTI) -# if defined(DISABLE_XER_SPRINT) - { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY); - memcpy (&msg_p->ittiMsg, (void *) UE_EUTRA_Capability, sizeof(RrcUeEutraCapability)); - - itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, msg_p); - } -# else - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ue_eutra_capability.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ue_eutra_capability.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, msg_p); - } - } -# endif -#endif - UECapability.sdu_size = (enc_rval.encoded + 7) / 8; LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n", UECapability.sdu_size, enc_rval.encoded + 7); @@ -3561,7 +2923,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu); free(sdu); } - return(&UECapability); } diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h index a4da38c019..2d0c6ba7b6 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h @@ -40,7 +40,7 @@ #include /* for _ASN_DEFAULT_STACK_MAX */ #include "RRC/LTE/rrc_defs.h" -#include "SL-DestinationInfoList-r12.h" +#include "LTE_SL-DestinationInfoList-r12.h" /* * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) @@ -57,7 +57,7 @@ uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index); uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId); /** -\brief Generate configuration for SIB1 (eNB). +\brief Generate configuration for MIB (eNB). @param carrier pointer to Carrier information @param N_RB_DL Number of downlink PRBs @param phich_Resource PHICH resoure parameter @@ -71,7 +71,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich @param carrier pointer to Carrier information @param Mod_id Instance of eNB @param Component carrier Component carrier to configure -@param configuration Pointer Configuration Request structure +@param configuration Pointer Configuration Request structure @return size of encoded bit stream in bytes*/ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigurationReq *configuration @@ -91,7 +91,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigu uint8_t do_SIB23(uint8_t Mod_id, int CC_id #if defined(ENABLE_ITTI) - , RrcConfigurationReq *configuration + , RrcConfigurationReq *configuration #endif ); @@ -110,21 +110,21 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv); @param discTxResourceReq Pointer to number of discovery messages for discovery announcements for which UE requests E-UTRAN to assign dedicated resources @param mode Indicates different requests from upper layers @returns Size of encoded bit stream in bytes*/ -uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode); +uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode); /** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE) @param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU @returns Size of encoded bit stream in bytes*/ -uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t* buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, - const char* dedicatedInfoNAS); +uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, + const char *dedicatedInfoNAS); /** \brief Generate an RRCConnectionReconfigurationComplete UL-DCCH-Message (UE) @param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU @returns Size of encoded bit stream in bytes*/ uint8_t do_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, const uint8_t Transaction_id ); @@ -143,14 +143,14 @@ PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting @returns Size of encoded bit stream in bytes*/ uint8_t do_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, - SRB_ToAddModList_t** SRB_configList, - struct PhysicalConfigDedicated** physicalConfigDedicated + LTE_SRB_ToAddModList_t **SRB_configList, + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated ); /** @@ -177,31 +177,31 @@ do_RRCConnectionSetup( uint16_t do_RRCConnectionReconfiguration( - const protocol_ctxt_t* const ctxt_pP, - uint8_t *buffer, - uint8_t Transaction_id, - SRB_ToAddModList_t *SRB_list, - DRB_ToAddModList_t *DRB_list, - DRB_ToReleaseList_t *DRB_list2, - struct SPS_Config *sps_Config, - struct PhysicalConfigDedicated *physicalConfigDedicated, - MeasObjectToAddModList_t *MeasObj_list, - ReportConfigToAddModList_t *ReportConfig_list, - QuantityConfig_t *quantityConfig, - MeasIdToAddModList_t *MeasId_list, - MAC_MainConfig_t *mac_MainConfig, - MeasGapConfig_t *measGapConfig, - MobilityControlInfo_t *mobilityInfo, - struct MeasConfig__speedStatePars *speedStatePars, - RSRP_Range_t *rsrp, - C_RNTI_t *cba_rnti, - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList, - SL_CommConfig_r12_t *sl_CommConfig, - SL_DiscConfig_r12_t *sl_DiscConfig -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , SCellToAddMod_r10_t *SCell_config + const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, + uint8_t Transaction_id, + LTE_SRB_ToAddModList_t *SRB_list, + LTE_DRB_ToAddModList_t *DRB_list, + LTE_DRB_ToReleaseList_t *DRB_list2, + struct LTE_SPS_Config *sps_Config, + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated, + LTE_MeasObjectToAddModList_t *MeasObj_list, + LTE_ReportConfigToAddModList_t *ReportConfig_list, + LTE_QuantityConfig_t *quantityConfig, + LTE_MeasIdToAddModList_t *MeasId_list, + LTE_MAC_MainConfig_t *mac_MainConfig, + LTE_MeasGapConfig_t *measGapConfig, + LTE_MobilityControlInfo_t *mobilityInfo, + struct LTE_MeasConfig__speedStatePars *speedStatePars, + LTE_RSRP_Range_t *rsrp, + LTE_C_RNTI_t *cba_rnti, + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList, + LTE_SL_CommConfig_r12_t *sl_CommConfig, + LTE_SL_DiscConfig_r12_t *sl_DiscConfig +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , LTE_SCellToAddMod_r10_t *SCell_config #endif - ); +); /** \brief Generate an RRCConnectionReestablishment DL-CCCH-Message (eNB). This routine configures SRB_ToAddMod (SRB1/SRB2) and PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS. @@ -216,14 +216,14 @@ PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting @returns Size of encoded bit stream in bytes*/ uint8_t do_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, - SRB_ToAddModList_t **SRB_configList, - struct PhysicalConfigDedicated **physicalConfigDedicated); + LTE_SRB_ToAddModList_t **SRB_configList, + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated); /** \brief Generate an RRCConnectionReestablishmentReject DL-CCCH-Message (eNB). @@ -232,8 +232,8 @@ do_RRCConnectionReestablishment( @returns Size of encoded bit stream in bytes*/ uint8_t do_RRCConnectionReestablishmentReject( - uint8_t Mod_id, - uint8_t* const buffer); + uint8_t Mod_id, + uint8_t *const buffer); /** \brief Generate an RRCConnectionReject DL-CCCH-Message (eNB). @@ -242,8 +242,8 @@ do_RRCConnectionReestablishmentReject( @returns Size of encoded bit stream in bytes*/ uint8_t do_RRCConnectionReject( - uint8_t Mod_id, - uint8_t* const buffer); + uint8_t Mod_id, + uint8_t *const buffer); /** \brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This @@ -261,7 +261,7 @@ uint8_t do_RRCConnectionRelease(uint8_t Mod_id, uint8_t *buffer,int Transaction_ * @returns Size of encoded bit stream in bytes */ uint8_t do_MCCHMessage(uint8_t *buffer); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /*** * \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data) * @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU @@ -270,8 +270,8 @@ uint8_t do_MCCHMessage(uint8_t *buffer); uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, uint8_t sync_area, uint8_t *buffer, - MCCH_Message_t *mcch_message, - MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration); + LTE_MCCH_Message_t *mcch_message, + LTE_MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration); #endif uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t); @@ -282,18 +282,18 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer); -OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer); +OAI_UECapability_t *fill_ue_capability(char *LTE_UE_EUTRA_Capability_xer); uint8_t do_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id ); uint8_t do_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id, const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm); diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c index 20962f3ca1..4c63db1d03 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c @@ -43,26 +43,26 @@ //#include for NB-IoT------------------- -#include "RRCConnectionRequest-NB.h" -#include "BCCH-DL-SCH-Message-NB.h" -#include "UL-CCCH-Message-NB.h" -#include "UL-DCCH-Message-NB.h" -#include "DL-CCCH-Message-NB.h" -#include "DL-DCCH-Message-NB.h" -#include "EstablishmentCause-NB-r13.h" -#include "RRCConnectionSetup-NB.h" -#include "SRB-ToAddModList-NB-r13.h" -#include "DRB-ToAddModList-NB-r13.h" +#include "LTE_RRCConnectionRequest-NB.h" +#include "LTE_BCCH-DL-SCH-Message-NB.h" +#include "LTE_UL-CCCH-Message-NB.h" +#include "LTE_UL-DCCH-Message-NB.h" +#include "LTE_DL-CCCH-Message-NB.h" +#include "LTE_DL-DCCH-Message-NB.h" +#include "LTE_EstablishmentCause-NB-r13.h" +#include "LTE_RRCConnectionSetup-NB.h" +#include "LTE_SRB-ToAddModList-NB-r13.h" +#include "LTE_DRB-ToAddModList-NB-r13.h" #include "RRC/LTE/defs_NB_IoT.h" -#include "RRCConnectionSetupComplete-NB.h" -#include "RRCConnectionReconfigurationComplete-NB.h" -#include "RRCConnectionReconfiguration-NB.h" -#include "MasterInformationBlock-NB.h" -#include "SystemInformation-NB.h" -#include "SystemInformationBlockType1.h" -#include "SIB-Type-NB-r13.h" -#include "RRCConnectionResume-NB.h" -#include "RRCConnectionReestablishment-NB.h" +#include "LTE_RRCConnectionSetupComplete-NB.h" +#include "LTE_RRCConnectionReconfigurationComplete-NB.h" +#include "LTE_RRCConnectionReconfiguration-NB.h" +#include "LTE_MasterInformationBlock-NB.h" +#include "LTE_SystemInformation-NB.h" +#include "LTE_SystemInformationBlockType1.h" +#include "LTE_SIB-Type-NB-r13.h" +#include "LTE_RRCConnectionResume-NB.h" +#include "LTE_RRCConnectionReestablishment-NB.h" #include "../defs_NB_IoT.h" //---------------------------------------- @@ -84,7 +84,7 @@ uint8_t do_MIB_NB_IoT( uint32_t hyper_frame) { asn_enc_rval_t enc_rval; - BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT); + LTE_BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT); /* * systemFrameNumber-MSB: (TS 36.331 pag 576) @@ -123,14 +123,14 @@ uint8_t do_MIB_NB_IoT( mib_NB_IoT->message.ab_Enabled_r13 = 0; //to be decided - mib_NB_IoT->message.operationModeInfo_r13.present = MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13; + mib_NB_IoT->message.operationModeInfo_r13.present = LTE_MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13; mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13 = 0; printf("[MIB] Initialization of frame information,sfn_MSB %x, hsfn_LSB %x\n", (uint32_t)sfn_MSB, (uint32_t)hsfn_LSB); - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message_NB, NULL, (void*)mib_NB_IoT, carrier->MIB_NB_IoT, @@ -155,16 +155,16 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, uint32_t frame ) { - BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT); - SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT); + LTE_BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT); + LTE_SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT); asn_enc_rval_t enc_rval; - PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT; - MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; - SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT; - SIB_Type_NB_r13_t *sib_type_NB_IoT; + LTE_PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT; + LTE_MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; + LTE_SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT; + LTE_SIB_Type_NB_r13_t *sib_type_NB_IoT; long* attachWithoutPDN_Connectivity = NULL; @@ -175,9 +175,9 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, eutraControlRegionSize = CALLOC(1,sizeof(long)); long systemInfoValueTagSI = 0; - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t)); - bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1; - bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13; + memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_NB_t)); + bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_NB_PR_c1; + bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13; //allocation *sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13; @@ -195,7 +195,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, (*sib1_NB_IoT)->hyperSFN_MSB_r13.size = 1; (*sib1_NB_IoT)->hyperSFN_MSB_r13.bits_unused = 0; - memset(&PLMN_identity_info_NB_IoT,0,sizeof(PLMN_IdentityInfo_NB_r13_t)); + memset(&PLMN_identity_info_NB_IoT,0,sizeof(LTE_PLMN_IdentityInfo_NB_r13_t)); PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc = CALLOC(1,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc)); memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc)); @@ -251,7 +251,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, } //still set to "notReserved" as in the previous case - PLMN_identity_info_NB_IoT.cellReservedForOperatorUse_r13=PLMN_IdentityInfo_NB_r13__cellReservedForOperatorUse_r13_notReserved; + PLMN_identity_info_NB_IoT.cellReservedForOperatorUse_r13=LTE_PLMN_IdentityInfo_NB_r13__cellReservedForOperatorUse_r13_notReserved; *attachWithoutPDN_Connectivity = 0; PLMN_identity_info_NB_IoT.attachWithoutPDN_Connectivity_r13 = attachWithoutPDN_Connectivity; @@ -289,16 +289,16 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4; //Still set to "notBarred" as in the previous case - (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred; + (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=LTE_SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred; //Still Set to "notAllowed" like in the previous case - (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed; + (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=LTE_SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed; (*sib1_NB_IoT)->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589 (*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value) - (*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(P_Max_t)); + (*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(LTE_P_Max_t)); *((*sib1_NB_IoT)->p_Max_r13) = 23; //FIXME @@ -318,8 +318,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, */ - (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13)); - ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING; + (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct LTE_DL_Bitmap_NB_r13)); + ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= LTE_DL_Bitmap_NB_r13_PR_NOTHING; *eutraControlRegionSize = 1; (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize; @@ -328,22 +328,22 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, *nrs_CRS_PowerOffset= 0; (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset; - schedulingInfo_NB_IoT = (SchedulingInfo_NB_r13_t*) malloc (3*sizeof(SchedulingInfo_NB_r13_t)); - sib_type_NB_IoT = (SIB_Type_NB_r13_t *) malloc (3*sizeof(SIB_Type_NB_r13_t)); + schedulingInfo_NB_IoT = (LTE_SchedulingInfo_NB_r13_t*) malloc (3*sizeof(LTE_SchedulingInfo_NB_r13_t)); + sib_type_NB_IoT = (LTE_SIB_Type_NB_r13_t *) malloc (3*sizeof(LTE_SIB_Type_NB_r13_t)); - memset(&schedulingInfo_NB_IoT[0],0,sizeof(SchedulingInfo_NB_r13_t)); - memset(&schedulingInfo_NB_IoT[1],0,sizeof(SchedulingInfo_NB_r13_t)); - memset(&schedulingInfo_NB_IoT[2],0,sizeof(SchedulingInfo_NB_r13_t)); - memset(&sib_type_NB_IoT[0],0,sizeof(SIB_Type_NB_r13_t)); - memset(&sib_type_NB_IoT[1],0,sizeof(SIB_Type_NB_r13_t)); - memset(&sib_type_NB_IoT[2],0,sizeof(SIB_Type_NB_r13_t)); + memset(&schedulingInfo_NB_IoT[0],0,sizeof(LTE_SchedulingInfo_NB_r13_t)); + memset(&schedulingInfo_NB_IoT[1],0,sizeof(LTE_SchedulingInfo_NB_r13_t)); + memset(&schedulingInfo_NB_IoT[2],0,sizeof(LTE_SchedulingInfo_NB_r13_t)); + memset(&sib_type_NB_IoT[0],0,sizeof(LTE_SIB_Type_NB_r13_t)); + memset(&sib_type_NB_IoT[1],0,sizeof(LTE_SIB_Type_NB_r13_t)); + memset(&sib_type_NB_IoT[2],0,sizeof(LTE_SIB_Type_NB_r13_t)); // Now, follow the scheduler SIB configuration // There is only one sib2+sib3 common setting - schedulingInfo_NB_IoT[0].si_Periodicity_r13=SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096; - schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission. - schedulingInfo_NB_IoT[0].si_TB_r13= SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits + schedulingInfo_NB_IoT[0].si_Periodicity_r13=LTE_SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096; + schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=LTE_SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission. + schedulingInfo_NB_IoT[0].si_TB_r13= LTE_SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits // This is for SIB2/3 @@ -351,7 +351,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, * in the first SystemInformation message * listed in the schedulingInfoList list. * */ - sib_type_NB_IoT[0]=SIB_Type_NB_r13_sibType3_NB_r13; + sib_type_NB_IoT[0]=LTE_SIB_Type_NB_r13_sibType3_NB_r13; ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]); ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]); @@ -369,7 +369,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, } //FIXME which value chose for the following parameter - (*sib1_NB_IoT)->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160; + (*sib1_NB_IoT)->si_WindowLength_r13=LTE_SystemInformationBlockType1_NB__si_WindowLength_r13_ms160; (*sib1_NB_IoT)->si_RadioFrameOffset_r13= 0; /*In Nb-IoT change/update of specific SI message can additionally be indicated by a SI message specific value tag @@ -377,17 +377,17 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, *contained in systemInfoValueTagList_r13 **/ //FIXME correct? - (*sib1_NB_IoT)->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13)); + (*sib1_NB_IoT)->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct LTE_SystemInfoValueTagList_NB_r13)); asn_set_empty(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list); ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void*)bcch_message); } - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_NB, NULL, (void*)bcch_message, carrier->SIB1_NB_IoT, @@ -417,16 +417,16 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, rrc_eNB_carrier_data_NB_IoT_t *carrier,//MP: this is already a carrier[CC_id] NbIoTRrcConfigurationReq *configuration ) //openair2/COMMON/rrc_messages_types.h { - struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib2_NB_part; - struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib3_NB_part; + struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib2_NB_part; + struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib3_NB_part; - BCCH_DL_SCH_Message_NB_t *bcch_message = &(carrier->systemInformation_NB_IoT); //is the systeminformation-->BCCH_DL_SCH_Message_NB - SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT; - SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT; + LTE_BCCH_DL_SCH_Message_NB_t *bcch_message = &(carrier->systemInformation_NB_IoT); //is the systeminformation-->BCCH_DL_SCH_Message_NB + LTE_SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT; + LTE_SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT; asn_enc_rval_t enc_rval; - RACH_Info_NB_r13_t rach_Info_NB_IoT; - NPRACH_Parameters_NB_r13_t *nprach_parameters; + LTE_RACH_Info_NB_r13_t rach_Info_NB_IoT; + LTE_NPRACH_Parameters_NB_r13_t *nprach_parameters; //optional long *connEstFailOffset = NULL; @@ -435,16 +435,16 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, // RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList; // RSRP_Range_t rsrp_range; - ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition; - struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config; - struct DL_GapConfig_NB_r13 *dl_Gap; + LTE_ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition; + struct LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config; + struct LTE_DL_GapConfig_NB_r13 *dl_Gap; long *srs_SubframeConfig; srs_SubframeConfig= CALLOC(1, sizeof(long)); if (bcch_message) { - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t)); + memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_NB_t)); } else { LOG_E(RRC,"[NB-IoT %d] BCCH_MESSAGE_NB is null, exiting\n", Mod_id); exit(-1); @@ -464,13 +464,13 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, LOG_I(RRC,"[NB-IoT %d] Configuration SIB2/3\n", Mod_id); - sib2_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); - sib3_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); - memset(sib2_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); - memset(sib3_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); + sib2_NB_part = CALLOC(1,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); + sib3_NB_part = CALLOC(1,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); + memset(sib2_NB_part,0,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); + memset(sib3_NB_part,0,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); - sib2_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13; - sib3_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13; + sib2_NB_part->present = LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13; + sib3_NB_part->present = LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13; //may bug if not correct allocation of memory carrier->sib2_NB_IoT = &sib2_NB_part->choice.sib2_r13; @@ -478,11 +478,11 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, sib2_NB_IoT = carrier->sib2_NB_IoT; sib3_NB_IoT = carrier->sib3_NB_IoT; - nprach_parameters = (NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(NPRACH_Parameters_NB_r13_t)); + nprach_parameters = (LTE_NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(LTE_NPRACH_Parameters_NB_r13_t)); - memset(&nprach_parameters[0],0,sizeof(NPRACH_Parameters_NB_r13_t)); - memset(&nprach_parameters[1],0,sizeof(NPRACH_Parameters_NB_r13_t)); - memset(&nprach_parameters[2],0,sizeof(NPRACH_Parameters_NB_r13_t)); + memset(&nprach_parameters[0],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t)); + memset(&nprach_parameters[1],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t)); + memset(&nprach_parameters[2],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t)); /// SIB2-NB----------------------------------------- @@ -582,7 +582,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, /*OPTIONAL*/ - dmrs_config = CALLOC(1,sizeof(struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13)); + dmrs_config = CALLOC(1,sizeof(struct LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13)); dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13; dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13; @@ -606,7 +606,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, //dl_GAP---------------------------------------------------------------------------------/*OPTIONAL*/ - dl_Gap = CALLOC(1,sizeof(struct DL_GapConfig_NB_r13)); + dl_Gap = CALLOC(1,sizeof(struct LTE_DL_GapConfig_NB_r13)); dl_Gap->dl_GapDurationCoeff_r13= configuration-> dl_GapDurationCoeff_NB; dl_Gap->dl_GapPeriodicity_r13= configuration->dl_GapPeriodicity_NB; dl_Gap->dl_GapThreshold_r13= configuration->dl_GapThreshold_NB; @@ -631,14 +631,14 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, sib2_NB_IoT->freqInfo_r13.additionalSpectrumEmission_r13 = 1; sib2_NB_IoT->freqInfo_r13.ul_CarrierFreq_r13 = NULL; /*OPTIONAL*/ - sib2_NB_IoT->timeAlignmentTimerCommon_r13=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; + sib2_NB_IoT->timeAlignmentTimerCommon_r13=LTE_TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; /*OPTIONAL*/ sib2_NB_IoT->multiBandInfoList_r13 = NULL; /// SIB3-NB------------------------------------------------------- - sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4; + sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=LTE_SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4; sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration? sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70; @@ -656,10 +656,10 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, ///BCCH message (generate the SI message) - bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1; - bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13; + bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_NB_PR_c1; + bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13; - bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.present = SystemInformation_NB__criticalExtensions_PR_systemInformation_r13; + bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.present = LTE_SystemInformation_NB__criticalExtensions_PR_systemInformation_r13; bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list.count=0; ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list, @@ -668,9 +668,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, sib3_NB_part); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void*)bcch_message); } - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_NB, NULL, (void*)bcch_message, carrier->SIB23_NB_IoT, @@ -704,8 +704,8 @@ uint8_t do_RRCConnectionSetup_NB_IoT( uint8_t* const buffer, //Srb0.Tx_buffer.Payload const uint8_t Transaction_id, const NB_IoT_DL_FRAME_PARMS* const frame_parms, // maybe not used - SRB_ToAddModList_NB_r13_t** SRB_configList_NB_IoT, //for both SRB1bis and SRB1 - struct PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT + LTE_SRB_ToAddModList_NB_r13_t** SRB_configList_NB_IoT, //for both SRB1bis and SRB1 + struct LTE_PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT ) { @@ -725,26 +725,26 @@ uint8_t do_RRCConnectionSetup_NB_IoT( // struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL; // struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL; - struct SRB_ToAddMod_NB_r13* SRB1bis_config_NB_IoT = NULL; - struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB_IoT = NULL; - struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1bis_lchan_config_NB_IoT = NULL; + struct LTE_SRB_ToAddMod_NB_r13* SRB1bis_config_NB_IoT = NULL; + struct LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB_IoT = NULL; + struct LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1bis_lchan_config_NB_IoT = NULL; //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB - PhysicalConfigDedicated_NB_r13_t* physicalConfigDedicated2_NB_IoT = NULL; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionSetup_NB_t* rrcConnectionSetup_NB_IoT = NULL; + LTE_PhysicalConfigDedicated_NB_r13_t* physicalConfigDedicated2_NB_IoT = NULL; + LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + LTE_RRCConnectionSetup_NB_t* rrcConnectionSetup_NB_IoT = NULL; - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13; + memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t)); + dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13; rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13; if (*SRB_configList_NB_IoT) { free(*SRB_configList_NB_IoT); } - *SRB_configList_NB_IoT = CALLOC(1,sizeof(SRB_ToAddModList_NB_r13_t)); + *SRB_configList_NB_IoT = CALLOC(1,sizeof(LTE_SRB_ToAddModList_NB_r13_t)); /// SRB1-------------------- { @@ -796,18 +796,18 @@ uint8_t do_RRCConnectionSetup_NB_IoT( SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT)); SRB1bis_config_NB_IoT->rlc_Config_r13 = SRB1bis_rlc_config_NB_IoT; - SRB1bis_rlc_config_NB_IoT->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT + SRB1bis_rlc_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=LTE_RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000; - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = LTE_T_PollRetransmit_NB_r13_ms25000; + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = LTE_UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; //(musT be disabled--> SRB1 config pag 640 specs ) SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL; SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT)); SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT; - SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; + SRB1bis_lchan_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; prioritySRB1bis = CALLOC(1, sizeof(long)); *prioritySRB1bis = 1; //same as SRB1? @@ -846,13 +846,13 @@ uint8_t do_RRCConnectionSetup_NB_IoT( //DL physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13)); + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13)); physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present= - DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13; + LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13; - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13)); + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13)); physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present = - DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13; + LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13; physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL; @@ -877,8 +877,8 @@ uint8_t do_RRCConnectionSetup_NB_IoT( //Fill the rrcConnectionSetup-NB message rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value - rrcConnectionSetup_NB_IoT->criticalExtensions.present = RRCConnectionSetup_NB__criticalExtensions_PR_c1; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ; + rrcConnectionSetup_NB_IoT->criticalExtensions.present = LTE_RRCConnectionSetup_NB__criticalExtensions_PR_c1; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =LTE_RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ; //MP: carry only SRB1bis at the moment and phyConfigDedicated rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT; rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; @@ -888,9 +888,9 @@ uint8_t do_RRCConnectionSetup_NB_IoT( rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB, NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, @@ -917,32 +917,32 @@ uint8_t do_SecurityModeCommand_NB_IoT( const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm) { - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; + LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); + memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_securityModeCommand_r13; + dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_securityModeCommand_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.rrc_TransactionIdentifier = Transaction_id; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.present = - SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; + LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; // the two following information could be based on the mod_id dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm - = (CipheringAlgorithm_r12_t)cipheringAlgorithm; //bug solved + = (LTE_CipheringAlgorithm_r12_t)cipheringAlgorithm; //bug solved dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm - = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; + = (e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; //only changed "asn_DEF_DL_DCCH_Message_NB" if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, @@ -983,28 +983,28 @@ uint8_t do_UECapabilityEnquiry_NB_IoT( { - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; + LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; //no RAT type in NB-IoT asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); + memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_ueCapabilityEnquiry_r13; + dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_ueCapabilityEnquiry_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.rrc_TransactionIdentifier = Transaction_id; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.present = UECapabilityEnquiry_NB__criticalExtensions_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.present = LTE_UECapabilityEnquiry_NB__criticalExtensions_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.choice.c1.present = - UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13; + LTE_UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13; //no ue_CapabilityRequest (list of RAT_Type) //only changed "asn_DEF_DL_DCCH_Message_NB" if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, @@ -1042,32 +1042,32 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( const protocol_ctxt_t* const ctxt_pP, uint8_t *buffer, uint8_t Transaction_id, - SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1 - DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default) - DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed - struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT, - MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT, - struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT) + LTE_SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1 + LTE_DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default) + LTE_DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed + struct LTE_PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT, + LTE_MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT, + struct LTE_RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT) { //check on DRB_list if contains more than 2 DRB? asn_enc_rval_t enc_rval; - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; - RRCConnectionReconfiguration_NB_t *rrcConnectionReconfiguration_NB; + LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; + LTE_RRCConnectionReconfiguration_NB_t *rrcConnectionReconfiguration_NB; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); + memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfiguration_r13; + dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfiguration_r13; rrcConnectionReconfiguration_NB = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReconfiguration_r13; // RRCConnectionReconfiguration rrcConnectionReconfiguration_NB->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionReconfiguration_NB->criticalExtensions.present = RRCConnectionReconfiguration_NB__criticalExtensions_PR_c1; - rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration_NB__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r13 ; + rrcConnectionReconfiguration_NB->criticalExtensions.present = LTE_RRCConnectionReconfiguration_NB__criticalExtensions_PR_c1; + rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.present =LTE_RRCConnectionReconfiguration_NB__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r13 ; //RAdioResourceconfigDedicated rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13 = @@ -1083,7 +1083,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13 = CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13)); rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->present - =RadioResourceConfigDedicated_NB_r13__mac_MainConfig_r13_PR_explicitValue_r13; + =LTE_RadioResourceConfigDedicated_NB_r13__mac_MainConfig_r13_PR_explicitValue_r13; //why memcopy only this one? memcpy(&rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->choice.explicitValue_r13, mac_MainConfig_NB_IoT, sizeof(*mac_MainConfig_NB_IoT)); @@ -1099,7 +1099,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( //mainly used for cell-reselection/handover purposes?? rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, @@ -1111,7 +1111,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( //changed only asn_DEF_DL_DCCH_Message_NB if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT); } //#if defined(ENABLE_ITTI) @@ -1131,22 +1131,22 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT( asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; + LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + LTE_RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishmentReject_r13; + memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t)); + dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishmentReject_r13; rrcConnectionReestablishmentReject = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishmentReject_r13; // RRCConnectionReestablishmentReject //exactly the same as LTE - rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; + rrcConnectionReestablishmentReject->criticalExtensions.present = LTE_RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; //Only change in "asn_DEF_DL_CCCH_Message_NB" if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB, NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, @@ -1163,7 +1163,7 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT( char message_string[20000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); @@ -1193,17 +1193,17 @@ uint8_t do_RRCConnectionReject_NB_IoT( asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionReject_NB_t *rrcConnectionReject_NB_IoT; + LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + LTE_RRCConnectionReject_NB_t *rrcConnectionReject_NB_IoT; - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReject_r13; + memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t)); + dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReject_r13; rrcConnectionReject_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReject_r13; // RRCConnectionReject-NB_IoT - rrcConnectionReject_NB_IoT->criticalExtensions.present = RRCConnectionReject_NB__criticalExtensions_PR_c1; - rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReject_NB__criticalExtensions__c1_PR_rrcConnectionReject_r13; + rrcConnectionReject_NB_IoT->criticalExtensions.present = LTE_RRCConnectionReject_NB__criticalExtensions_PR_c1; + rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionReject_NB__criticalExtensions__c1_PR_rrcConnectionReject_r13; /* let's put an extended wait time of 1s for the moment */ rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.extendedWaitTime_r13 = 1; //new-use of suspend indication @@ -1211,13 +1211,13 @@ uint8_t do_RRCConnectionReject_NB_IoT( rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13= CALLOC(1, sizeof(long)); *(rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13)= - RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true; + LTE_RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true; //Only Modified "asn_DEF_DL_CCCH_Message_NB" if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); } - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB, NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, @@ -1233,7 +1233,7 @@ uint8_t do_RRCConnectionReject_NB_IoT( char message_string[20000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); @@ -1269,19 +1269,19 @@ uint8_t do_DLInformationTransfer_NB_IoT( { ssize_t encoded; - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; + LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; - memset(&dl_dcch_msg_NB_IoT, 0, sizeof(DL_DCCH_Message_NB_t)); + memset(&dl_dcch_msg_NB_IoT, 0, sizeof(LTE_DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_dlInformationTransfer_r13; + dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_dlInformationTransfer_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.rrc_TransactionIdentifier = transaction_id; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.present = DLInformationTransfer_NB__criticalExtensions_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.present = DLInformationTransfer_NB__criticalExtensions__c1_PR_dlInformationTransfer_r13; + dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.present = LTE_DLInformationTransfer_NB__criticalExtensions_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.present = LTE_DLInformationTransfer_NB__criticalExtensions__c1_PR_dlInformationTransfer_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.size = pdu_length; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.buf = pdu_buffer; - encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer); + encoded = uper_encode_to_new_buffer (&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer); //only change in "asn_DEF_DL_DCCH_Message_NB" #if defined(ENABLE_ITTI) @@ -1290,7 +1290,7 @@ uint8_t do_DLInformationTransfer_NB_IoT( char message_string[10000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); @@ -1317,23 +1317,23 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( uint8_t* const buffer, const uint8_t Transaction_id, const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed - SRB_ToAddModList_NB_r13_t* SRB_list_NB_IoT) //should contain SRB1 already configured? + LTE_SRB_ToAddModList_NB_r13_t* SRB_list_NB_IoT) //should contain SRB1 already configured? { asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionReestablishment_NB_t* rrcConnectionReestablishment_NB_IoT; + LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + LTE_RRCConnectionReestablishment_NB_t* rrcConnectionReestablishment_NB_IoT; - memset(&dl_ccch_msg_NB_IoT, 0, sizeof(DL_CCCH_Message_NB_t)); + memset(&dl_ccch_msg_NB_IoT, 0, sizeof(LTE_DL_CCCH_Message_NB_t)); - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13; + dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13; rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13; //rrcConnectionReestablishment_NB rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = RRCConnectionReestablishment_NB__criticalExtensions_PR_c1; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions_PR_c1; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13; rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT; rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; @@ -1344,7 +1344,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0; - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB, NULL, (void*)&dl_ccch_msg_NB_IoT, buffer, @@ -1356,7 +1356,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( } if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT); } #if defined(ENABLE_ITTI) @@ -1365,7 +1365,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( char message_string[30000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); @@ -1391,22 +1391,22 @@ uint8_t do_RRCConnectionRelease_NB_IoT( asn_enc_rval_t enc_rval; - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; - RRCConnectionRelease_NB_t *rrcConnectionRelease_NB_IoT; + LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; + LTE_RRCConnectionRelease_NB_t *rrcConnectionRelease_NB_IoT; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); + memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13; + dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1; + dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13; rrcConnectionRelease_NB_IoT = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionRelease_r13; // RRCConnectionRelease rrcConnectionRelease_NB_IoT->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionRelease_NB_IoT->criticalExtensions.present = RRCConnectionRelease_NB__criticalExtensions_PR_c1; - rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ; + rrcConnectionRelease_NB_IoT->criticalExtensions.present = LTE_RRCConnectionRelease_NB__criticalExtensions_PR_c1; + rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ; - rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = ReleaseCause_NB_r13_other; + rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = LTE_ReleaseCause_NB_r13_other; rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.redirectedCarrierInfo_r13 = NULL; rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.extendedWaitTime_r13 = NULL; @@ -1414,7 +1414,7 @@ uint8_t do_RRCConnectionRelease_NB_IoT( rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension)); - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*)&dl_dcch_msg_NB_IoT, buffer, diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1 index b6f64a99ed..ceb4a7cd37 100755 --- a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1 +++ b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1 @@ -735,7 +735,7 @@ Paging-v1130-IEs ::= SEQUENCE { } Paging-v1310-IEs ::= SEQUENCE { - redistributionIndication-r13 ENUMERATED {true} OPTIONAL, --Need ON + redistributionIndication-r13 ENUMERATED {true} OPTIONAL, -- Need ON systemInfoModification-eDRX-r13 ENUMERATED {true} OPTIONAL, -- Need ON nonCriticalExtension SEQUENCE {} OPTIONAL } diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h index 0cc8a37bc0..160d92a610 100644 --- a/openair2/RRC/LTE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -50,17 +50,17 @@ //#include "SystemInformationBlockType1-NB.h" //#include "SystemInformation-NB.h" -#include "RRCConnectionReconfiguration-NB.h" -#include "RRCConnectionReconfigurationComplete-NB.h" -#include "RRCConnectionSetup-NB.h" -#include "RRCConnectionSetupComplete-NB.h" -#include "RRCConnectionRequest-NB.h" -#include "RRCConnectionReestablishmentRequest-NB.h" -#include "BCCH-DL-SCH-Message-NB.h" -#include "BCCH-BCH-Message-NB.h" -#include "AS-Config-NB.h" -#include "AS-Context-NB.h" -#include "UE-Capability-NB-r13.h" //equivalent of UE-EUTRA-Capability.h +#include "LTE_RRCConnectionReconfiguration-NB.h" +#include "LTE_RRCConnectionReconfigurationComplete-NB.h" +#include "LTE_RRCConnectionSetup-NB.h" +#include "LTE_RRCConnectionSetupComplete-NB.h" +#include "LTE_RRCConnectionRequest-NB.h" +#include "LTE_RRCConnectionReestablishmentRequest-NB.h" +#include "LTE_BCCH-DL-SCH-Message-NB.h" +#include "LTE_BCCH-BCH-Message-NB.h" +#include "LTE_AS-Config-NB.h" +#include "LTE_AS-Context-NB.h" +#include "LTE_UE-Capability-NB-r13.h" //equivalent of UE-EUTRA-Capability.h //------------------- #if defined(ENABLE_ITTI) @@ -122,7 +122,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { uint8_t SIB1systemInfoValueTag; uint32_t SIStatus; uint32_t SIcnt; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA #endif uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 @@ -235,14 +235,14 @@ typedef struct SRB_INFO_TABLE_ENTRY_NB_IoT_s { //MEAS_REPORT_LIST_s not implemented in NB-IoT but is used at UE side //HANDOVER_INFO_UE not implemented in NB-IoT typedef struct HANDOVER_INFO_UE_NB_IoT_s { - PhysCellId_t targetCellId; + LTE_PhysCellId_t targetCellId; uint8_t measFlag; } HANDOVER_INFO_UE_NB_IoT; //NB-IoT eNB_RRC_UE_NB_IoT_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------ typedef struct eNB_RRC_UE_NB_IoT_s { - EstablishmentCause_t establishment_cause; + LTE_EstablishmentCause_t establishment_cause; uint8_t primaryCC_id; //in NB-IoT only SRB0, SRB1 and SRB1bis (until AS security activation) exist @@ -256,14 +256,14 @@ typedef struct eNB_RRC_UE_NB_IoT_s { * message previously sent by the eNB (e.g. RRCConnectionSetup -- RRCConnectionSetupComplete) * this because it could happen that more messages are transmitted at the same time */ - SRB_ToAddModList_NB_r13_t* SRB_configList;//for SRB1 and SRB1bis - SRB_ToAddModList_NB_r13_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; - DRB_ToAddModList_NB_r13_t* DRB_configList; //for all the DRBs - DRB_ToAddModList_NB_r13_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid + LTE_SRB_ToAddModList_NB_r13_t* SRB_configList;//for SRB1 and SRB1bis + LTE_SRB_ToAddModList_NB_r13_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; + LTE_DRB_ToAddModList_NB_r13_t* DRB_configList; //for all the DRBs + LTE_DRB_ToAddModList_NB_r13_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid uint8_t DRB_active[2];//in LTE was 8 --> at most 2 for NB-IoT - struct PhysicalConfigDedicated_NB_r13* physicalConfigDedicated_NB_IoT; - MAC_MainConfig_NB_r13_t* mac_MainConfig_NB_IoT; + struct LTE_PhysicalConfigDedicated_NB_r13* physicalConfigDedicated_NB_IoT; + LTE_MAC_MainConfig_NB_r13_t* mac_MainConfig_NB_IoT; //No SPS(semi-persistent scheduling) in NB-IoT //No Measurement report in NB-IoT @@ -279,8 +279,8 @@ typedef struct eNB_RRC_UE_NB_IoT_s { #endif /* Used integrity/ciphering algorithms--> maintained the same for NB-IoT */ - e_CipheringAlgorithm_r12 ciphering_algorithm; //Specs. TS 36.331 V14.1.0 pag 432 Change position of chipering enumerative w.r.t previous version - e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + e_LTE_CipheringAlgorithm_r12 ciphering_algorithm; //Specs. TS 36.331 V14.1.0 pag 432 Change position of chipering enumerative w.r.t previous version + e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; uint8_t Status; rnti_t rnti; @@ -290,10 +290,10 @@ typedef struct eNB_RRC_UE_NB_IoT_s { /* Information from UE RRC ConnectionRequest-NB-r13_IE--> NB-IoT */ UE_S_TMSI_NB_IoT Initialue_identity_s_TMSI; - EstablishmentCause_NB_r13_t establishment_cause_NB_IoT; //different set for NB-IoT + LTE_EstablishmentCause_NB_r13_t establishment_cause_NB_IoT; //different set for NB-IoT /* Information from UE RRC ConnectionReestablishmentRequest-NB--> NB-IoT */ - ReestablishmentCause_NB_r13_t reestablishment_cause_NB_IoT; //different set for NB_IoT + LTE_ReestablishmentCause_NB_r13_t reestablishment_cause_NB_IoT; //different set for NB_IoT /* UE id for initial connection to S1AP */ uint16_t ue_initial_id; @@ -389,18 +389,18 @@ typedef struct { uint16_t physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS //are the only static one (memory has been already allocated) - BCCH_BCH_Message_NB_t mib_NB_IoT; - BCCH_DL_SCH_Message_NB_t siblock1_NB_IoT; //SIB1-NB - BCCH_DL_SCH_Message_NB_t systemInformation_NB_IoT; //SI + LTE_BCCH_BCH_Message_NB_t mib_NB_IoT; + LTE_BCCH_DL_SCH_Message_NB_t siblock1_NB_IoT; //SIB1-NB + LTE_BCCH_DL_SCH_Message_NB_t systemInformation_NB_IoT; //SI - SystemInformationBlockType1_NB_t *sib1_NB_IoT; - SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT; - SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT; + LTE_SystemInformationBlockType1_NB_t *sib1_NB_IoT; + LTE_SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT; + LTE_SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT; //not implemented yet - SystemInformationBlockType4_NB_r13_t *sib4_NB_IoT; - SystemInformationBlockType5_NB_r13_t *sib5_NB_IoT; - SystemInformationBlockType14_NB_r13_t *sib14_NB_IoT; - SystemInformationBlockType16_NB_r13_t *sib16_NB_IoT; + LTE_SystemInformationBlockType4_NB_r13_t *sib4_NB_IoT; + LTE_SystemInformationBlockType5_NB_r13_t *sib5_NB_IoT; + LTE_SystemInformationBlockType14_NB_r13_t *sib14_NB_IoT; + LTE_SystemInformationBlockType16_NB_r13_t *sib16_NB_IoT; SRB_INFO_NB_IoT SI; @@ -466,7 +466,7 @@ typedef struct OAI_UECapability_NB_IoT_s { uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NB_IoT]; uint8_t sdu_size; ////NB-IoT------ - UE_Capability_NB_r13_t UE_Capability_NB_IoT; //replace the UE_EUTRA_Capability of LTE + LTE_UE_Capability_NB_r13_t UE_Capability_NB_IoT; //replace the UE_EUTRA_Capability of LTE } OAI_UECapability_NB_IoT_t; #define RRC_BUFFER_SIZE_MAX_NB_IoT 1024 @@ -501,7 +501,7 @@ typedef struct UE_RRC_INST_NB_IoT_s { SystemInformationBlockType1_t *sib1[NB_CNX_UE]; SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). */ - SystemInformationBlockType2_t *sib2[NB_CNX_UE]; + LTE_SystemInformationBlockType2_t *sib2[NB_CNX_UE]; /* SystemInformationBlockType3_t *sib3[NB_CNX_UE]; SystemInformationBlockType4_t *sib4[NB_CNX_UE]; @@ -513,7 +513,7 @@ typedef struct UE_RRC_INST_NB_IoT_s { SystemInformationBlockType10_t *sib10[NB_CNX_UE]; SystemInformationBlockType11_t *sib11[NB_CNX_UE]; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t MBMS_flag; uint8_t *MCCH_MESSAGE[NB_CNX_UE]; uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE]; diff --git a/openair2/RRC/LTE/extern_NB_IoT.h b/openair2/RRC/LTE/extern_NB_IoT.h index f136b57b47..f240e8b215 100644 --- a/openair2/RRC/LTE/extern_NB_IoT.h +++ b/openair2/RRC/LTE/extern_NB_IoT.h @@ -33,7 +33,7 @@ #include "RRC/LTE/defs_NB_IoT.h" #include "PHY_INTERFACE/IF_Module_NB_IoT.h" #include "LAYER2/RLC/rlc.h" -#include "LogicalChannelConfig-NB-r13.h" +#include "LTE_LogicalChannelConfig-NB-r13.h" #include "LAYER2/MAC/defs_NB_IoT.h" #include "common/ran_context.h" @@ -48,8 +48,8 @@ extern PHY_Config_NB_IoT_t *config_INFO; extern rlc_info_t Rlc_info_am_NB_IoT,Rlc_info_am_config_NB_IoT; extern uint8_t DRB2LCHAN_NB_IoT[2]; -extern LogicalChannelConfig_NB_r13_t SRB1bis_logicalChannelConfig_defaultValue_NB_IoT; -extern LogicalChannelConfig_NB_r13_t SRB1_logicalChannelConfig_defaultValue_NB_IoT; +extern LTE_LogicalChannelConfig_NB_r13_t SRB1bis_logicalChannelConfig_defaultValue_NB_IoT; +extern LTE_LogicalChannelConfig_NB_r13_t SRB1_logicalChannelConfig_defaultValue_NB_IoT; extern uint16_t T300_NB_IoT[8]; extern uint16_t T301_NB_IoT[8]; diff --git a/openair2/RRC/LTE/proto_NB_IoT.h b/openair2/RRC/LTE/proto_NB_IoT.h index de09d39fab..e5c5d8056b 100644 --- a/openair2/RRC/LTE/proto_NB_IoT.h +++ b/openair2/RRC/LTE/proto_NB_IoT.h @@ -203,7 +203,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB_IoT( void rrc_eNB_process_RRCConnectionSetupComplete_NB_IoT( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_NB_IoT_t* ue_context_pP, - RRCConnectionSetupComplete_NB_r13_IEs_t * rrcConnectionSetupComplete_NB + LTE_RRCConnectionSetupComplete_NB_r13_IEs_t * rrcConnectionSetupComplete_NB ); void rrc_eNB_generate_SecurityModeCommand_NB_IoT( diff --git a/openair2/RRC/LTE/rrc_2_rrm_msg.c b/openair2/RRC/LTE/rrc_2_rrm_msg.c deleted file mode 100644 index 87a0a3557b..0000000000 --- a/openair2/RRC/LTE/rrc_2_rrm_msg.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! -******************************************************************************* - -\file rrc_2_rrm_msg.c - -\brief data formating for sending message over socket between RRC and RRM - -\author BURLOT Pascal - -\date 16/07/08 - -\par Historique: - P.BURLOT 2009-01-20 - bug fix (memeory leak) - Macro changed : - RRM_CALLOC() by RRM_CALLOC2() in msg_rrc_sensing_meas_ind() - -******************************************************************************* -*/ -#ifdef RRC_EMUL - -#include -#include -#include -#include -#include "L3_rrc_defs.h" -#include "rrm_sock.h" -#include "L3_rrc_interface.h" -#include "rrc_rrm_msg.h" -#include "rrm_util.h" - -#else - -#include "defs.h" - -#endif - -#ifdef TRACE -//! Macro creant la chaine a partir du nom de la variable -#define STRINGIZER(x) #x -//! Tableau pour le mode trace faisant la translation entre le numero et le nom du message -const char *Str_msg_rrc_rrm[NB_MSG_RRC_RRM] = { - STRINGIZER(RRM_RB_ESTABLISH_REQ ), - STRINGIZER(RRC_RB_ESTABLISH_RESP ), - STRINGIZER(RRC_RB_ESTABLISH_CFM ), - STRINGIZER(RRM_RB_MODIFY_REQ ), - STRINGIZER(RRC_RB_MODIFY_RESP ), - STRINGIZER(RRC_RB_MODIFY_CFM ), - STRINGIZER(RRM_RB_RELEASE_REQ ), - STRINGIZER(RRC_RB_RELEASE_RESP ), - STRINGIZER(RRC_MR_ATTACH_IND ), - STRINGIZER(RRM_SENSING_MEAS_REQ ), - STRINGIZER(RRC_SENSING_MEAS_RESP ), - STRINGIZER(RRC_CX_ESTABLISH_IND ), - STRINGIZER(RRC_PHY_SYNCH_TO_MR_IND ), - STRINGIZER(RRC_PHY_SYNCH_TO_CH_IND ), - STRINGIZER(RRCI_CX_ESTABLISH_RESP ), - STRINGIZER(RRC_SENSING_MEAS_IND ), - STRINGIZER(RRM_SENSING_MEAS_RESP ), - STRINGIZER(RRC_RB_MEAS_IND ), - STRINGIZER(RRM_RB_MEAS_RESP ), - STRINGIZER(RRM_INIT_CH_REQ ), - STRINGIZER(RRCI_INIT_MR_REQ ) -} ; -#endif - -/*! -******************************************************************************* -\brief This function initialize the message header -\return any return value -*/ -static void init_rrc_msg_head( - msg_head_t *msg_head , //!< message header to initialize - Instance_t inst , //!< Instance ID - MSG_RRC_RRM_T msg_type , //!< type of message to initialize - unsigned int size , //!< size of message - Transaction_t Trans_id //!< transaction id associated to this message -) -{ - if ( msg_head != NULL ) { - msg_head->start = START_MSG ; - msg_head->msg_type = 0xFF & msg_type ; - msg_head->inst = inst ; - msg_head->Trans_id = Trans_id ; - msg_head->size = size; - } -} - - -/*! -******************************************************************************* -\brief La fonction formate en un message generique de reponse pour les - fonctions : - - rrc_rb_establish_resp(),rrc_rb_modify_resp(),rrc_rb_modify_resp(), - - rrc_rb_release_resp() et rrc_sensing_meas_resp() . -\return message formate -*/ -msg_t mesg; -msg_t *msg_rrc_generic_resp( - Instance_t inst , //!< Instance ID - MSG_RRC_RRM_T msg_type , //!< type of message - Transaction_t Trans_id //!< Transaction ID -) -{ - init_rrc_msg_head(&(mesg.head),inst, msg_type, 0 , Trans_id); - mesg.data = NULL ; - - return &mesg ; -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_establish_resp(). -\return message formate -*/ -msg_t *msg_rrc_rb_establish_resp( - Instance_t inst , //!< Instance ID - Transaction_t Trans_id //!< Transaction ID -) -{ - return msg_rrc_generic_resp( inst, RRC_RB_ESTABLISH_RESP, Trans_id) ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_establish_cfm(). -\return message formate -*/ -rrc_rb_establish_cfm_t P_rb_est_cfm ;//= RRM_CALLOC(rrc_rb_establish_cfm_t , 1 ) ; -msg_t *msg_rrc_rb_establish_cfm( - Instance_t inst , //!< Instance ID - RB_ID Rb_id , //!< Radio Bearer ID used by RRC - RB_TYPE RB_type , //!< Radio Bearer Type - Transaction_t Trans_id //!< Transaction ID -) -{ - // msg_t mesg; - - init_rrc_msg_head(&(mesg.head),inst,RRC_RB_ESTABLISH_CFM, sizeof( rrc_rb_establish_cfm_t ) ,Trans_id); - P_rb_est_cfm.Rb_id = Rb_id ; - P_rb_est_cfm.RB_type = RB_type ; - mesg.data = (char *) &P_rb_est_cfm ; - return &mesg ; - -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_modify_resp(). -\return message formate -*/ -msg_t *msg_rrc_rb_modify_resp( - Instance_t inst , //!< Instance ID - Transaction_t Trans_id //!< Transaction ID -) -{ - return msg_rrc_generic_resp( inst,RRC_RB_MODIFY_RESP, Trans_id) ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_modify_cfm(). -\return message formate -*/ -rrc_rb_modify_cfm_t P_rb_md_cfm; -msg_t *msg_rrc_rb_modify_cfm( - Instance_t inst , //!< Instance ID - RB_ID Rb_id , //!< Radio Bearer ID used by RRC - Transaction_t Trans_id //!< Transaction ID -) -{ - // msg_t mesg; - init_rrc_msg_head(&(mesg.head),inst,RRC_RB_MODIFY_CFM, sizeof( rrc_rb_modify_cfm_t ) ,Trans_id); - P_rb_md_cfm.Rb_id = Rb_id ; - mesg.data = (char *) &P_rb_md_cfm ; - return &mesg ; - -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_release_resp(). -\return message formate -*/ -msg_t *msg_rrc_rb_release_resp( - Instance_t inst , //!< Instance ID - Transaction_t Trans_id //!< Transaction ID -) -{ - return msg_rrc_generic_resp( inst,RRC_RB_RELEASE_RESP, Trans_id) ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_MR_attach_ind(). -\return message formate -*/ -rrc_MR_attach_ind_t P_att_ind; -msg_t * msg_rrc_MR_attach_ind( - Instance_t inst , //!< Instance ID - L2_ID L2_id -) -{ - // msg_t mesg; - init_rrc_msg_head(&(mesg.head),inst,RRC_MR_ATTACH_IND, sizeof( rrc_MR_attach_ind_t ) ,0); - memcpy( P_att_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; - mesg.data = (char *) &P_att_ind ; - return &mesg ; -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_sensing_meas_resp(). -\return message formate -*/ -msg_t *msg_rrc_sensing_meas_resp( - Instance_t inst , //!< Instance ID - Transaction_t Trans_id //!< Transaction ID -) -{ - return msg_rrc_generic_resp( inst,RRC_SENSING_MEAS_RESP, Trans_id) ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_cx_establish_ind(). -\return message formate -*/ -rrc_cx_establish_ind_t P_cx_est_ind; -msg_t * msg_rrc_cx_establish_ind( - Instance_t inst , //!< Instance ID - L2_ID L2_id , //!< Layer 2 (MAC) ID - Transaction_t Trans_id , //!< Transaction ID - unsigned char *L3_info , //!< Optional L3 Information - L3_INFO_T L3_info_t , //!< Type of L3 Information - RB_ID DTCH_B_id , //!< RBID of broadcast IP service (MR only) - RB_ID DTCH_id //!< RBID of default IP service (MR only) -) -{ - //msg_t mesg; - init_rrc_msg_head(&(mesg.head),inst,RRC_CX_ESTABLISH_IND, sizeof( rrc_cx_establish_ind_t ) ,Trans_id); - memcpy( P_cx_est_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; - P_cx_est_ind.DTCH_B_id = DTCH_B_id ; - P_cx_est_ind.DTCH_id = DTCH_id ; - P_cx_est_ind.L3_info_t = L3_info_t ; - - if ( L3_info_t == IPv4_ADDR ) { - memcpy( P_cx_est_ind.L3_info, L3_info, 4 ); - } else if ( L3_info_t == IPv6_ADDR ) { - memcpy( P_cx_est_ind.L3_info, L3_info, 16 ); - } - - mesg.data = (char *) &P_cx_est_ind ; - return &mesg ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_phy_synch_to_MR_ind(). -\return message formate -*/ -rrc_phy_synch_to_MR_ind_t P_snc_mr; -msg_t * msg_rrc_phy_synch_to_MR_ind( - Instance_t inst , //!< Instance ID - L2_ID L2_id -) -{ - //msg_t smsg; - init_rrc_msg_head(&(mesg.head),inst,RRC_PHY_SYNCH_TO_MR_IND, sizeof( rrc_phy_synch_to_MR_ind_t ) ,0); - memcpy(&P_snc_mr.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID)); - mesg.data = (char *)&P_snc_mr ; - msg("[msg_rrc_phy_synch_to_MR_ind] from Inst :%d\n",mesg.head.inst); - return &mesg ; -} -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_phy_synch_to_CH_ind(). -\return message formate -*/ -rrc_phy_synch_to_CH_ind_t P_snc_ch; -msg_t * msg_rrc_phy_synch_to_CH_ind( - Instance_t inst , //!< Instance ID - unsigned int Ch_index , //!< Clusterhead index - L2_ID L2_id -) -{ - // msg_t smsg; - init_rrc_msg_head(&(mesg.head),inst, RRC_PHY_SYNCH_TO_CH_IND, sizeof( rrc_phy_synch_to_CH_ind_t ) ,0); - P_snc_ch.Ch_index = Ch_index ; - memcpy(&P_snc_ch.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID)); - mesg.data = (char *) &P_snc_ch; - msg("[msg_rrc_phy_synch_to_CH_ind] from Inst :%d\n",mesg.head.inst); - return &mesg ; -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_sensing_meas_ind(). -\return message formate -*/ -rrc_sensing_meas_ind_t P_sens_ind; -msg_t * msg_rrc_sensing_meas_ind( - Instance_t inst , //!< Instance ID - L2_ID L2_id , //!< Layer 2 ID (MAC) of sensing node - unsigned int NB_meas , //!< Layer 2 ID (MAC) of sensing node - SENSING_MEAS_T *Sensing_meas , //!< Sensing Information - Transaction_t Trans_id //!< Transaction ID -) -{ - - // msg_t mesg; - unsigned int size = sizeof( rrc_sensing_meas_ind_t ) + (NB_meas-1) * sizeof(SENSING_MEAS_T) ; - // Note : (NB_meas-1) car la première est incorporé dans rrc_sensing_meas_ind_t - init_rrc_msg_head(&(mesg.head),inst, RRC_SENSING_MEAS_IND, size ,Trans_id); - memcpy( P_sens_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; - - if ( NB_meas > 0 ) { - memcpy( P_sens_ind.Sensing_meas , Sensing_meas, NB_meas * sizeof(SENSING_MEAS_T) ) ; - } - - P_sens_ind.NB_meas = NB_meas ; - mesg.data = (char *) &P_sens_ind ; - return &mesg ; -} - -/*! -******************************************************************************* -\brief La fonction formate en un message les parametres de la fonction - rrc_rb_meas_ind(). -\return message formate -*/ -rrc_rb_meas_ind_t P_rb_meas; -msg_t * msg_rrc_rb_meas_ind( - Instance_t inst , //!< Instance ID - RB_ID Rb_id , //!< Radio Bearer ID - L2_ID L2_id , //!< Layer 2 (MAC) IDs for link - MEAS_MODE Meas_mode , //!< Measurement mode (periodic or event-driven) - MAC_RLC_MEAS_T *Mac_rlc_meas , //!< MAC/RLC measurements - Transaction_t Trans_id //!< Transaction ID -) -{ - //msg_t mesg; - init_rrc_msg_head(&(mesg.head),inst, RRC_RB_MEAS_IND, sizeof( rrc_rb_meas_ind_t ) ,Trans_id); - memcpy( P_rb_meas.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; - memcpy( &(P_rb_meas.Mac_rlc_meas), Mac_rlc_meas, sizeof(L2_ID) ) ; - P_rb_meas.Rb_id = Rb_id ; - P_rb_meas.Meas_mode = Meas_mode ; - mesg.data = (char *) &P_rb_meas; - return &mesg ; - -} - - - -/*****************************************************************************/ -rrc_init_scan_req_t P_init_scan; -msg_t * msg_rrc_init_scan_req( - Instance_t inst , //!< Instance ID - L2_ID L2_id , //!< Layer 2 (MAC) IDs for link - unsigned int Interv -) -{ - //msg_t mesg; - msg("RRCI: inst %d sendind rrc_init_scan_req from FC %d %d\n",inst,L2_id.L2_id[0],L2_id.L2_id[7]); - init_rrc_msg_head(&(mesg.head),inst, RRC_INIT_SCAN_REQ, sizeof( rrc_init_scan_req_t ) ,0); - memcpy( &P_init_scan.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) ) ; - P_init_scan.interv=Interv; - - return &mesg ; - -} - - - -/*****************************************************************************/ - -rrc_update_sens_t P_update_sens; -msg_t * msg_rrc_update_sens( - Instance_t inst , //!< Instance ID - Sens_ch_t *Sens, - L2_ID L2_id, - unsigned char NB_info -) -{ - //msg_t mesg; - init_rrc_msg_head(&(mesg.head),inst, RRC_UPDATE_SENS, sizeof( rrc_update_sens_t ) ,0); - memcpy( &P_update_sens.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) ) ; - memcpy( &P_update_sens.Sens_meas[0], (rrc_update_sens_t *)Sens, NB_info*sizeof(Sens_ch_t) ) ; - P_update_sens.NB_info=NB_info; - return &mesg ; - -} - - - -/*****************************************************************************/ - -rrc_end_scan_req_t P_end_scan; -msg_t * msg_rrc_end_scan_req( - Instance_t inst , //!< Instance ID - unsigned char CH_index -) -{ - - //msg_t mesg; - msg("RRC: send END_SCAN_REQ, INST %d\n",inst); - init_rrc_msg_head(&(mesg.head),inst, RRC_END_SCAN_REQ, sizeof( rrc_end_scan_req_t ) ,0); - P_update_sens.L2_id.L2_id[0]=CH_index; - return &mesg ; - -} - diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index b111f77871..65150d32ab 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -46,23 +46,23 @@ #ifndef CELLULAR #include "RRC/LTE/MESSAGES/asn1_msg.h" #endif -#include "RRCConnectionRequest.h" -#include "RRCConnectionReconfiguration.h" -#include "UL-CCCH-Message.h" -#include "DL-CCCH-Message.h" -#include "UL-DCCH-Message.h" -#include "DL-DCCH-Message.h" -#include "BCCH-DL-SCH-Message.h" -#include "PCCH-Message.h" -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "MCCH-Message.h" +#include "LTE_RRCConnectionRequest.h" +#include "LTE_RRCConnectionReconfiguration.h" +#include "LTE_UL-CCCH-Message.h" +#include "LTE_DL-CCCH-Message.h" +#include "LTE_UL-DCCH-Message.h" +#include "LTE_DL-DCCH-Message.h" +#include "LTE_BCCH-DL-SCH-Message.h" +#include "LTE_PCCH-Message.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#include "LTE_MCCH-Message.h" #endif -#include "MeasConfig.h" -#include "MeasGapConfig.h" -#include "MeasObjectEUTRA.h" -#include "TDD-Config.h" -#include "UECapabilityEnquiry.h" -#include "UE-CapabilityRequest.h" +#include "LTE_MeasConfig.h" +#include "LTE_MeasGapConfig.h" +#include "LTE_MeasObjectEUTRA.h" +#include "LTE_TDD-Config.h" +#include "LTE_UECapabilityEnquiry.h" +#include "LTE_UE-CapabilityRequest.h" #include "RRC/NAS/nas_config.h" #include "RRC/NAS/rb_config.h" #if ENABLE_RAL @@ -85,8 +85,8 @@ #include "openair2/LAYER2/MAC/mac_extern.h" -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -#include "SL-Preconfiguration-r12.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#include "LTE_SL-Preconfiguration-r12.h" //for D2D int ctrl_sock_fd; @@ -111,7 +111,7 @@ extern void pdcp_config_set_security( // internal prototypes -void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index ); +void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, LTE_SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index ); static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ); @@ -139,12 +139,12 @@ static uint8_t check_trigger_meas_event( uint8_t eNB_index, uint8_t ue_cnx_index, uint8_t meas_index, - Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys, - Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt); + LTE_Q_OffsetRange_t ofn, LTE_Q_OffsetRange_t ocn, LTE_Hysteresis_t hys, + LTE_Q_OffsetRange_t ofs, LTE_Q_OffsetRange_t ocs, long a3_offset, LTE_TimeToTrigger_t ttt); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) static void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area); -uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode); +uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode); #endif @@ -267,69 +267,69 @@ static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ UE_rrc_inst[ctxt_pP->module_id].sizeof_SIB1[eNB_index] = 0; UE_rrc_inst[ctxt_pP->module_id].sizeof_SI[eNB_index] = 0; UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t*)malloc16_clear( 32 ); - UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType1_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType2_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType3_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType4_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType5_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType6_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType7_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType8_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType9_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType10_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType11_t) ); -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType12_r9_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType13_r9_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType18_r12_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType19_r12_t) ); - UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType21_r14_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType1_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType2_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType3_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType4_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType5_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType6_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType7_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType8_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType9_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType10_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType11_t) ); +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType12_r9_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType13_r9_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType18_r12_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType19_r12_t) ); + UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType21_r14_t) ); #endif UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t*)malloc16_clear( 64 ); - UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (SystemInformation_t*)malloc16_clear( sizeof(SystemInformation_t) ); + UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (LTE_SystemInformation_t*)malloc16_clear( sizeof(LTE_SystemInformation_t) ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 0; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt = 0; } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { LOG_I(RRC,"Initializing Sidelink Pre-configuration for UE\n"); - UE->SL_Preconfiguration[eNB_index] = malloc16_clear( sizeof(struct SL_Preconfiguration_r12) ); + UE->SL_Preconfiguration[eNB_index] = malloc16_clear( sizeof(struct LTE_SL_Preconfiguration_r12) ); UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.rohc_Profiles_r12.profile0x0001_r12 = true; UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.carrierFreq_r12 = 3350; UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.maxTxPower_r12 = 0; UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.additionalSpectrumEmission_r12 = 0; - UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.sl_bandwidth_r12 = SL_PreconfigGeneral_r12__sl_bandwidth_r12_n50; - UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.tdd_ConfigSL_r12.subframeAssignmentSL_r12 = TDD_ConfigSL_r12__subframeAssignmentSL_r12_none; + UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.sl_bandwidth_r12 = LTE_SL_PreconfigGeneral_r12__sl_bandwidth_r12_n50; + UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.tdd_ConfigSL_r12.subframeAssignmentSL_r12 = LTE_TDD_ConfigSL_r12__subframeAssignmentSL_r12_none; - UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncCP_Len_r12 = SL_CP_Len_r12_normal; + UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncCP_Len_r12 = LTE_SL_CP_Len_r12_normal; UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncOffsetIndicator1_r12 = 0; UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncOffsetIndicator2_r12 = 0; UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncTxParameters_r12 = 0; UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncTxThreshOoC_r12 = 0; - UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.filterCoefficient_r12 = FilterCoefficient_fc0; - UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncRefMinHyst_r12 = SL_PreconfigSync_r12__syncRefMinHyst_r12_dB0; - UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncRefDiffHyst_r12 = SL_PreconfigSync_r12__syncRefDiffHyst_r12_dB0; - UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.ext1 = malloc16_clear(sizeof(struct SL_PreconfigSync_r12__ext1)); + UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.filterCoefficient_r12 = LTE_FilterCoefficient_fc0; + UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncRefMinHyst_r12 = LTE_SL_PreconfigSync_r12__syncRefMinHyst_r12_dB0; + UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncRefDiffHyst_r12 = LTE_SL_PreconfigSync_r12__syncRefDiffHyst_r12_dB0; + UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.ext1 = malloc16_clear(sizeof(struct LTE_SL_PreconfigSync_r12__ext1)); UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.ext1->syncTxPeriodic_r13 = NULL; - struct SL_PreconfigCommPool_r12 *preconfigpool = malloc16_clear(sizeof(struct SL_PreconfigCommPool_r12)); - preconfigpool->sc_CP_Len_r12 = SL_CP_Len_r12_normal; - preconfigpool->sc_Period_r12 = SL_PeriodComm_r12_sf40; + struct LTE_SL_PreconfigCommPool_r12 *preconfigpool = malloc16_clear(sizeof(struct LTE_SL_PreconfigCommPool_r12)); + preconfigpool->sc_CP_Len_r12 = LTE_SL_CP_Len_r12_normal; + preconfigpool->sc_Period_r12 = LTE_SL_PeriodComm_r12_sf40; // 20 PRBs for SL communications preconfigpool->sc_TF_ResourceConfig_r12.prb_Num_r12 = 20; preconfigpool->sc_TF_ResourceConfig_r12.prb_Start_r12 = 5; preconfigpool->sc_TF_ResourceConfig_r12.prb_End_r12 = 44; // Offset set to 0 subframes - preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = SL_OffsetIndicator_r12_PR_small_r12; + preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12; preconfigpool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; // 40 ms SL Period - preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = SubframeBitmapSL_r12_PR_bs40_r12; + preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; @@ -341,16 +341,16 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[4] = 0; preconfigpool->sc_TxParameters_r12 = 0; - preconfigpool->data_CP_Len_r12 = SL_CP_Len_r12_normal; + preconfigpool->data_CP_Len_r12 = LTE_SL_CP_Len_r12_normal; // 20 PRBs for SL communications preconfigpool->data_TF_ResourceConfig_r12.prb_Num_r12 = 20; preconfigpool->data_TF_ResourceConfig_r12.prb_Start_r12 = 5; preconfigpool->data_TF_ResourceConfig_r12.prb_End_r12 = 44; // Offset set to 0 subframes - preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = SL_OffsetIndicator_r12_PR_small_r12; + preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12; preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; // 40 ms SL Period - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = SubframeBitmapSL_r12_PR_bs40_r12; + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; @@ -362,7 +362,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[5] = 0xFF; preconfigpool->dataHoppingConfig_r12.hoppingParameter_r12 = 0; - preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = SL_HoppingConfigComm_r12__numSubbands_r12_ns1; + preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; preconfigpool->dataHoppingConfig_r12.rb_Offset_r12 = 0; preconfigpool->dataTxParameters_r12 = 0; @@ -450,8 +450,8 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) UE->DRB_configList, (DRB_ToReleaseList_t*) NULL, 0xff, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); @@ -459,8 +459,8 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) (SRB_ToAddModList_t*)NULL, UE->DRB_configList, (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL #endif ); */ @@ -510,11 +510,11 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_ UE_rrc_inst[ctxt.module_id].Srb1[eNB_index].Active=0; UE_rrc_inst[ctxt.module_id].Srb2[eNB_index].Active=0; UE_rrc_inst[ctxt.module_id].HandoverInfoUe.measFlag=1; - UE_rrc_inst[ctxt.module_id].ciphering_algorithm = CipheringAlgorithm_r12_eea0; -#if (RRC_VERSION >= MAKE_VERSION(9, 2, 0)) - UE_rrc_inst[ctxt.module_id].integrity_algorithm = SecurityAlgorithmConfig__integrityProtAlgorithm_eia0_v920; + UE_rrc_inst[ctxt.module_id].ciphering_algorithm = LTE_CipheringAlgorithm_r12_eea0; +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 2, 0)) + UE_rrc_inst[ctxt.module_id].integrity_algorithm = LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia0_v920; #else - UE_rrc_inst[ctxt.module_id].integrity_algorithm = SecurityAlgorithmConfig__integrityProtAlgorithm_reserved; + UE_rrc_inst[ctxt.module_id].integrity_algorithm = LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_reserved; #endif openair_rrc_ue_init_security(&ctxt); @@ -715,7 +715,7 @@ void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t // Called by L2 interface (MAC) int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* const Srb_info, const uint8_t eNB_index ) { - DL_CCCH_Message_t* dl_ccch_msg=NULL; + LTE_DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; int rval=0; @@ -724,13 +724,13 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co // UE_rrc_inst[ue_mod_idP].Info[eNB_index].State); dec_rval = uper_decode(NULL, - &asn_DEF_DL_CCCH_Message, + &asn_DEF_LTE_DL_CCCH_Message, (void**)&dl_ccch_msg, (uint8_t*)Srb_info->Rx_buffer.Payload, 100,0,0); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_DL_CCCH_Message,(void*)dl_ccch_msg); + xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message,(void*)dl_ccch_msg); } #if defined(ENABLE_ITTI) @@ -748,7 +748,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co char message_string[10000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); @@ -767,20 +767,20 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co return -1; } - if (dl_ccch_msg->message.present == DL_CCCH_MessageType_PR_c1) { + if (dl_ccch_msg->message.present == LTE_DL_CCCH_MessageType_PR_c1) { if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_SI_RECEIVED) { switch (dl_ccch_msg->message.choice.c1.present) { - case DL_CCCH_MessageType__c1_PR_NOTHING: + case LTE_DL_CCCH_MessageType__c1_PR_NOTHING: LOG_I(RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", ctxt_pP->module_id, ctxt_pP->frame); rval = 0; break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: + case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: LOG_I(RRC, "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n", ctxt_pP->module_id, @@ -788,7 +788,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co rval = 0; break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: + case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: LOG_I(RRC, "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n", ctxt_pP->module_id, @@ -796,7 +796,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co rval = 0; break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: + case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReject: LOG_I(RRC, "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", ctxt_pP->module_id, @@ -804,7 +804,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co rval = 0; break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: + case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: LOG_I(RRC, "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", ctxt_pP->module_id, @@ -850,7 +850,7 @@ rrc_ue_establish_srb1( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct SRB_ToAddMod* SRB_config + struct LTE_SRB_ToAddMod* SRB_config ) //----------------------------------------------------------------------------- { @@ -883,7 +883,7 @@ rrc_ue_establish_srb2( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct SRB_ToAddMod* SRB_config + struct LTE_SRB_ToAddMod* SRB_config ) //----------------------------------------------------------------------------- { @@ -916,7 +916,7 @@ rrc_ue_establish_drb( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct DRB_ToAddMod* DRB_config + struct LTE_DRB_ToAddMod* DRB_config ) //----------------------------------------------------------------------------- { @@ -977,7 +977,7 @@ void rrc_ue_process_measConfig( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, - MeasConfig_t* const measConfig + LTE_MeasConfig_t* const measConfig ) //----------------------------------------------------------------------------- { @@ -985,7 +985,7 @@ rrc_ue_process_measConfig( // This is the procedure described in 36.331 Section 5.5.2.1 int i; long ind; - MeasObjectToAddMod_t *measObj; + LTE_MeasObjectToAddMod_t *measObj; if (measConfig->measObjectToRemoveList != NULL) { for (i=0; imeasObjectToRemoveList->list.count; i++) { @@ -1005,11 +1005,11 @@ rrc_ue_process_measConfig( LOG_D(RRC,"Modifying measurement object %ld\n",ind); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1], (char*)measObj, - sizeof(MeasObjectToAddMod_t)); + sizeof(LTE_MeasObjectToAddMod_t)); } else { LOG_I(RRC,"Adding measurement object %ld\n",ind); - if (measObj->measObject.present == MeasObjectToAddMod__measObject_PR_measObjectEUTRA) { + if (measObj->measObject.present == LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA) { LOG_I(RRC,"EUTRA Measurement : carrierFreq %ld, allowedMeasBandwidth %ld,presenceAntennaPort1 %d, neighCellConfig %d\n", measObj->measObject.choice.measObjectEUTRA.carrierFreq, measObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth, @@ -1023,29 +1023,29 @@ rrc_ue_process_measConfig( LOG_I(RRC,"call rrc_mac_config_req \n"); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index], - (MAC_MainConfig_t *)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -1053,7 +1053,7 @@ rrc_ue_process_measConfig( 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -1079,7 +1079,7 @@ rrc_ue_process_measConfig( LOG_I(RRC,"Modifying Report Configuration %ld\n",ind-1); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1], (char*)measConfig->reportConfigToAddModList->list.array[i], - sizeof(ReportConfigToAddMod_t)); + sizeof(LTE_ReportConfigToAddMod_t)); } else { LOG_D(RRC,"Adding Report Configuration %ld %p \n",ind-1,measConfig->reportConfigToAddModList->list.array[i]); UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i]; @@ -1092,7 +1092,7 @@ rrc_ue_process_measConfig( LOG_D(RRC,"Modifying Quantity Configuration \n"); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], (char*)measConfig->quantityConfig, - sizeof(QuantityConfig_t)); + sizeof(LTE_QuantityConfig_t)); } else { LOG_D(RRC,"Adding Quantity configuration\n"); UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index] = measConfig->quantityConfig; @@ -1114,7 +1114,7 @@ rrc_ue_process_measConfig( LOG_D(RRC,"Modifying Measurement ID %ld\n",ind-1); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1], (char*)measConfig->measIdToAddModList->list.array[i], - sizeof(MeasIdToAddMod_t)); + sizeof(LTE_MeasIdToAddMod_t)); } else { LOG_D(RRC,"Adding Measurement ID %ld %p\n",ind-1,measConfig->measIdToAddModList->list.array[i]); UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i]; @@ -1126,7 +1126,7 @@ rrc_ue_process_measConfig( if (UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index]) { memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], (char*)measConfig->measGapConfig, - sizeof(MeasGapConfig_t)); + sizeof(LTE_MeasGapConfig_t)); } else { UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index] = measConfig->measGapConfig; } @@ -1137,7 +1137,7 @@ rrc_ue_process_measConfig( LOG_I(RRC,"Modifying Quantity Configuration \n"); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], (char*)measConfig->quantityConfig, - sizeof(QuantityConfig_t)); + sizeof(LTE_QuantityConfig_t)); } else { LOG_I(RRC,"Adding Quantity configuration\n"); UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index] = measConfig->quantityConfig; @@ -1162,7 +1162,7 @@ rrc_ue_process_measConfig( if (measConfig->speedStatePars != NULL) { if (UE_rrc_inst[ctxt_pP->module_id].speedStatePars) { - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char*)measConfig->speedStatePars,sizeof(struct MeasConfig__speedStatePars)); + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char*)measConfig->speedStatePars,sizeof(struct LTE_MeasConfig__speedStatePars)); } else { UE_rrc_inst[ctxt_pP->module_id].speedStatePars = measConfig->speedStatePars; } @@ -1174,11 +1174,11 @@ rrc_ue_process_measConfig( void -rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radioResourceConfigDedicated, +rrc_ue_update_radioResourceConfigDedicated(LTE_RadioResourceConfigDedicated_t* radioResourceConfigDedicated, const protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index) { - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; + LTE_PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); @@ -1201,7 +1201,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update pdsch_ConfigDedicated config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(PDSCH_ConfigDedicated_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(LTE_PDSCH_ConfigDedicated_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated, (char*)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated, @@ -1218,7 +1218,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update pusch_ConfigDedicated config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(PUSCH_ConfigDedicated_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUSCH_ConfigDedicated_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated, (char*)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated, @@ -1234,7 +1234,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio { LOG_I(RRC,"Update pucch_ConfigDedicated config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(PUCCH_ConfigDedicated_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUCCH_ConfigDedicated_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated, (char*)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated, @@ -1248,20 +1248,20 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio // Update cqi_ReportConfig if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) { - LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(CQI_ReportConfig_t)); + LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(LTE_CQI_ReportConfig_t)); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(CQI_ReportConfig_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(LTE_CQI_ReportConfig_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig, (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig, sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); if (radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) { - LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(CQI_ReportPeriodic_t)); + LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(LTE_CQI_ReportPeriodic_t)); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(CQI_ReportPeriodic_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(LTE_CQI_ReportPeriodic_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic, (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic, @@ -1279,7 +1279,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update schedulingRequestConfig config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(SchedulingRequestConfig_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(LTE_SchedulingRequestConfig_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig, (char*)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig, @@ -1296,7 +1296,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(SoundingRS_UL_ConfigDedicated_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(LTE_SoundingRS_UL_ConfigDedicated_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated, (char*)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated, @@ -1313,7 +1313,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update antennaInfo config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct PhysicalConfigDedicated__antennaInfo)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct LTE_PhysicalConfigDedicated__antennaInfo)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo, (char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo, @@ -1342,7 +1342,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update uplinkPowerControlDedicated config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(UplinkPowerControlDedicated_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(LTE_UplinkPowerControlDedicated_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated, (char*)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated, @@ -1359,7 +1359,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH, (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH, @@ -1376,7 +1376,7 @@ rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radio LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n"); if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t)); memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH, (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH, @@ -1394,14 +1394,14 @@ void rrc_ue_process_radioResourceConfigDedicated( const protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index, - RadioResourceConfigDedicated_t* radioResourceConfigDedicated + LTE_RadioResourceConfigDedicated_t* radioResourceConfigDedicated ) //----------------------------------------------------------------------------- { long SRB_id,DRB_id; int i,cnt; - LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; + LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; #ifdef CBA uint8_t cba_found = 0; uint16_t cba_RNTI; @@ -1426,10 +1426,10 @@ rrc_ue_process_radioResourceConfigDedicated( // Apply macMainConfig if present if (radioResourceConfigDedicated->mac_MainConfig) { - if (radioResourceConfigDedicated->mac_MainConfig->present == RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue) { + if (radioResourceConfigDedicated->mac_MainConfig->present == LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue) { if (UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index]) { memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],(char*)&radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue, - sizeof(MAC_MainConfig_t)); + sizeof(LTE_MAC_MainConfig_t)); } else { UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index] = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; } @@ -1440,7 +1440,7 @@ rrc_ue_process_radioResourceConfigDedicated( if (radioResourceConfigDedicated->sps_Config) { if (UE_rrc_inst[ctxt_pP->module_id].sps_Config[eNB_index]) { memcpy(UE_rrc_inst[ctxt_pP->module_id].sps_Config[eNB_index],radioResourceConfigDedicated->sps_Config, - sizeof(struct SPS_Config)); + sizeof(struct LTE_SPS_Config)); } else { UE_rrc_inst[ctxt_pP->module_id].sps_Config[eNB_index] = radioResourceConfigDedicated->sps_Config; } @@ -1486,25 +1486,25 @@ rrc_ue_process_radioResourceConfigDedicated( // Refresh SRBs rrc_pdcp_config_asn1_req(ctxt_pP, radioResourceConfigDedicated->srb_ToAddModList, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, + (LTE_DRB_ToAddModList_t*)NULL, + (LTE_DRB_ToReleaseList_t*)NULL, UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), kRRCenc, kRRCint, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL #endif ,NULL); // Refresh SRBs rrc_rlc_config_asn1_req(ctxt_pP, radioResourceConfigDedicated->srb_ToAddModList, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToAddModList_t*)NULL, + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , 0, 0 #endif ); @@ -1522,13 +1522,13 @@ rrc_ue_process_radioResourceConfigDedicated( if (SRB_id == 1) { if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]) { memcpy(UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index],radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt], - sizeof(struct SRB_ToAddMod)); + sizeof(struct LTE_SRB_ToAddMod)); } else { UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index] = radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt]; rrc_ue_establish_srb1(ctxt_pP->module_id,ctxt_pP->frame,eNB_index,radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt]); if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig) { - if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->present == LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->choice.explicitValue; } else { @@ -1542,17 +1542,17 @@ rrc_ue_process_radioResourceConfigDedicated( ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], 1, SRB1_logicalChannelConfig, - (MeasGapConfig_t *)NULL, + (LTE_MeasGapConfig_t *)NULL, NULL, NULL, NULL, @@ -1561,18 +1561,18 @@ rrc_ue_process_radioResourceConfigDedicated( NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA , 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -1583,13 +1583,13 @@ rrc_ue_process_radioResourceConfigDedicated( } else { if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]) { memcpy(UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index],radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt], - sizeof(struct SRB_ToAddMod)); + sizeof(struct LTE_SRB_ToAddMod)); } else { UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index] = radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt]; rrc_ue_establish_srb2(ctxt_pP->module_id,ctxt_pP->frame,eNB_index,radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt]); if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]->logicalChannelConfig) { - if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]->logicalChannelConfig->present == LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { LOG_I(RRC,"Applying Explicit SRB2 logicalChannelConfig\n"); SRB2_logicalChannelConfig = &UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]->logicalChannelConfig->choice.explicitValue; } else { @@ -1606,30 +1606,30 @@ rrc_ue_process_radioResourceConfigDedicated( eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], 2, SRB2_logicalChannelConfig, UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -1637,7 +1637,7 @@ rrc_ue_process_radioResourceConfigDedicated( 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -1680,26 +1680,26 @@ rrc_ue_process_radioResourceConfigDedicated( // Refresh DRBs rrc_pdcp_config_asn1_req(ctxt_pP, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, radioResourceConfigDedicated->drb_ToAddModList, - (DRB_ToReleaseList_t*)NULL, + (LTE_DRB_ToReleaseList_t*)NULL, UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), NULL, NULL, kUPenc -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL #endif , UE_rrc_inst[ctxt_pP->module_id].defaultDRB); // Refresh DRBs rrc_rlc_config_asn1_req(ctxt_pP, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, radioResourceConfigDedicated->drb_ToAddModList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , 0, 0 #endif ); @@ -1710,7 +1710,7 @@ rrc_ue_process_radioResourceConfigDedicated( if (UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]) { memcpy(UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id], radioResourceConfigDedicated->drb_ToAddModList->list.array[i], - sizeof(struct DRB_ToAddMod)); + sizeof(struct LTE_DRB_ToAddMod)); } else { UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id] = radioResourceConfigDedicated->drb_ToAddModList->list.array[i]; rrc_ue_establish_drb(ctxt_pP->module_id,ctxt_pP->frame,eNB_index,radioResourceConfigDedicated->drb_ToAddModList->list.array[i]); @@ -1721,37 +1721,37 @@ rrc_ue_process_radioResourceConfigDedicated( eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], *UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity, UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig, UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], - (TDD_Config_t*)NULL, - (MobilityControlInfo_t *)NULL, + (LTE_TDD_Config_t*)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA , UE_rrc_inst[ue_mod_idP].num_active_cba_groups, // UE_rrc_inst[ue_mod_idP].cba_rnti[0] #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -1772,7 +1772,7 @@ rrc_ue_process_radioResourceConfigDedicated( void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, - SecurityModeCommand_t* const securityModeCommand, + LTE_SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index ) //----------------------------------------------------------------------------- @@ -1780,7 +1780,7 @@ rrc_ue_process_securityModeCommand( asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; + LTE_UL_DCCH_Message_t ul_dcch_msg; // SecurityModeCommand_t SecurityModeCommand; uint8_t buffer[200]; int i, securityMode; @@ -1789,36 +1789,36 @@ rrc_ue_process_securityModeCommand( ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, eNB_index); switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) { - case CipheringAlgorithm_r12_eea0: + case LTE_CipheringAlgorithm_r12_eea0: LOG_I(RRC,"[UE %d] Security algorithm is set to eea0\n", ctxt_pP->module_id); - securityMode= CipheringAlgorithm_r12_eea0; + securityMode= LTE_CipheringAlgorithm_r12_eea0; break; - case CipheringAlgorithm_r12_eea1: + case LTE_CipheringAlgorithm_r12_eea1: LOG_I(RRC,"[UE %d] Security algorithm is set to eea1\n",ctxt_pP->module_id); - securityMode= CipheringAlgorithm_r12_eea1; + securityMode= LTE_CipheringAlgorithm_r12_eea1; break; - case CipheringAlgorithm_r12_eea2: + case LTE_CipheringAlgorithm_r12_eea2: LOG_I(RRC,"[UE %d] Security algorithm is set to eea2\n", ctxt_pP->module_id); - securityMode = CipheringAlgorithm_r12_eea2; + securityMode = LTE_CipheringAlgorithm_r12_eea2; break; default: LOG_I(RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id); - securityMode = CipheringAlgorithm_r12_spare1; + securityMode = LTE_CipheringAlgorithm_r12_spare1; break; } switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) { - case SecurityAlgorithmConfig__integrityProtAlgorithm_eia1: + case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia1: LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia1\n",ctxt_pP->module_id); securityMode |= 1 << 5; break; - case SecurityAlgorithmConfig__integrityProtAlgorithm_eia2: + case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia2: LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia2\n",ctxt_pP->module_id); securityMode |= 1 << 6; break; @@ -1837,17 +1837,17 @@ rrc_ue_process_securityModeCommand( UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm = securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm; - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; if (securityMode >= NO_SECURITY_MODE) { LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n"); - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_securityModeComplete; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete; } else { LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n"); - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_securityModeFailure; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure; } @@ -1906,20 +1906,20 @@ rrc_ue_process_securityModeCommand( #endif //#if defined(ENABLE_SECURITY) - if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) { - if (securityModeCommand->criticalExtensions.choice.c1.present != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) + if (securityModeCommand->criticalExtensions.present == LTE_SecurityModeCommand__criticalExtensions_PR_c1) { + if (securityModeCommand->criticalExtensions.choice.c1.present != LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) LOG_W(RRC,"securityModeCommand->criticalExtensions.choice.c1.present (%d) != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8\n", securityModeCommand->criticalExtensions.choice.c1.present); ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; - ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1; ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL; LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d), rrc_TransactionIdentifier: %ld\n", ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, eNB_index, securityModeCommand->rrc_TransactionIdentifier); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, (void*)&ul_dcch_msg, buffer, @@ -1928,7 +1928,7 @@ rrc_ue_process_securityModeCommand( enc_rval.failed_type->name, enc_rval.encoded); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void*)&ul_dcch_msg); } #if defined(ENABLE_ITTI) @@ -1937,7 +1937,7 @@ rrc_ue_process_securityModeCommand( char message_string[20000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); @@ -1975,7 +1975,7 @@ rrc_ue_process_securityModeCommand( void rrc_ue_process_ueCapabilityEnquiry( const protocol_ctxt_t* const ctxt_pP, - UECapabilityEnquiry_t* UECapabilityEnquiry, + LTE_UECapabilityEnquiry_t* UECapabilityEnquiry, uint8_t eNB_index ) //----------------------------------------------------------------------------- @@ -1983,10 +1983,10 @@ rrc_ue_process_ueCapabilityEnquiry( asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; + LTE_UL_DCCH_Message_t ul_dcch_msg; - UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container; + LTE_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container; uint8_t buffer[200]; int i; @@ -1997,14 +1997,14 @@ rrc_ue_process_ueCapabilityEnquiry( eNB_index); - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - memset((void *)&ue_CapabilityRAT_Container,0,sizeof(UE_CapabilityRAT_Container_t)); + memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); + memset((void *)&ue_CapabilityRAT_Container,0,sizeof(LTE_UE_CapabilityRAT_Container_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ueCapabilityInformation; + ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation; ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.rrc_TransactionIdentifier = UECapabilityEnquiry->rrc_TransactionIdentifier; - ue_CapabilityRAT_Container.rat_Type = RAT_Type_eutra; + ue_CapabilityRAT_Container.rat_Type = LTE_RAT_Type_eutra; OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ueCapabilityRAT_Container, (const char*)UE_rrc_inst[ctxt_pP->module_id].UECapability, UE_rrc_inst[ctxt_pP->module_id].UECapability_size); @@ -2012,34 +2012,34 @@ rrc_ue_process_ueCapabilityEnquiry( // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size; - AssertFatal(UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1, + AssertFatal(UECapabilityEnquiry->criticalExtensions.present == LTE_UECapabilityEnquiry__criticalExtensions_PR_c1, "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n", - UECapabilityEnquiry->criticalExtensions.present,UECapabilityEnquiry__criticalExtensions_PR_c1); + UECapabilityEnquiry->criticalExtensions.present,LTE_UECapabilityEnquiry__criticalExtensions_PR_c1); - if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) + if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != LTE_UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) LOG_I(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n", UECapabilityEnquiry->criticalExtensions.choice.c1.present); - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = UECapabilityInformation__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = LTE_UECapabilityInformation__criticalExtensions_PR_c1; ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present = - UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; + LTE_UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count =0; for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) { if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] - == RAT_Type_eutra) { + == LTE_RAT_Type_eutra) { ASN_SEQUENCE_ADD( &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, &ue_CapabilityRAT_Container); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, buffer, 100); + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void*)&ul_dcch_msg); } #if defined(ENABLE_ITTI) @@ -2048,7 +2048,7 @@ rrc_ue_process_ueCapabilityEnquiry( char message_string[20000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); @@ -2086,7 +2086,7 @@ rrc_ue_process_ueCapabilityEnquiry( void rrc_ue_process_rrcConnectionReconfiguration( const protocol_ctxt_t* const ctxt_pP, - RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, uint8_t eNB_index ) //----------------------------------------------------------------------------- @@ -2095,10 +2095,10 @@ rrc_ue_process_rrcConnectionReconfiguration( LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) { + if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) { if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == - RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { - RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = + LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + LTE_RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { @@ -2134,14 +2134,14 @@ rrc_ue_process_rrcConnectionReconfiguration( != NULL) && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12 != NULL)) { - if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12->commTxResources_r12->present != SL_CommConfig_r12__commTxResources_r12_PR_NOTHING){ + if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12->commTxResources_r12->present != LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING){ LOG_I(RRC,"sl-CommConfig is present\n"); //process sl-CommConfig rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index, - (SystemInformationBlockType18_r12_t *)NULL, - (SystemInformationBlockType19_r12_t *)NULL, + (LTE_SystemInformationBlockType18_r12_t *)NULL, + (LTE_SystemInformationBlockType19_r12_t *)NULL, rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12, - (SL_DiscConfig_r12_t *)NULL + (LTE_SL_DiscConfig_r12_t *)NULL ); } } @@ -2240,7 +2240,7 @@ void rrc_ue_process_mobilityControlInfo( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, - struct MobilityControlInfo* const mobilityControlInfo + struct LTE_MobilityControlInfo* const mobilityControlInfo ) //----------------------------------------------------------------------------- { @@ -2282,7 +2282,7 @@ rrc_ue_process_mobilityControlInfo( NULL, // key rrc encryption NULL, // key rrc integrity NULL // key encryption -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,NULL #endif ,NULL); @@ -2291,7 +2291,7 @@ rrc_ue_process_mobilityControlInfo( NULL,// SRB_ToAddModList NULL,// DRB_ToAddModList drb2release_list // DRB_ToReleaseList -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,NULL #endif ,NULL); @@ -2324,18 +2324,18 @@ rrc_ue_process_mobilityControlInfo( rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, mobilityControlInfo, (uint8_t *)NULL, (uint16_t *)NULL, @@ -2343,16 +2343,16 @@ rrc_ue_process_mobilityControlInfo( NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA ,0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -2396,7 +2396,7 @@ rrc_ue_decode_dcch( { //DL_DCCH_Message_t dldcchmsg; - DL_DCCH_Message_t *dl_dcch_msg=NULL;//&dldcchmsg; + LTE_DL_DCCH_Message_t *dl_dcch_msg=NULL;//&dldcchmsg; // asn_dec_rval_t dec_rval; // int i; uint8_t target_eNB_index=0xFF; @@ -2420,13 +2420,13 @@ rrc_ue_decode_dcch( LOG_T(RRC, "\n"); */ uper_decode(NULL, - &asn_DEF_DL_DCCH_Message, + &asn_DEF_LTE_DL_DCCH_Message, (void**)&dl_dcch_msg, (uint8_t*)Buffer, RRC_BUF_SIZE,0,0); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)dl_dcch_msg); + xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void*)dl_dcch_msg); } #if defined(ENABLE_ITTI) @@ -2442,7 +2442,7 @@ rrc_ue_decode_dcch( char message_string[30000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)dl_dcch_msg)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message, (void *)dl_dcch_msg)) > 0) { msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); @@ -2453,31 +2453,31 @@ rrc_ue_decode_dcch( # endif #endif - if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) { + if (dl_dcch_msg->message.present == LTE_DL_DCCH_MessageType_PR_c1) { if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State >= RRC_CONNECTED) { switch (dl_dcch_msg->message.choice.c1.present) { - case DL_DCCH_MessageType__c1_PR_NOTHING: + case LTE_DL_DCCH_MessageType__c1_PR_NOTHING: LOG_I(RRC, "[UE %d] Frame %d : Received PR_NOTHING on DL-DCCH-Message\n", ctxt_pP->module_id, ctxt_pP->frame); return; - case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: break; - case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: { + case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: { #if defined(ENABLE_ITTI) - DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer; + LTE_DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer; - if ((dlInformationTransfer->criticalExtensions.present == DLInformationTransfer__criticalExtensions_PR_c1) + if ((dlInformationTransfer->criticalExtensions.present == LTE_DLInformationTransfer__criticalExtensions_PR_c1) && (dlInformationTransfer->criticalExtensions.choice.c1.present - == DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8) + == LTE_DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8) && (dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present - == DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { + == LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { /* This message hold a dedicated info NAS payload, forward it to NAS */ - struct DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = + struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = &dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType; uint32_t pdu_length; uint8_t *pdu_buffer; @@ -2498,13 +2498,13 @@ rrc_ue_decode_dcch( break; } - case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: + case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: break; - case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: + case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: break; - case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: + case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: // first check if mobilityControlInfo is present if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo @@ -2661,8 +2661,8 @@ rrc_ue_decode_dcch( if (send_ue_information == 0) { LOG_I(RRC, "TEST SidelinkUEInformation [UE %d] Received (eNB %d)\n", ctxt_pP->module_id, eNB_indexP); - SL_DestinationInfoList_r12_t *destinationInfoList = CALLOC(1, sizeof(SL_DestinationInfoList_r12_t)); - SL_DestinationIdentity_r12_t *sl_destination_identity = CALLOC(1, sizeof(SL_DestinationIdentity_r12_t)); + LTE_SL_DestinationInfoList_r12_t *destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t)); + LTE_SL_DestinationIdentity_r12_t *sl_destination_identity = CALLOC(1, sizeof(LTE_SL_DestinationIdentity_r12_t)); sl_destination_identity->size = 3; sl_destination_identity->buf = CALLOC(1,3); sl_destination_identity->buf[0] = 0x00; @@ -2675,14 +2675,14 @@ rrc_ue_decode_dcch( } break; - case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: + case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: #if defined(ENABLE_ITTI) msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present - == RRCConnectionRelease__criticalExtensions_PR_c1) + == LTE_RRCConnectionRelease__criticalExtensions_PR_c1) && (dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.present - == RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) { + == LTE_RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) { NAS_CONN_RELEASE_IND(msg_p).cause = dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause; } @@ -2696,7 +2696,7 @@ rrc_ue_decode_dcch( #endif break; - case DL_DCCH_MessageType__c1_PR_securityModeCommand: + case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand: LOG_I(RRC, "[UE %d] Received securityModeCommand (eNB %d)\n", ctxt_pP->module_id, eNB_indexP); rrc_ue_process_securityModeCommand( @@ -2705,7 +2705,7 @@ rrc_ue_decode_dcch( eNB_indexP); break; - case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n", ctxt_pP->module_id, eNB_indexP); @@ -2715,26 +2715,26 @@ rrc_ue_decode_dcch( eNB_indexP); break; - case DL_DCCH_MessageType__c1_PR_counterCheck: + case LTE_DL_DCCH_MessageType__c1_PR_counterCheck: break; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - case DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: break; #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + case LTE_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: break; - case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: + case LTE_DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: break; #endif - case DL_DCCH_MessageType__c1_PR_spare1: - case DL_DCCH_MessageType__c1_PR_spare2: - case DL_DCCH_MessageType__c1_PR_spare3: -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) - case DL_DCCH_MessageType__c1_PR_spare4: + case LTE_DL_DCCH_MessageType__c1_PR_spare1: + case LTE_DL_DCCH_MessageType__c1_PR_spare2: + case LTE_DL_DCCH_MessageType__c1_PR_spare3: +#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0)) + case LTE_DL_DCCH_MessageType__c1_PR_spare4: #endif break; @@ -2789,13 +2789,13 @@ const char* SIBallowed( long value ) const char* SIB2SoundingPresent( int value ) { switch (value) { - case SoundingRS_UL_ConfigCommon_PR_NOTHING: + case LTE_SoundingRS_UL_ConfigCommon_PR_NOTHING: return "NOTHING"; - case SoundingRS_UL_ConfigCommon_PR_release: + case LTE_SoundingRS_UL_ConfigCommon_PR_release: return "release"; - case SoundingRS_UL_ConfigCommon_PR_setup: + case LTE_SoundingRS_UL_ConfigCommon_PR_setup: return "setup"; } @@ -2927,8 +2927,8 @@ int decode_BCCH_DLSCH_Message( const uint8_t rsrq, const uint8_t rsrp ) { - BCCH_DL_SCH_Message_t *bcch_message = NULL; - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + LTE_BCCH_DL_SCH_Message_t *bcch_message = NULL; + LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; int i; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN ); @@ -2944,7 +2944,7 @@ int decode_BCCH_DLSCH_Message( rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB ); asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_BCCH_DL_SCH_Message, + &asn_DEF_LTE_BCCH_DL_SCH_Message, (void **)&bcch_message, (const void *)Sdu, Sdu_len ); @@ -2957,7 +2957,7 @@ int decode_BCCH_DLSCH_Message( printf("%02x ",Sdu[i]); printf("\n"); // free the memory - SEQUENCE_free( &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message, 1 ); + SEQUENCE_free( &asn_DEF_LTE_BCCH_DL_SCH_Message, (void*)bcch_message, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); return -1; } @@ -2977,7 +2977,7 @@ int decode_BCCH_DLSCH_Message( char message_string[15000]; size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); @@ -2990,16 +2990,16 @@ int decode_BCCH_DLSCH_Message( # endif #endif - if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { + if (bcch_message->message.present == LTE_BCCH_DL_SCH_MessageType_PR_c1) { switch (bcch_message->message.choice.c1.present) { - case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: if ((ctxt_pP->frame % 2) == 0) { // even frame if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 0) { - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; memcpy( (void*)sib1, (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, - sizeof(SystemInformationBlockType1_t) ); + sizeof(LTE_SystemInformationBlockType1_t) ); LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); @@ -3008,14 +3008,14 @@ int decode_BCCH_DLSCH_Message( break; - case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) { // SIB1 with schedulingInfoList is available - SystemInformation_t* si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; + LTE_SystemInformation_t* si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; memcpy( si, &bcch_message->message.choice.c1.choice.systemInformation, - sizeof(SystemInformation_t) ); + sizeof(LTE_SystemInformation_t) ); LOG_I( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", ctxt_pP->module_id, @@ -3027,7 +3027,7 @@ int decode_BCCH_DLSCH_Message( break; - case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + case LTE_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: default: break; } @@ -3054,13 +3054,13 @@ int decode_PCCH_DLSCH_Message( uint8_t* const Sdu, const uint8_t Sdu_len) { - PCCH_Message_t *pcch_message = NULL; + LTE_PCCH_Message_t *pcch_message = NULL; int i; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN ); asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_PCCH_Message, + &asn_DEF_LTE_PCCH_Message, (void **)&pcch_message, (const void *)Sdu, Sdu_len ); @@ -3073,7 +3073,7 @@ int decode_PCCH_DLSCH_Message( printf("%02x ",Sdu[i]); printf("\n"); // free the memory - SEQUENCE_free( &asn_DEF_PCCH_Message, (void*)pcch_message, 1 ); + SEQUENCE_free( &asn_DEF_LTE_PCCH_Message, (void*)pcch_message, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT ); return -1; } @@ -3084,13 +3084,13 @@ int decode_PCCH_DLSCH_Message( //----------------------------------------------------------------------------- int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ) { - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_IN ); LOG_I( RRC, "[UE %d] : Dumping SIB 1\n", ctxt_pP->module_id ); - PLMN_Identity_t *PLMN_identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity; + LTE_PLMN_Identity_t *PLMN_identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity; int mccdigits = PLMN_identity->mcc->list.count; int mncdigits = PLMN_identity->mnc.list.count; @@ -3196,29 +3196,29 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config, - (MobilityControlInfo_t *) NULL, + (LTE_MobilityControlInfo_t *) NULL, &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize, &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod, NULL, NULL, NULL, - (MBSFN_SubframeConfigList_t *)NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + (LTE_MBSFN_SubframeConfigList_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -3226,7 +3226,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -3242,7 +3242,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, { int cell_valid = 0; - if (sib1->cellAccessRelatedInfo.cellBarred == SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred) { + if (sib1->cellAccessRelatedInfo.cellBarred == LTE_SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred) { /* Cell is not barred */ int plmn; int plmn_number; @@ -3251,7 +3251,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, /* Compare requested PLMN and PLMNs from SIB1*/ for (plmn = 0; plmn < plmn_number; plmn++) { - PLMN_Identity_t *plmn_Identity; + LTE_PLMN_Identity_t *plmn_Identity; plmn_Identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[plmn]->plmn_Identity; @@ -3301,6 +3301,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ); itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p); + LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n"); } } #endif @@ -3312,7 +3313,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, //----------------------------------------------------------------------------- - void dump_sib2( SystemInformationBlockType2_t *sib2 ) + void dump_sib2( LTE_SystemInformationBlockType2_t *sib2 ) { // ac_BarringInfo if (sib2->ac_BarringInfo) { @@ -3441,7 +3442,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present, SIB2SoundingPresent(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present) ); - if (sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present == SoundingRS_UL_ConfigCommon_PR_setup) { + if (sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present == LTE_SoundingRS_UL_ConfigCommon_PR_setup) { LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig : %ld\n", sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig ); LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig : %ld\n", @@ -3480,7 +3481,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, LOG_I( RRC, "radioResourceConfigCommon.ul_CyclicPrefixLength : %ld\n", sib2->radioResourceConfigCommon.ul_CyclicPrefixLength ); -#if (RRC_VERSION >= MAKE_VERSION(10, 2, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 2, 0)) // UplinkPowerControlCommon_v1020 // ... #endif @@ -3512,14 +3513,14 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, LOG_I( RRC, "timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon ); -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) if (sib2->lateNonCriticalExtension) { LOG_I( RRC, "lateNonCriticalExtension : %p\n", sib2->lateNonCriticalExtension ); } else LOG_I( RRC, "lateNonCriticalExtension : not defined\n" ); #endif -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) if (sib2->ext1 && sib2->ext1->ssac_BarringForMMTEL_Voice_r9) { LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor : %ld\n", sib2->ext1->ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor ); @@ -3541,7 +3542,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9 : not defined\n" ); #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (sib2->ext2 && sib2->ext2->ac_BarringForCSFB_r10) { LOG_I( RRC, "ac_BarringForCSFB_r10->ac_BarringFactor : %ld\n", sib2->ext2->ac_BarringForCSFB_r10->ac_BarringFactor ); @@ -3556,7 +3557,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, } //----------------------------------------------------------------------------- - void dump_sib3( SystemInformationBlockType3_t *sib3 ) + void dump_sib3( LTE_SystemInformationBlockType3_t *sib3 ) { LOG_I( RRC, "Dumping SIB3 (see TS36.331 V8.21.0)\n" ); @@ -3703,11 +3704,11 @@ uint64_t arfcn_to_freq(long arfcn) { exit(1); } } - void dump_sib5( SystemInformationBlockType5_t *sib5 ) + void dump_sib5( LTE_SystemInformationBlockType5_t *sib5 ) { - InterFreqCarrierFreqList_t interFreqCarrierFreqList = sib5->interFreqCarrierFreqList; + LTE_InterFreqCarrierFreqList_t interFreqCarrierFreqList = sib5->interFreqCarrierFreqList; int i,j; - InterFreqCarrierFreqInfo_t *ifcfInfo; + LTE_InterFreqCarrierFreqInfo_t *ifcfInfo; LOG_I( RRC, "Dumping SIB5 (see TS36.331 V8.21.0)\n" ); @@ -3729,22 +3730,22 @@ uint64_t arfcn_to_freq(long arfcn) { LOG_I(RRC," threshX_High : %ld\n",ifcfInfo->threshX_High); LOG_I(RRC," threshX_Low : %ld\n",ifcfInfo->threshX_Low); switch(ifcfInfo->allowedMeasBandwidth) { - case AllowedMeasBandwidth_mbw6: + case LTE_AllowedMeasBandwidth_mbw6: LOG_I(RRC," AllowedMeasBandwidth : 6\n"); break; - case AllowedMeasBandwidth_mbw15: + case LTE_AllowedMeasBandwidth_mbw15: LOG_I(RRC," AllowedMeasBandwidth : 15\n"); break; - case AllowedMeasBandwidth_mbw25: + case LTE_AllowedMeasBandwidth_mbw25: LOG_I(RRC," AllowedMeasBandwidth : 25\n"); break; - case AllowedMeasBandwidth_mbw50: + case LTE_AllowedMeasBandwidth_mbw50: LOG_I(RRC," AllowedMeasBandwidth : 50\n"); break; - case AllowedMeasBandwidth_mbw75: + case LTE_AllowedMeasBandwidth_mbw75: LOG_I(RRC," AllowedMeasBandwidth : 75\n"); break; - case AllowedMeasBandwidth_mbw100: + case LTE_AllowedMeasBandwidth_mbw100: LOG_I(RRC," AllowedMeasBandwidth : 100\n"); break; } @@ -3782,7 +3783,7 @@ uint64_t arfcn_to_freq(long arfcn) { } } } -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) if (ifcfInfo->ext1 && ifcfInfo->ext1->q_QualMin_r9) LOG_I(RRC," Q_QualMin_r9 : %ld\n",*ifcfInfo->ext1->q_QualMin_r9); @@ -3795,8 +3796,8 @@ uint64_t arfcn_to_freq(long arfcn) { } -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - void dump_sib13( SystemInformationBlockType13_r9_t *sib13 ) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + void dump_sib13( LTE_SystemInformationBlockType13_r9_t *sib13 ) { LOG_I( RRC, "[UE] Dumping SIB13\n" ); LOG_I( RRC, "[UE] dumping sib13 second time\n" ); @@ -3808,7 +3809,7 @@ uint64_t arfcn_to_freq(long arfcn) { //TTN - SIB18 //----------------------------------------------------------------------------- - void dump_sib18(SystemInformationBlockType18_r12_t *sib18){ + void dump_sib18(LTE_SystemInformationBlockType18_r12_t *sib18){ LOG_I( RRC, "[UE] Dumping SIB18\n" ); for (int i = 0; i < sib18->commConfig_r12->commRxPool_r12.list.count; i++) { LOG_I(RRC, " Contents of SIB18 %d/%d \n", i+1, sib18->commConfig_r12->commRxPool_r12.list.count); @@ -3824,7 +3825,7 @@ uint64_t arfcn_to_freq(long arfcn) { //TTN - SIB19 //----------------------------------------------------------------------------- - void dump_sib19(SystemInformationBlockType19_r12_t *sib19){ + void dump_sib19(LTE_SystemInformationBlockType19_r12_t *sib19){ LOG_I( RRC, "[UE] Dumping SIB19\n" ); for (int i = 0; i < sib19->discConfig_r12->discRxPool_r12.list.count; i++) { LOG_I(RRC, " Contents of SIB19 %d/%d \n", i+1, sib19->discConfig_r12->discRxPool_r12.list.count); @@ -3839,7 +3840,7 @@ uint64_t arfcn_to_freq(long arfcn) { } } - void dump_sib21(SystemInformationBlockType21_r14_t *sib21){ + void dump_sib21(LTE_SystemInformationBlockType21_r14_t *sib21){ if ((sib21->sl_V2X_ConfigCommon_r14 != NULL) && (sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 !=NULL) ){ for (int i = 0; i < sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count; i++) { LOG_I(RRC, " Contents of SIB21 %d/%d \n", i+1, sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count); @@ -3858,15 +3859,19 @@ uint64_t arfcn_to_freq(long arfcn) { //----------------------------------------------------------------------------- int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { - SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; + LTE_SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; int new_sib = 0; - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents - if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_systemInformation_r8 || - (*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) { + if ((*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_systemInformation_r8 || +#if (LTE_RRC_VERSION >= MAKE_VERSION(15, 3, 0)) + (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture_r15) { +#else + (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) { +#endif LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n", (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count ); } else { @@ -3875,15 +3880,15 @@ uint64_t arfcn_to_freq(long arfcn) { } for (int i=0; i<(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { - struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; + struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; typeandinfo = (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; switch(typeandinfo->present) { - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(SystemInformationBlockType2_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(LTE_SystemInformationBlockType2_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] ); LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", @@ -3891,34 +3896,34 @@ uint64_t arfcn_to_freq(long arfcn) { rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq, UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth, &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission, UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA ,0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -3926,7 +3931,7 @@ uint64_t arfcn_to_freq(long arfcn) { #endif ); // After SI is received, prepare RRCConnectionRequest -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option #endif @@ -3968,142 +3973,140 @@ uint64_t arfcn_to_freq(long arfcn) { } break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(SystemInformationBlockType3_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(SystemInformationBlockType4_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(LTE_SystemInformationBlockType4_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16; new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(SystemInformationBlockType5_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(LTE_SystemInformationBlockType5_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib5(UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index]); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(SystemInformationBlockType6_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(LTE_SystemInformationBlockType6_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&64) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=64; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(SystemInformationBlockType7_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(LTE_SystemInformationBlockType7_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&128) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=128; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(SystemInformationBlockType8_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(LTE_SystemInformationBlockType8_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&256) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=256; new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(SystemInformationBlockType9_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(LTE_SystemInformationBlockType9_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&512) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=512; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(SystemInformationBlockType10_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(LTE_SystemInformationBlockType10_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1024) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=1024; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(SystemInformationBlockType11_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(LTE_SystemInformationBlockType11_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; -#if (RRC_VERSION >= MAKE_VERSION(9, 2, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 2, 0)) - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2048) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2048; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(SystemInformationBlockType12_r9_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(LTE_SystemInformationBlockType12_r9_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); } break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4096) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4096; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(SystemInformationBlockType13_r9_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(LTE_SystemInformationBlockType13_r9_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, - (SCellToAddMod_r10_t *)NULL, - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, + (LTE_SCellToAddMod_r10_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, - (MBSFN_SubframeConfigList_t *)NULL, + (LTE_MBSFN_SubframeConfigList_t *)NULL, 0, &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *)NULL + (LTE_PMCH_InfoList_r9_t *)NULL #ifdef CBA ,0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -4114,14 +4117,14 @@ uint64_t arfcn_to_freq(long arfcn) { } #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //SIB18 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8192; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index], &typeandinfo->choice.sib18_v1250, sizeof(SystemInformationBlockType18_r12_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index], &typeandinfo->choice.sib18_v1250, sizeof(LTE_SystemInformationBlockType18_r12_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB18 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib18( UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index] ); // adding here function to store necessary parameters to transfer to PHY layer @@ -4131,21 +4134,21 @@ uint64_t arfcn_to_freq(long arfcn) { //process SIB18 to transfer SL-related parameters to PHY rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index, UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index], - (SystemInformationBlockType19_r12_t *)NULL, - (SL_CommConfig_r12_t *)NULL, - (SL_DiscConfig_r12_t *)NULL + (LTE_SystemInformationBlockType19_r12_t *)NULL, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL ); } break; //SIB19 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16384; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index], &typeandinfo->choice.sib19_v1250, sizeof(SystemInformationBlockType19_r12_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index], &typeandinfo->choice.sib19_v1250, sizeof(LTE_SystemInformationBlockType19_r12_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB19 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib19( UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index] ); // adding here function to store necessary parameters to transfer to PHY layer @@ -4153,22 +4156,22 @@ uint64_t arfcn_to_freq(long arfcn) { ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); //process SIB19 to transfer SL-related parameters to PHY rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index, - (SystemInformationBlockType18_r12_t *)NULL, + (LTE_SystemInformationBlockType18_r12_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index], - (SL_CommConfig_r12_t *)NULL, - (SL_DiscConfig_r12_t *)NULL + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL ); } break; //SIB21 - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: + case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430: if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32768) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32768; new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index], &typeandinfo->choice.sib21_v1430, sizeof(SystemInformationBlockType21_r14_t) ); + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index], &typeandinfo->choice.sib21_v1430, sizeof(LTE_SystemInformationBlockType21_r14_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB21 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib21( UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index] ); // adding here function to store necessary parameters to transfer to PHY layer @@ -4271,8 +4274,8 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ uint8_t buffer[32], size; uint8_t i; uint8_t target_eNB_offset; - MeasId_t measId; - PhysCellId_t targetCellId; + LTE_MeasId_t measId; + LTE_PhysCellId_t targetCellId; long rsrp_t,rsrq_t; long rsrp_s,rsrq_s; long nElem, nElem1; @@ -4333,7 +4336,7 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ LOG_I(RRC, "[UE %d] Frame %d : Generating Measurement Report for eNB %d\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index); result = pdcp_data_req(ctxt_pP, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -4352,15 +4355,15 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { uint8_t i,j; - Hysteresis_t hys; - TimeToTrigger_t ttt_ms; - Q_OffsetRange_t ofn; - Q_OffsetRange_t ocn; - Q_OffsetRange_t ofs = 0; - Q_OffsetRange_t ocs = 0; + LTE_Hysteresis_t hys; + LTE_TimeToTrigger_t ttt_ms; + LTE_Q_OffsetRange_t ofn; + LTE_Q_OffsetRange_t ocn; + LTE_Q_OffsetRange_t ofs = 0; + LTE_Q_OffsetRange_t ocs = 0; long a3_offset; - MeasObjectId_t measObjId; - ReportConfigId_t reportConfigId; + LTE_MeasObjectId_t measObjId; + LTE_ReportConfigId_t reportConfigId; for(i=0 ; imodule_id].MeasId[i][j]->reportConfigId; if( /*UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j] != NULL && */ UE_rrc_inst[ctxt_pP->module_id].MeasObj[i][measObjId-1] != NULL) { - if(UE_rrc_inst[ctxt_pP->module_id].MeasObj[i][measObjId-1]->measObject.present == MeasObjectToAddMod__measObject_PR_measObjectEUTRA) { + if(UE_rrc_inst[ctxt_pP->module_id].MeasObj[i][measObjId-1]->measObject.present == LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA) { /* consider any neighboring cell detected on the associated frequency to be * applicable when the concerned cell is not included in the blackCellsToAddModList * defined within the VarMeasConfig for this measId */ // LOG_I(RRC,"event %d %d %p \n", measObjId,reportConfigId, UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]); if((UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1] != NULL) && - (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.present==ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA) && + (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.present == LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA) && (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.present == - ReportConfigEUTRA__triggerType_PR_event)) { + LTE_ReportConfigEUTRA__triggerType_PR_event)) { hys = UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis; ttt_ms = timeToTrigger_ms[UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId -1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger]; @@ -4390,17 +4393,17 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint -1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset; switch (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present) { - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1: + case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1: LOG_D(RRC,"[UE %d] Frame %d : A1 event: check if serving becomes better than threshold\n", ctxt_pP->module_id, ctxt_pP->frame); break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2: + case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2: LOG_D(RRC,"[UE %d] Frame %d : A2 event, check if serving becomes worse than a threshold\n", ctxt_pP->module_id, ctxt_pP->frame); break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3: + case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3: LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n", ctxt_pP->module_id, ctxt_pP->frame); @@ -4435,12 +4438,12 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4: + case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4: LOG_D(RRC,"[UE %d] Frame %d : received an A4 event, neighbor becomes offset better than a threshold\n", ctxt_pP->module_id, ctxt_pP->frame); break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5: + case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5: LOG_D(RRC,"[UE %d] Frame %d: received an A5 event, serving becomes worse than threshold 1 and neighbor becomes better than threshold 2\n", ctxt_pP->module_id, ctxt_pP->frame); break; @@ -4467,13 +4470,13 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint uint8_t eNB_index, uint8_t ue_cnx_index, uint8_t meas_index, - Q_OffsetRange_t ofn, - Q_OffsetRange_t ocn, - Hysteresis_t hys, - Q_OffsetRange_t ofs, - Q_OffsetRange_t ocs, + LTE_Q_OffsetRange_t ofn, + LTE_Q_OffsetRange_t ocn, + LTE_Hysteresis_t hys, + LTE_Q_OffsetRange_t ofs, + LTE_Q_OffsetRange_t ocs, long a3_offset, - TimeToTrigger_t ttt ) + LTE_TimeToTrigger_t ttt ) { uint8_t eNB_offset; // uint8_t currentCellIndex = frame_parms->Nid_cell; @@ -4524,13 +4527,13 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint return 0; } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) //----------------------------------------------------------------------------- int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ) { - MCCH_Message_t *mcch=NULL; - MBSFNAreaConfiguration_r9_t** mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index]; + LTE_MCCH_Message_t *mcch=NULL; + LTE_MBSFNAreaConfiguration_r9_t** mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index]; asn_dec_rval_t dec_rval; @@ -4542,7 +4545,7 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB return 0; // avoid decoding to prevent memory bloating } else { dec_rval = uper_decode_complete(NULL, - &asn_DEF_MCCH_Message, + &asn_DEF_LTE_MCCH_Message, (void **)&mcch, (const void *)Sdu, Sdu_len); @@ -4552,19 +4555,19 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB ctxt_pP->module_id, dec_rval.consumed); //free the memory - SEQUENCE_free(&asn_DEF_MCCH_Message, (void*)mcch, 1); + SEQUENCE_free(&asn_DEF_LTE_MCCH_Message, (void*)mcch, 1); return -1; } if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_MCCH_Message, (void*)mcch); + xer_fprint(stdout, &asn_DEF_LTE_MCCH_Message, (void*)mcch); } - if (mcch->message.present == MCCH_MessageType_PR_c1) { + if (mcch->message.present == LTE_MCCH_MessageType_PR_c1) { LOG_D(RRC,"[UE %d] Found mcch message \n", ctxt_pP->module_id); - if(mcch->message.choice.c1.present == MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9) { + if(mcch->message.choice.c1.present == LTE_MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9) { /* memcpy((void*)*mcch_message, (void*)&mcch->message.choice.c1.choice.mbsfnAreaConfiguration_r9, @@ -4617,29 +4620,29 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB // store to MAC/PHY necessary parameters for receiving MTCHs rrc_mac_config_req_ue(ue_mod_idP,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, - (MBSFN_SubframeConfigList_t *)NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + (LTE_MBSFN_SubframeConfigList_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , 0, - (MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, &UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9 #endif @@ -4648,7 +4651,7 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) , 0, NULL, @@ -4664,12 +4667,12 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB rrc_pdcp_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList - (DRB_ToReleaseList_t*)NULL, + (LTE_DRB_ToReleaseList_t*)NULL, 0, // security mode NULL, // key rrc encryption NULL, // key rrc integrity NULL // key encryption -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,&(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9) #endif ,NULL); @@ -4678,7 +4681,7 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB NULL,// SRB_ToAddModList NULL,// DRB_ToAddModList NULL,// DRB_ToReleaseList -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) &(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9) , 0, 0 #endif @@ -4716,7 +4719,6 @@ void *rrc_ue_task( void *args_p ) break; case MESSAGE_TEST: - LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); break; /* MAC messages */ @@ -4781,7 +4783,7 @@ void *rrc_ue_task( void *args_p ) RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); break; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) case RRC_MAC_MCCH_DATA_IND: LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d, mbsfn SA %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), @@ -5111,6 +5113,7 @@ void *rrc_ue_task( void *args_p ) break; // PHY_FIND_CELL_IND case PHY_MEAS_REPORT_IND: { + LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); MessageDef *message_p; message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND); @@ -5128,6 +5131,7 @@ void *rrc_ue_task( void *args_p ) } case RRC_RAL_CONFIGURE_THRESHOLD_REQ: + LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p); break; @@ -5213,7 +5217,7 @@ openair_rrc_top_init_ue( UE_rrc_inst[module_id].UECapability_size = UECap->sdu_size; } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) LOG_I(RRC,"[UE] eMBMS active state is %d \n", eMBMS_active); for (module_id=0; module_id= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /* TODO: this is disabled for the moment because the standard UE * crashes when calling this function. */ @@ -5250,7 +5254,7 @@ rrc_top_cleanup_ue( //----------------------------------------------------------------------------- -uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode) +uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode) { uint8_t size=0; uint8_t buffer[100]; @@ -5282,7 +5286,7 @@ uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt // 3GPP 36.331 (Section 5.10.7.3) -uint8_t fill_SLSS(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, SLSSID_r12_t *slss_id, uint8_t *subframe, uint8_t mode) +uint8_t fill_SLSS(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, LTE_SLSSID_r12_t *slss_id, uint8_t *subframe, uint8_t mode) { long syncOffsetIndicator = 0; switch(mode) { @@ -5334,10 +5338,10 @@ void rrc_ue_process_sidelink_radioResourceConfig( module_id_t Mod_idP, uint8_t eNB_index, - SystemInformationBlockType18_r12_t *sib18, - SystemInformationBlockType19_r12_t *sib19, - SL_CommConfig_r12_t* sl_CommConfig, - SL_DiscConfig_r12_t* sl_DiscConfig + LTE_SystemInformationBlockType18_r12_t *sib18, + LTE_SystemInformationBlockType19_r12_t *sib19, + LTE_SL_CommConfig_r12_t* sl_CommConfig, + LTE_SL_DiscConfig_r12_t* sl_DiscConfig ) //----------------------------------------------------------------------------- { @@ -5377,8 +5381,8 @@ rrc_ue_process_sidelink_radioResourceConfig( if (sl_CommConfig->commTxResources_r12 != NULL) { switch (sl_CommConfig->commTxResources_r12->present){ - case SL_CommConfig_r12__commTxResources_r12_PR_setup: - if (sl_CommConfig->commTxResources_r12->choice.setup.present == SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12 ){ + case LTE_SL_CommConfig_r12__commTxResources_r12_PR_setup: + if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12 ){ LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI size %lu \n", Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size ); @@ -5390,7 +5394,7 @@ rrc_ue_process_sidelink_radioResourceConfig( Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL ); //configure scheduled resource for SL //TODO - } else if (sl_CommConfig->commTxResources_r12->choice.setup.present == SL_CommConfig_r12__commTxResources_r12__setup_PR_ue_Selected_r12){ + } else if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_ue_Selected_r12){ //configure dedicated resources (commTxPoolNormalDedicated) for SL from which UE can autonomously select //sl_CommConfig->commTxResources_r12->choice.setup.choice.ue_Selected_r12.commTxPoolNormalDedicated_r12; @@ -5401,11 +5405,11 @@ rrc_ue_process_sidelink_radioResourceConfig( } break; - case SL_CommConfig_r12__commTxResources_r12_PR_release: + case LTE_SL_CommConfig_r12__commTxResources_r12_PR_release: //release dedicated resources for SL communication break; - case SL_CommConfig_r12__commTxResources_r12_PR_NOTHING: /* No components present */ + case LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING: /* No components present */ break; default: @@ -5421,21 +5425,21 @@ rrc_ue_process_sidelink_radioResourceConfig( if (sl_DiscConfig->discTxResources_r12 != NULL) { switch (sl_DiscConfig->discTxResources_r12->present) { - case SL_DiscConfig_r12__discTxResources_r12_PR_setup: - if (sl_DiscConfig->discTxResources_r12->choice.setup.present == SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12) { + case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_setup: + if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12) { //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discHoppingConfig_r12; //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTF_IndexList_r12; //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTxConfig_r12; - } else if (sl_DiscConfig->discTxResources_r12->choice.setup.present == SL_DiscConfig_r12__discTxResources_r12__setup_PR_ue_Selected_r12) { + } else if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_ue_Selected_r12) { //sl_DiscConfig->discTxResources_r12->choice.setup.choice.ue_Selected_r12.discTxPoolDedicated_r12; } else { //SL_DiscConfig_r12__discTxResources_r12__setup_PR_NOTHING, /* No components present */ } break; - case SL_DiscConfig_r12__discTxResources_r12_PR_release: + case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_release: //release dedicated resources for SL discovery break; - case SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING: /* No components present */ + case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING: /* No components present */ break; default: break; @@ -5445,20 +5449,20 @@ rrc_ue_process_sidelink_radioResourceConfig( //dedicated resources for transmitting PS related discovery if (sl_DiscConfig->ext2->discTxResourcesPS_r13 != NULL){ switch (sl_DiscConfig->ext2->discTxResourcesPS_r13->present) { - case SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_setup: - if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_scheduled_r13) { + case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_setup: + if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_scheduled_r13) { //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discHoppingConfig_r13; //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discTxConfig_r13 - } else if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_ue_Selected_r13) { + } else if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_ue_Selected_r13) { //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.ue_Selected_r13.discTxPoolPS_Dedicated_r13; } else { //SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_NOTHING, /* No components present */ } break; - case SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_release: + case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_release: break; - case SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_NOTHING: + case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_NOTHING: /* No components present */ break; default: @@ -5468,7 +5472,7 @@ rrc_ue_process_sidelink_radioResourceConfig( } } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) //----------------------------------------------------------- void rrc_control_socket_init(){ @@ -5543,11 +5547,11 @@ void *rrc_control_socket_thread_fct(void *arg) uint8_t type; UE_RRC_INST *UE = NULL; protocol_ctxt_t ctxt; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL; + struct LTE_RLC_Config *DRB_rlc_config = NULL; + struct LTE_PDCP_Config *DRB_pdcp_config = NULL; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL; long *logicalchannelgroup_drb = NULL; int j = 0; int i = 0; @@ -5639,7 +5643,7 @@ void *rrc_control_socket_thread_fct(void *arg) UE = &UE_rrc_inst[module_id]; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0); - UE->DRB_config[0][0] = CALLOC(1,sizeof(struct DRB_ToAddMod)); + UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod)); UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); UE->DRB_config[0][0]->drb_Identity = 3; UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); @@ -5648,23 +5652,23 @@ void *rrc_control_socket_thread_fct(void *arg) UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config)); - DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config)); - PDCP_rlc_UM = CALLOC(1,sizeof(struct PDCP_Config__rlc_UM)); - DRB_lchan_config = CALLOC(1,sizeof(struct LogicalChannelConfig)); - DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LogicalChannelConfig__ul_SpecificParameters)); + DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config)); + DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config)); + PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM)); + DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig)); + DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters)); logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config; DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; @@ -5672,54 +5676,54 @@ void *rrc_control_socket_thread_fct(void *arg) (void)PDCP_rlc_UM; DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t)); + UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t)); ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]); rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *) NULL, + (LTE_SRB_ToAddModList_t *) NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*) NULL, + (LTE_DRB_ToReleaseList_t*) NULL, 0xff, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , 0, 0 #endif ); rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , sourceL2Id, groupL2Id #endif ); @@ -5727,29 +5731,29 @@ void *rrc_control_socket_thread_fct(void *arg) //configure MAC with sourceL2Id/groupL2ID rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 3, //LCID - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -5757,7 +5761,7 @@ void *rrc_control_socket_thread_fct(void *arg) 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,CONFIG_ACTION_ADD, &sourceL2Id, &groupL2Id @@ -5799,29 +5803,29 @@ void *rrc_control_socket_thread_fct(void *arg) sourceL2Id = UE_rrc_inst[module_id].sourceL2Id; rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, + #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -5829,7 +5833,7 @@ void *rrc_control_socket_thread_fct(void *arg) 0, 0 #endif - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,CONFIG_ACTION_REMOVE, &sourceL2Id, &destinationL2Id @@ -5887,7 +5891,7 @@ void *rrc_control_socket_thread_fct(void *arg) UE = &UE_rrc_inst[module_id]; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0); - UE->DRB_config[0][0] = CALLOC(1,sizeof(struct DRB_ToAddMod)); + UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod)); UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); UE->DRB_config[0][0]->drb_Identity = 3; UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); @@ -5896,23 +5900,23 @@ void *rrc_control_socket_thread_fct(void *arg) UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config)); - DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config)); - PDCP_rlc_UM = CALLOC(1,sizeof(struct PDCP_Config__rlc_UM)); - DRB_lchan_config = CALLOC(1,sizeof(struct LogicalChannelConfig)); - DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LogicalChannelConfig__ul_SpecificParameters)); + DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config)); + DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config)); + PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM)); + DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig)); + DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters)); logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config; DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; @@ -5920,54 +5924,54 @@ void *rrc_control_socket_thread_fct(void *arg) (void)PDCP_rlc_UM; DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t)); + UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t)); ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]); rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *) NULL, + (LTE_SRB_ToAddModList_t *) NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*) NULL, + (LTE_DRB_ToReleaseList_t*) NULL, 0xff, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , 0, 0 #endif ); rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , sourceL2Id, destinationL2Id #endif ); @@ -5975,29 +5979,29 @@ void *rrc_control_socket_thread_fct(void *arg) //configure MAC with sourceL2Id/destinationL2Id rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 3, //LCID - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -6005,7 +6009,7 @@ void *rrc_control_socket_thread_fct(void *arg) 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,CONFIG_ACTION_ADD, &sourceL2Id, &destinationL2Id @@ -6072,7 +6076,7 @@ void *rrc_control_socket_thread_fct(void *arg) UE = &UE_rrc_inst[module_id]; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0); - UE->DRB_config[0][0] = CALLOC(1,sizeof(struct DRB_ToAddMod)); + UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod)); UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); UE->DRB_config[0][0]->drb_Identity = 10; UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long)); @@ -6081,23 +6085,23 @@ void *rrc_control_socket_thread_fct(void *arg) UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config)); - DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config)); - PDCP_rlc_UM = CALLOC(1,sizeof(struct PDCP_Config__rlc_UM)); - DRB_lchan_config = CALLOC(1,sizeof(struct LogicalChannelConfig)); - DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LogicalChannelConfig__ul_SpecificParameters)); + DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config)); + DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config)); + PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM)); + DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig)); + DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters)); logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config; DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; @@ -6105,44 +6109,44 @@ void *rrc_control_socket_thread_fct(void *arg) (void)PDCP_rlc_UM; DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t)); + UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t)); ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]); rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *) NULL, + (LTE_SRB_ToAddModList_t *) NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*) NULL, + (LTE_DRB_ToReleaseList_t*) NULL, 0xff, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , 0, 0 #endif ); @@ -6150,40 +6154,40 @@ void *rrc_control_socket_thread_fct(void *arg) //TX if (type > 0) { rrc_rlc_config_asn1_req(&ctxt, - (SRB_ToAddModList_t*)NULL, + (LTE_SRB_ToAddModList_t*)NULL, UE->DRB_configList, - (DRB_ToReleaseList_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,(PMCH_InfoList_r9_t *)NULL + (LTE_DRB_ToReleaseList_t*)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,(LTE_PMCH_InfoList_r9_t *)NULL , sourceL2Id, destinationL2Id #endif ); //configure MAC with sourceL2Id/groupL2ID rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 10, //LCID - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -6191,7 +6195,7 @@ void *rrc_control_socket_thread_fct(void *arg) 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,CONFIG_ACTION_ADD, &sourceL2Id, &destinationL2Id @@ -6200,29 +6204,29 @@ void *rrc_control_socket_thread_fct(void *arg) } else {//RX //configure MAC with sourceL2Id/groupL2ID rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, + (LTE_MeasObjectToAddMod_t **)NULL, + (LTE_MAC_MainConfig_t *)NULL, 10, //LCID - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_TDD_Config_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, NULL, NULL, NULL, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + (LTE_MBSFN_AreaInfoList_r9_t *)NULL, + (LTE_PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA @@ -6230,7 +6234,7 @@ void *rrc_control_socket_thread_fct(void *arg) 0, 0 #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) ,CONFIG_ACTION_ADD, &sourceL2Id, NULL diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index ae87075489..9d42883086 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -64,10 +64,10 @@ #define IPV4_ADDR "%u.%u.%u.%u" #define IPV4_ADDR_FORMAT(aDDRESS) \ - (uint8_t)((aDDRESS) & 0x000000ff), \ - (uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \ - (uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \ - (uint8_t)(((aDDRESS) & 0xff000000) >> 24) + (uint8_t)((aDDRESS) & 0x000000ff), \ + (uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \ + (uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \ + (uint8_t)(((aDDRESS) & 0xff000000) >> 24) //----------------------------------------------------- @@ -84,74 +84,74 @@ #define GROUP_COMMUNICATION_RELEASE_RSP 8 #define PC5S_ESTABLISH_REQ 9 #define PC5S_ESTABLISH_RSP 10 -#define PC5_DISCOVERY_MESSAGE 11 +#define PC5_DISCOVERY_MESSAGE 11 -#define PC5_DISCOVERY_PAYLOAD_SIZE 29 +#define PC5_DISCOVERY_PAYLOAD_SIZE 29 typedef enum { - UE_STATE_OFF_NETWORK, - UE_STATE_ON_NETWORK + UE_STATE_OFF_NETWORK, + UE_STATE_ON_NETWORK } SL_UE_STATE_t; typedef enum { - GROUP_COMMUNICATION_RELEASE_OK = 0, - GROUP_COMMUNICATION_RELEASE_FAILURE + GROUP_COMMUNICATION_RELEASE_OK = 0, + GROUP_COMMUNICATION_RELEASE_FAILURE } Group_Communication_Status_t; struct GroupCommunicationEstablishReq { - uint32_t sourceL2Id; - uint32_t groupL2Id; - uint32_t groupIpAddress; - uint8_t pppp; + uint32_t sourceL2Id; + uint32_t groupL2Id; + uint32_t groupIpAddress; + uint8_t pppp; }; struct GroupCommunicationReleaseReq { - uint32_t sourceL2Id; - uint32_t groupL2Id; - int slrb_id; + uint32_t sourceL2Id; + uint32_t groupL2Id; + int slrb_id; }; struct DirectCommunicationEstablishReq { - uint32_t sourceL2Id; - uint32_t destinationL2Id; - uint32_t pppp; + uint32_t sourceL2Id; + uint32_t destinationL2Id; + uint32_t pppp; }; -struct PC5SEstablishReq{ - uint8_t type; - uint32_t sourceL2Id; - uint32_t destinationL2Id; +struct PC5SEstablishReq { + uint8_t type; + uint32_t sourceL2Id; + uint32_t destinationL2Id; }; -struct PC5SEstablishRsp{ - uint32_t slrbid_lcid28; - uint32_t slrbid_lcid29; - uint32_t slrbid_lcid30; +struct PC5SEstablishRsp { + uint32_t slrbid_lcid28; + uint32_t slrbid_lcid29; + uint32_t slrbid_lcid30; }; //PC5_DISCOVERY MESSAGE typedef struct { - unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE]; - uint32_t measuredPower; + unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE]; + uint32_t measuredPower; } __attribute__((__packed__)) PC5DiscoveryMessage ; struct sidelink_ctrl_element { - unsigned short type; - union { - struct GroupCommunicationEstablishReq group_comm_establish_req; - struct DirectCommunicationEstablishReq direct_comm_establish_req; - Group_Communication_Status_t group_comm_release_rsp; - //struct DirectCommunicationReleaseReq direct_comm_release_req; - SL_UE_STATE_t ue_state; - int slrb_id; - struct PC5SEstablishReq pc5s_establish_req; - struct PC5SEstablishRsp pc5s_establish_rsp; - PC5DiscoveryMessage pc5_discovery_message; - } sidelinkPrimitive; + unsigned short type; + union { + struct GroupCommunicationEstablishReq group_comm_establish_req; + struct DirectCommunicationEstablishReq direct_comm_establish_req; + Group_Communication_Status_t group_comm_release_rsp; + //struct DirectCommunicationReleaseReq direct_comm_release_req; + SL_UE_STATE_t ue_state; + int slrb_id; + struct PC5SEstablishReq pc5s_establish_req; + struct PC5SEstablishRsp pc5s_establish_rsp; + PC5DiscoveryMessage pc5_discovery_message; + } sidelinkPrimitive; }; @@ -167,33 +167,33 @@ void *send_UE_status_notification(void *); //#include "COMMON/openair_defs.h" #ifndef USER_MODE -//#include + //#include #endif -#include "SystemInformationBlockType1.h" -#include "SystemInformation.h" -#include "RRCConnectionReconfiguration.h" -#include "RRCConnectionReconfigurationComplete.h" -#include "RRCConnectionSetup.h" -#include "RRCConnectionSetupComplete.h" -#include "RRCConnectionRequest.h" -#include "RRCConnectionReestablishmentRequest.h" -#include "BCCH-DL-SCH-Message.h" -#include "SBCCH-SL-BCH-MessageType.h" -#include "BCCH-BCH-Message.h" -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -#include "MCCH-Message.h" -#include "MBSFNAreaConfiguration-r9.h" +#include "LTE_SystemInformationBlockType1.h" +#include "LTE_SystemInformation.h" +#include "LTE_RRCConnectionReconfiguration.h" +#include "LTE_RRCConnectionReconfigurationComplete.h" +#include "LTE_RRCConnectionSetup.h" +#include "LTE_RRCConnectionSetupComplete.h" +#include "LTE_RRCConnectionRequest.h" +#include "LTE_RRCConnectionReestablishmentRequest.h" +#include "LTE_BCCH-DL-SCH-Message.h" +#include "LTE_SBCCH-SL-BCH-MessageType.h" +#include "LTE_BCCH-BCH-Message.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + #include "LTE_MCCH-Message.h" + #include "LTE_MBSFNAreaConfiguration-r9.h" #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "SCellToAddMod-r10.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + #include "LTE_SCellToAddMod-r10.h" #endif -#include "AS-Config.h" -#include "AS-Context.h" -#include "UE-EUTRA-Capability.h" -#include "MeasResults.h" -#if (RRC_VERSION >= MAKE_VERSION(12, 0, 0)) -#include "SidelinkUEInformation-r12.h" +#include "LTE_AS-Config.h" +#include "LTE_AS-Context.h" +#include "LTE_UE-EUTRA-Capability.h" +#include "LTE_MeasResults.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(12, 0, 0)) + #include "LTE_SidelinkUEInformation-r12.h" #endif /* for ImsiMobileIdentity_t */ @@ -202,67 +202,67 @@ void *send_UE_status_notification(void *); /* correct Rel(8|10)/Rel14 differences * the code is in favor of Rel14, those defines do the translation */ -#if (RRC_VERSION < MAKE_VERSION(14, 0, 0)) -# define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm -# define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0 -# define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1 -# define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2 -# define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1 -# define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0 -# define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04 -# define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05 -# define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06 -# define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07 -# define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08 -# define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09 -# define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1 -# define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3 -# define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4 -# define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5 -# define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6 -# define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7 -# define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8 -# define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10 -# define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20 -# define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50 -# define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100 -# define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200 -# define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5 -# define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10 -# define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16 -# define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20 -# define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32 -# define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40 -# define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64 -# define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80 -# define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128 -# define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160 -# define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320 -# define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640 -# define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280 -# define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560 -# define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity -# define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320 -# define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640 -# define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280 -# define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560 -# define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120 -# define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240 +#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0)) + #define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm + #define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0 + #define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1 + #define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2 + #define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1 + #define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0 + #define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04 + #define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05 + #define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06 + #define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07 + #define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08 + #define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09 + #define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1 + #define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3 + #define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4 + #define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5 + #define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6 + #define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7 + #define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8 + #define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10 + #define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20 + #define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50 + #define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100 + #define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200 + #define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5 + #define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10 + #define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16 + #define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20 + #define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32 + #define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40 + #define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64 + #define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80 + #define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128 + #define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160 + #define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320 + #define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640 + #define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280 + #define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560 + #define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity + #define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320 + #define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640 + #define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280 + #define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560 + #define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120 + #define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240 #endif // This corrects something generated by asn1c which is different between Rel8 and Rel10 -#if (RRC_VERSION <= MAKE_VERSION(10, 0, 0)) -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11 +#if (LTE_RRC_VERSION <= MAKE_VERSION(10, 0, 0)) + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10 + #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11 #endif @@ -272,20 +272,20 @@ void *send_UE_status_notification(void *); #define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE /* -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib12_v920 #define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib13_v920 #endif */ //#include "L3_rrc_defs.h" #ifndef NO_RRM -#include "L3_rrc_interface.h" -#include "rrc_rrm_msg.h" -#include "rrc_rrm_interface.h" + #include "L3_rrc_interface.h" + #include "rrc_rrm_msg.h" + #include "rrc_rrm_interface.h" #endif #if defined(ENABLE_ITTI) -# include "intertask_interface.h" + #include "intertask_interface.h" #endif /* TODO: be sure this include is correct. @@ -293,11 +293,11 @@ void *send_UE_status_notification(void *); * issue #186. */ #if !defined(ENABLE_ITTI) -# include "as_message.h" + #include "as_message.h" #endif #if defined(ENABLE_USE_MME) -# include "commonDef.h" + #include "commonDef.h" #endif //-------- @@ -387,10 +387,10 @@ typedef enum SL_TRIGGER_e { #define RRC_TRANSACTION_IDENTIFIER_NUMBER 3 typedef struct { - unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ - unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ + unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ + unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ @@ -403,7 +403,7 @@ typedef struct UE_RRC_INFO_s { uint8_t SIB1systemInfoValueTag; uint32_t SIStatus; uint32_t SIcnt; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA #endif uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 @@ -456,8 +456,8 @@ typedef struct HANDOVER_INFO_s { uint8_t modid_t; //module_idP of target cell uint8_t ueid_s; //UE index in serving cell uint8_t ueid_t; //UE index in target cell - AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ - AS_Context_t as_context; /* They are mandatory for HO */ + LTE_AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ + LTE_AS_Context_t as_context; /* They are mandatory for HO */ uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */ int size; /* size of above message in bytes */ } HANDOVER_INFO; @@ -501,44 +501,44 @@ typedef struct SRB_INFO_TABLE_ENTRY_s { } SRB_INFO_TABLE_ENTRY; typedef struct MEAS_REPORT_LIST_s { - MeasId_t measId; + LTE_MeasId_t measId; //CellsTriggeredList cellsTriggeredList;//OPTIONAL uint32_t numberOfReportsSent; } MEAS_REPORT_LIST; typedef struct HANDOVER_INFO_UE_s { - PhysCellId_t targetCellId; + LTE_PhysCellId_t targetCellId; uint8_t measFlag; } HANDOVER_INFO_UE; typedef struct eNB_RRC_UE_s { uint8_t primaryCC_id; -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - SCellToAddMod_r10_t sCell_config[2]; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + LTE_SCellToAddMod_r10_t sCell_config[2]; #endif - SRB_ToAddModList_t* SRB_configList; - SRB_ToAddModList_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; - DRB_ToAddModList_t* DRB_configList; - DRB_ToAddModList_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; - DRB_ToReleaseList_t* DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; + LTE_SRB_ToAddModList_t *SRB_configList; + LTE_SRB_ToAddModList_t *SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; + LTE_DRB_ToAddModList_t *DRB_configList; + LTE_DRB_ToAddModList_t *DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; + LTE_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; uint8_t DRB_active[8]; - struct PhysicalConfigDedicated* physicalConfigDedicated; - struct SPS_Config* sps_Config; - MeasObjectToAddMod_t* MeasObj[MAX_MEAS_OBJ]; - struct ReportConfigToAddMod* ReportConfig[MAX_MEAS_CONFIG]; - struct QuantityConfig* QuantityConfig; - struct MeasIdToAddMod* MeasId[MAX_MEAS_ID]; - MAC_MainConfig_t* mac_MainConfig; - MeasGapConfig_t* measGapConfig; + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated; + struct LTE_SPS_Config *sps_Config; + LTE_MeasObjectToAddMod_t *MeasObj[MAX_MEAS_OBJ]; + struct LTE_ReportConfigToAddMod *ReportConfig[MAX_MEAS_CONFIG]; + struct LTE_QuantityConfig *QuantityConfig; + struct LTE_MeasIdToAddMod *MeasId[MAX_MEAS_ID]; + LTE_MAC_MainConfig_t *mac_MainConfig; + LTE_MeasGapConfig_t *measGapConfig; SRB_INFO SI; SRB_INFO Srb0; SRB_INFO_TABLE_ENTRY Srb1; SRB_INFO_TABLE_ENTRY Srb2; - MeasConfig_t* measConfig; - HANDOVER_INFO* handover_info; - MeasResults_t* measResults; + LTE_MeasConfig_t *measConfig; + HANDOVER_INFO *handover_info; + LTE_MeasResults_t *measResults; - UE_EUTRA_Capability_t* UE_Capability; + LTE_UE_EUTRA_Capability_t *UE_Capability; ImsiMobileIdentity_t imsi; #if defined(ENABLE_SECURITY) @@ -549,20 +549,20 @@ typedef struct eNB_RRC_UE_s { int8_t nh_ncc; #endif /* Used integrity/ciphering algorithms */ - CipheringAlgorithm_r12_t ciphering_algorithm; - e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + LTE_CipheringAlgorithm_r12_t ciphering_algorithm; + e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; - uint8_t Status; + uint8_t Status; // RRC status, type enum UE_STATE_t rnti_t rnti; uint64_t random_ue_identity; #if defined(ENABLE_ITTI) /* Information from UE RRC ConnectionRequest */ UE_S_TMSI Initialue_identity_s_TMSI; - EstablishmentCause_t establishment_cause; + LTE_EstablishmentCause_t establishment_cause; /* Information from UE RRC ConnectionReestablishmentRequest */ - ReestablishmentCause_t reestablishment_cause; + LTE_ReestablishmentCause_t reestablishment_cause; /* UE id for initial connection to S1AP */ uint16_t ue_initial_id; @@ -573,7 +573,7 @@ typedef struct eNB_RRC_UE_s { security_capabilities_t security_capabilities; /* Total number of e_rab already setup in the list */ - uint8_t setup_e_rabs; + uint8_t setup_e_rabs; /* Number of e_rab to be setup in the list */ uint8_t nb_of_e_rabs; /* Number of e_rab to be modified in the list */ @@ -599,6 +599,8 @@ typedef struct eNB_RRC_UE_s { uint32_t ue_release_timer_thres_rrc; uint32_t ue_reestablishment_timer; uint32_t ue_reestablishment_timer_thres; + /* RRC inactivity timer: on timeout, should release RRC connection for inactivity on all E-RABs */ + uint32_t ue_rrc_inactivity_timer; uint8_t e_rab_release_command_flag; int8_t reestablishment_xid; } eNB_RRC_UE_t; @@ -628,7 +630,7 @@ typedef struct { uint8_t sizeof_SIB1; uint8_t *SIB23; uint8_t sizeof_SIB23; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint8_t *SIB1_BR; uint8_t sizeof_SIB1_BR; uint8_t *SIB23_BR; @@ -640,32 +642,32 @@ typedef struct { uint32_t dl_CarrierFreq; uint32_t ul_CarrierFreq; uint32_t pbch_repetition; - BCCH_BCH_Message_t mib; - BCCH_DL_SCH_Message_t siblock1; - BCCH_DL_SCH_Message_t systemInformation; - // SystemInformation_t systemInformation; - SystemInformationBlockType1_t *sib1; - SystemInformationBlockType2_t *sib2; - SystemInformationBlockType3_t *sib3; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - SystemInformationBlockType1_t *sib1_BR; - SystemInformationBlockType2_t *sib2_BR; - SystemInformationBlockType2_t *sib3_BR; + LTE_BCCH_BCH_Message_t mib; + LTE_BCCH_DL_SCH_Message_t siblock1; + LTE_BCCH_DL_SCH_Message_t systemInformation; + // SystemInformation_t systemInformation; + LTE_SystemInformationBlockType1_t *sib1; + LTE_SystemInformationBlockType2_t *sib2; + LTE_SystemInformationBlockType3_t *sib3; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + LTE_SystemInformationBlockType1_t *sib1_BR; + LTE_SystemInformationBlockType2_t *sib2_BR; + LTE_SystemInformationBlockType2_t *sib3_BR; #endif -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - SystemInformationBlockType13_r9_t *sib13; +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + LTE_SystemInformationBlockType13_r9_t *sib13; uint8_t MBMS_flag; uint8_t num_mbsfn_sync_area; uint8_t **MCCH_MESSAGE; // MAX_MBSFN_AREA uint8_t sizeof_MCCH_MESSAGE[8];// MAX_MBSFN_AREA - MCCH_Message_t mcch; - MBSFNAreaConfiguration_r9_t *mcch_message; + LTE_MCCH_Message_t mcch; + LTE_MBSFNAreaConfiguration_r9_t *mcch_message; SRB_INFO MCCH_MESS[8];// MAX_MBSFN_AREA #endif //TTN - SIB 18,19,21 for D2D - SystemInformationBlockType18_r12_t *sib18; - SystemInformationBlockType19_r12_t *sib19; - SystemInformationBlockType21_r14_t *sib21; + LTE_SystemInformationBlockType18_r12_t *sib18; + LTE_SystemInformationBlockType19_r12_t *sib19; + LTE_SystemInformationBlockType21_r14_t *sib21; // End - TTN SRB_INFO SI; SRB_INFO Srb0; @@ -714,7 +716,7 @@ typedef struct eNB_RRC_INST_s { typedef struct OAI_UECapability_s { uint8_t sdu[MAX_UE_CAPABILITY_SIZE]; uint8_t sdu_size; - UE_EUTRA_Capability_t *UE_EUTRA_Capability; + LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability; } OAI_UECapability_t; typedef struct UE_RRC_INST_s { @@ -739,28 +741,28 @@ typedef struct UE_RRC_INST_s { uint8_t sizeof_SI[NB_CNX_UE]; uint8_t SIB1Status[NB_CNX_UE]; uint8_t SIStatus[NB_CNX_UE]; - SystemInformationBlockType1_t *sib1[NB_CNX_UE]; - SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). - SystemInformationBlockType2_t *sib2[NB_CNX_UE]; - SystemInformationBlockType3_t *sib3[NB_CNX_UE]; - SystemInformationBlockType4_t *sib4[NB_CNX_UE]; - SystemInformationBlockType5_t *sib5[NB_CNX_UE]; - SystemInformationBlockType6_t *sib6[NB_CNX_UE]; - SystemInformationBlockType7_t *sib7[NB_CNX_UE]; - SystemInformationBlockType8_t *sib8[NB_CNX_UE]; - SystemInformationBlockType9_t *sib9[NB_CNX_UE]; - SystemInformationBlockType10_t *sib10[NB_CNX_UE]; - SystemInformationBlockType11_t *sib11[NB_CNX_UE]; + LTE_SystemInformationBlockType1_t *sib1[NB_CNX_UE]; + LTE_SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). + LTE_SystemInformationBlockType2_t *sib2[NB_CNX_UE]; + LTE_SystemInformationBlockType3_t *sib3[NB_CNX_UE]; + LTE_SystemInformationBlockType4_t *sib4[NB_CNX_UE]; + LTE_SystemInformationBlockType5_t *sib5[NB_CNX_UE]; + LTE_SystemInformationBlockType6_t *sib6[NB_CNX_UE]; + LTE_SystemInformationBlockType7_t *sib7[NB_CNX_UE]; + LTE_SystemInformationBlockType8_t *sib8[NB_CNX_UE]; + LTE_SystemInformationBlockType9_t *sib9[NB_CNX_UE]; + LTE_SystemInformationBlockType10_t *sib10[NB_CNX_UE]; + LTE_SystemInformationBlockType11_t *sib11[NB_CNX_UE]; uint8_t *MIB; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) //SIB18 - SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE]; - SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE]; - SystemInformationBlockType21_r14_t *sib21[NB_CNX_UE]; + LTE_SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE]; + LTE_SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE]; + LTE_SystemInformationBlockType21_r14_t *sib21[NB_CNX_UE]; - SBCCH_SL_BCH_MessageType_t mib_sl[NB_CNX_UE]; + LTE_SBCCH_SL_BCH_MessageType_t mib_sl[NB_CNX_UE]; /// Preconfiguration for Sidelink - struct SL_Preconfiguration_r12 *SL_Preconfiguration[NB_CNX_UE]; + struct LTE_SL_Preconfiguration_r12 *SL_Preconfiguration[NB_CNX_UE]; //source L2 Id uint32_t sourceL2Id; //group L2 Id @@ -768,41 +770,41 @@ typedef struct UE_RRC_INST_s { //current destination uint32_t destinationL2Id; //List of destinations - uint32_t destinationList[MAX_NUM_DEST]; + uint32_t destinationList[MAX_NUM_DEST]; //sl_discovery.. SRB_INFO SL_Discovery[NB_CNX_UE]; #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t MBMS_flag; uint8_t *MCCH_MESSAGE[NB_CNX_UE]; uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE]; uint8_t MCCH_MESSAGEStatus[NB_CNX_UE]; - MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE]; - SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE]; - SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE]; + LTE_MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE]; + LTE_SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE]; + LTE_SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE]; #endif #ifdef CBA uint8_t num_active_cba_groups; uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; #endif uint8_t num_srb; - struct SRB_ToAddMod *SRB1_config[NB_CNX_UE]; - struct SRB_ToAddMod *SRB2_config[NB_CNX_UE]; - struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; + struct LTE_SRB_ToAddMod *SRB1_config[NB_CNX_UE]; + struct LTE_SRB_ToAddMod *SRB2_config[NB_CNX_UE]; + struct LTE_DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; rb_id_t *defaultDRB; // remember the ID of the default DRB - MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; - struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; - struct QuantityConfig *QuantityConfig[NB_CNX_UE]; - struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID]; - MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID]; - uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells - RSRP_Range_t s_measure; - struct MeasConfig__speedStatePars *speedStatePars; - struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE]; - struct SPS_Config *sps_Config[NB_CNX_UE]; - MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE]; - MeasGapConfig_t *measGapConfig[NB_CNX_UE]; + LTE_MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; + struct LTE_ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; + struct LTE_QuantityConfig *QuantityConfig[NB_CNX_UE]; + struct LTE_MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID]; + MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID]; + uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells + LTE_RSRP_Range_t s_measure; + struct LTE_MeasConfig__speedStatePars *speedStatePars; + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE]; + struct LTE_SPS_Config *sps_Config[NB_CNX_UE]; + LTE_MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE]; + LTE_MeasGapConfig_t *measGapConfig[NB_CNX_UE]; double filter_coeff_rsrp; // [7] ??? double filter_coeff_rsrq; // [7] ??? float rsrp_db[7]; @@ -817,12 +819,12 @@ typedef struct UE_RRC_INST_s { #endif /* Used integrity/ciphering algorithms */ - CipheringAlgorithm_r12_t ciphering_algorithm; - e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + LTE_CipheringAlgorithm_r12_t ciphering_algorithm; + e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /// Used for Sidelink Preconfiguration - DRB_ToAddModList_t *DRB_configList; + LTE_DRB_ToAddModList_t *DRB_configList; #endif } UE_RRC_INST; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 00f814b8b1..cbce507341 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -44,29 +44,29 @@ #include "common/utils/LOG/log.h" #include "COMMON/mac_rrc_primitives.h" #include "RRC/LTE/MESSAGES/asn1_msg.h" -#include "RRCConnectionRequest.h" -#include "RRCConnectionReestablishmentRequest.h" +#include "LTE_RRCConnectionRequest.h" +#include "LTE_RRCConnectionReestablishmentRequest.h" //#include "ReestablishmentCause.h" -#include "BCCH-BCH-Message.h" -#include "UL-CCCH-Message.h" -#include "DL-CCCH-Message.h" -#include "UL-DCCH-Message.h" -#include "DL-DCCH-Message.h" -#include "TDD-Config.h" -#include "HandoverCommand.h" +#include "LTE_BCCH-BCH-Message.h" +#include "LTE_UL-CCCH-Message.h" +#include "LTE_DL-CCCH-Message.h" +#include "LTE_UL-DCCH-Message.h" +#include "LTE_DL-DCCH-Message.h" +#include "LTE_TDD-Config.h" +#include "LTE_HandoverCommand.h" #include "rlc.h" #include "rrc_eNB_UE_context.h" #include "platform_types.h" #include "msc.h" -#include "SL-CommConfig-r12.h" -#include "PeriodicBSR-Timer-r12.h" -#include "RetxBSR-Timer-r12.h" +#include "LTE_SL-CommConfig-r12.h" +#include "LTE_PeriodicBSR-Timer-r12.h" +#include "LTE_RetxBSR-Timer-r12.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "T.h" -//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "MeasResults.h" +//#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#include "LTE_MeasResults.h" //#endif #include "RRC/NAS/nas_config.h" @@ -75,29 +75,34 @@ #include "OCG_extern.h" #if defined(ENABLE_SECURITY) -# include "UTIL/OSA/osa_defs.h" + #include "UTIL/OSA/osa_defs.h" #endif #if defined(ENABLE_USE_MME) -# include "rrc_eNB_S1AP.h" -# include "rrc_eNB_GTPV1U.h" -# if defined(ENABLE_ITTI) -# else -# include "../../S1AP/s1ap_eNB.h" -# endif + #include "rrc_eNB_S1AP.h" + #include "rrc_eNB_GTPV1U.h" + #if defined(ENABLE_ITTI) + #else + #include "../../S1AP/s1ap_eNB.h" + #endif + /* temporary warning removale while implementing noS1 */ + /* as config option */ #else -# define EPC_MODE_ENABLED 0 + #ifdef EPC_MODE_ENABLED + #undef EPC_MODE_ENABLED + #endif + #define EPC_MODE_ENABLED 0 #endif #include "pdcp.h" #include "gtpv1u_eNB_task.h" #if defined(ENABLE_ITTI) -# include "intertask_interface.h" + #include "intertask_interface.h" #endif #if ENABLE_RAL -# include "rrc_eNB_ral.h" + #include "rrc_eNB_ral.h" #endif #include "SIMULATION/TOOLS/sim.h" // for taus @@ -106,13 +111,10 @@ extern RAN_CONTEXT_t RC; #ifdef PHY_EMUL -extern EMULATION_VARS *Emul_vars; + extern EMULATION_VARS *Emul_vars; #endif extern eNB_MAC_INST *eNB_mac_inst; extern UE_MAC_INST *UE_mac_inst; -#ifdef BIGPHYSAREA -extern void* bigphys_malloc(int); -#endif extern uint16_t two_tier_hexagonal_cellIds[7]; @@ -120,313 +122,297 @@ mui_t rrc_eNB_mui = 0; void openair_rrc_on( - const protocol_ctxt_t* const ctxt_pP + const protocol_ctxt_t *const ctxt_pP ) //----------------------------------------------------------------------------- { int CC_id; + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; - rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; - } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; + rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; + } } //----------------------------------------------------------------------------- static void init_SI( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const int CC_id #if defined(ENABLE_ITTI) , - RrcConfigurationReq * configuration + RrcConfigurationReq *configuration #endif ) //----------------------------------------------------------------------------- { -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) int i; #endif - -#if (RRC_VERSION >= MAKE_VERSION(13, 1, 0)) - SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL; +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 1, 0)) + LTE_SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL; #endif - LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t *) malloc16(4); // copy basic parameters RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id]; #endif - LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", - (int)configuration->N_RB_DL[CC_id], - (int)configuration->phich_resource[CC_id], - (int)configuration->phich_duration[CC_id]); + LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", + (int)configuration->N_RB_DL[CC_id], + (int)configuration->phich_resource[CC_id], + (int)configuration->phich_duration[CC_id]); do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], #ifdef ENABLE_ITTI - configuration->N_RB_DL[CC_id], - configuration->phich_resource[CC_id], - configuration->phich_duration[CC_id] + configuration->N_RB_DL[CC_id], + configuration->phich_resource[CC_id], + configuration->phich_duration[CC_id] #else - 50,0,0 + 50,0,0 #endif - ,0); - - + ,0); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); - + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t *) malloc16(32); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - + ); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t *) malloc16(64); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23( - ctxt_pP->module_id, - - CC_id + ctxt_pP->module_id, + CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - + ); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); - - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.n_SB); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.n_SB); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.hoppingMode); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.hoppingMode); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.pusch_HoppingOffset); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.pusch_HoppingOffset); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.enable64QAM); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.enable64QAM); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupHoppingEnabled); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.cyclicShift); - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) { for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) { // SIB 2 // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); } -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + // SIB13 for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); } + #endif - } - else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); + } else memset((void *)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); //TTN - SIB 18 for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count; j++) { - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - j+1, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); - + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + j+1, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); } //TTN - SIB 19 for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count; j++) { - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - j+1, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); - + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + j+1, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12); + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf); } #endif - LOG_D(RRC, - PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && + if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v8.9)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v9.2)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v11.3)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v12.5)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v13.10)\n"); - sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v8.9)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v9.2)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v11.3)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v12.5)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v13.10)\n"); + sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; } -#endif +#endif LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); - rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, #endif - 0, // rnti - (BCCH_BCH_Message_t *) - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, + 0, // rnti + (LTE_BCCH_BCH_Message_t *) + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, + (LTE_RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, #endif - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, - NULL, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, - (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, - (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + (LTE_MAC_MainConfig_t *) NULL, 0, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *) NULL, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, + NULL, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, + (LTE_MBSFN_SubframeConfigList_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, + (LTE_MBSFN_AreaInfoList_r9_t *) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, + (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - sib1_v13ext +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + sib1_v13ext #endif - ); + ); } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) /*------------------------------------------------------------------------------*/ static void init_MCCH( @@ -435,92 +421,81 @@ init_MCCH( ) //----------------------------------------------------------------------------- { - int sync_area = 0; // initialize RRC_eNB_INST MCCH entry RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE = - malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); + malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t *)); for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) { - RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); - AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] != NULL, - "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); + "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, - sync_area, - (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); - + sync_area, + (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); LOG_I(RRC, "mcch message pointer %p for sync area %d \n", - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - sync_area); + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + sync_area); LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %ld\n", enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); LOG_D(RRC, - "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", - enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", - enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. - choice.oneFrame.buf[0]); - + enb_mod_idP, + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. + choice.oneFrame.buf[0]); AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255, - "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); + "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1; } - //Set the RC.rrc[enb_mod_idP]->MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) - // ??Configure MCCH logical channel // call mac_config_req with appropriate structure from ASN.1 description - - // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); rrc_mac_config_req_eNB(enb_mod_idP, CC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - 0,//rnti - (BCCH_BCH_Message_t *)NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + 0,//rnti + (LTE_BCCH_BCH_Message_t *)NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - (struct PhysicalConfigDedicated *)NULL, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *)NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , - 0, - (MBSFN_AreaInfoList_r9_t *) NULL, - (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) + (LTE_MeasObjectToAddMod_t **) NULL, + (LTE_MAC_MainConfig_t *) NULL, + 0, + (struct LTE_LogicalChannelConfig *)NULL, + (LTE_MeasGapConfig_t *) NULL, + (LTE_TDD_Config_t *) NULL, + (LTE_MobilityControlInfo_t *)NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , + 0, + (LTE_MBSFN_AreaInfoList_r9_t *) NULL, + (LTE_PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); - } //----------------------------------------------------------------------------- @@ -536,34 +511,29 @@ static void init_MBMS( if (RC.rrc[enb_mod_idP]->carrier[CC_id].MBMS_flag > 0) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); - LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid // Configuring PDCP and RLC for MBMS Radio Bearer - rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList - (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList - (DRB_ToReleaseList_t *)NULL, + (LTE_SRB_ToAddModList_t *)NULL, // LTE_SRB_ToAddModList + (LTE_DRB_ToAddModList_t *)NULL, // LTE_DRB_ToAddModList + (LTE_DRB_ToReleaseList_t *)NULL, 0, // security mode NULL, // key rrc encryption NULL, // key rrc integrity NULL // key encryption -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) #endif ,NULL); - rrc_rlc_config_asn1_req(&ctxt, - NULL, // SRB_ToAddModList - NULL, // DRB_ToAddModList + NULL, // LTE_SRB_ToAddModList + NULL, // LTE_DRB_ToAddModList NULL, // DRB_ToReleaseList &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) - -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0, 0 #endif - ); - + ); //rrc_mac_config_req(); } } @@ -616,14 +586,14 @@ rrc_eNB_get_next_transaction_identifier( //----------------------------------------------------------------------------- // return the ue context if there is already an UE with ue_identityP, NULL otherwise -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_ue_context_random_exist( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint64_t ue_identityP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { if (ue_context_p->ue_context.random_ue_identity == ue_identityP) return ue_context_p; @@ -632,47 +602,47 @@ rrc_eNB_ue_context_random_exist( } //----------------------------------------------------------------------------- // return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_ue_context_stmsi_exist( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const mme_code_t mme_codeP, const m_tmsi_t m_tmsiP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", - m_tmsiP, mme_codeP, ue_context_p, - ue_context_p->ue_context.rnti); + m_tmsiP, mme_codeP, ue_context_p, + ue_context_p->ue_context.rnti); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { printf("=> S-TMSI %x, MME %x\n", - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) return ue_context_p; - } - else + } else printf("\n"); - } return NULL; } //----------------------------------------------------------------------------- // return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_get_next_free_ue_context( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint64_t ue_identityP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); if (ue_context_p == NULL) { ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); @@ -693,7 +663,6 @@ rrc_eNB_get_next_free_ue_context( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_context_p->local_uid); return ue_context_p; - } else { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", @@ -705,8 +674,8 @@ rrc_eNB_get_next_free_ue_context( //----------------------------------------------------------------------------- void rrc_eNB_free_mem_UE_context( - const protocol_ctxt_t* const ctxt_pP, - struct rrc_eNB_ue_context_s* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + struct rrc_eNB_ue_context_s *const ue_context_pP ) //----------------------------------------------------------------------------- { @@ -715,95 +684,96 @@ rrc_eNB_free_mem_UE_context( PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_context_pP); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); #endif if (ue_context_pP->ue_context.SRB_configList) { - ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); + ASN_STRUCT_FREE(asn_DEF_LTE_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); ue_context_pP->ue_context.SRB_configList = NULL; } - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.SRB_configList2[i]) { - free(ue_context_pP->ue_context.SRB_configList2[i]); - ue_context_pP->ue_context.SRB_configList2[i] = NULL; - } + for(i = 0; i < RRC_TRANSACTION_IDENTIFIER_NUMBER; i++) { + if (ue_context_pP->ue_context.SRB_configList2[i]) { + free(ue_context_pP->ue_context.SRB_configList2[i]); + ue_context_pP->ue_context.SRB_configList2[i] = NULL; + } } if (ue_context_pP->ue_context.DRB_configList) { - ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); + ASN_STRUCT_FREE(asn_DEF_LTE_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); ue_context_pP->ue_context.DRB_configList = NULL; } - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.DRB_configList2[i]) { - free(ue_context_pP->ue_context.DRB_configList2[i]); - ue_context_pP->ue_context.DRB_configList2[i] = NULL; - } - if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { - free(ue_context_pP->ue_context.DRB_Release_configList2[i]); - ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; - } + for(i = 0; i < RRC_TRANSACTION_IDENTIFIER_NUMBER; i++) { + if (ue_context_pP->ue_context.DRB_configList2[i]) { + free(ue_context_pP->ue_context.DRB_configList2[i]); + ue_context_pP->ue_context.DRB_configList2[i] = NULL; + } + + if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { + free(ue_context_pP->ue_context.DRB_Release_configList2[i]); + ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; + } } memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); if (ue_context_pP->ue_context.physicalConfigDedicated) { - ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); + ASN_STRUCT_FREE(asn_DEF_LTE_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); ue_context_pP->ue_context.physicalConfigDedicated = NULL; } if (ue_context_pP->ue_context.sps_Config) { - ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config); + ASN_STRUCT_FREE(asn_DEF_LTE_SPS_Config, ue_context_pP->ue_context.sps_Config); ue_context_pP->ue_context.sps_Config = NULL; } for (i=0; i < MAX_MEAS_OBJ; i++) { if (ue_context_pP->ue_context.MeasObj[i] != NULL) { - ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); + ASN_STRUCT_FREE(asn_DEF_LTE_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); ue_context_pP->ue_context.MeasObj[i] = NULL; } } for (i=0; i < MAX_MEAS_CONFIG; i++) { if (ue_context_pP->ue_context.ReportConfig[i] != NULL) { - ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); + ASN_STRUCT_FREE(asn_DEF_LTE_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); ue_context_pP->ue_context.ReportConfig[i] = NULL; } } if (ue_context_pP->ue_context.QuantityConfig) { - ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); + ASN_STRUCT_FREE(asn_DEF_LTE_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); ue_context_pP->ue_context.QuantityConfig = NULL; } if (ue_context_pP->ue_context.mac_MainConfig) { - ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); + ASN_STRUCT_FREE(asn_DEF_LTE_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); ue_context_pP->ue_context.mac_MainConfig = NULL; } -/* if (ue_context_pP->ue_context.measGapConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); - ue_context_pP->ue_context.measGapConfig = NULL; - }*/ - if (ue_context_pP->ue_context.handover_info) { - ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info); - ue_context_pP->ue_context.handover_info = NULL; - } + /* if (ue_context_pP->ue_context.measGapConfig) { + ASN_STRUCT_FREE(asn_DEF_LTE_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); + ue_context_pP->ue_context.measGapConfig = NULL; + }*/ + if (ue_context_pP->ue_context.handover_info) { + ASN_STRUCT_FREE(asn_DEF_LTE_Handover, ue_context_pP->ue_context.handover_info); + ue_context_pP->ue_context.handover_info = NULL; + } //SRB_INFO SI; //SRB_INFO Srb0; //SRB_INFO_TABLE_ENTRY Srb1; //SRB_INFO_TABLE_ENTRY Srb2; if (ue_context_pP->ue_context.measConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ASN_STRUCT_FREE(asn_DEF_LTE_MeasConfig, ue_context_pP->ue_context.measConfig); ue_context_pP->ue_context.measConfig = NULL; } if (ue_context_pP->ue_context.measConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ASN_STRUCT_FREE(asn_DEF_LTE_MeasConfig, ue_context_pP->ue_context.measConfig); ue_context_pP->ue_context.measConfig = NULL; } @@ -832,240 +802,256 @@ rrc_eNB_free_mem_UE_context( } //----------------------------------------------------------------------------- -// should be called when UE is lost by eNB +/* +* Should be called when UE context in eNB should be released +* or when S1 command UE_CONTEXT_RELEASE_REQ should be sent +*/ void -rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) +rrc_eNB_free_UE( + const module_id_t enb_mod_idP, + const struct rrc_eNB_ue_context_s *const ue_context_pP) //----------------------------------------------------------------------------- { - - - protocol_ctxt_t ctxt; rnti_t rnti = ue_context_pP->ue_context.rnti; + if (enb_mod_idP >= NB_eNB_INST) { - LOG_I(RRC, "eNB inst invalid (%d/%d) for UE %x!\n",enb_mod_idP, NB_eNB_INST,rnti); - return; + LOG_E(RRC, "eNB instance invalid (%d/%d) for UE %x!\n", + enb_mod_idP, + NB_eNB_INST, + rnti); + return; } - /* ue_context_p = rrc_eNB_get_ue_context( - &RC.rrc[enb_mod_idP], - rntiP - ); - */ - if (NULL != ue_context_pP) { - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); - LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); - if(EPC_MODE_ENABLED) { - - if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && - (mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) { - LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost + if (EPC_MODE_ENABLED) { + if ((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) { + LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n", + enb_mod_idP, + rnti); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); + // send cause 21: radio connection with ue lost /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) - * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before - * triggering the S1 UE Context Release Request procedure - * in order to allow the UE to perform the NAS recovery - * procedure, see TS 23.401 [17]. - */ - return; + * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before + * triggering the S1 UE Context Release Request procedure in order to allow the UE to perform the NAS recovery + * procedure, see TS 23.401 [17]. + */ + return; + } + + if((ue_context_pP->ue_context.ue_rrc_inactivity_timer >= RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres) && + (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED) && + (RC.rrc[enb_mod_idP]->configuration.rrc_inactivity_timer_thres > 0)) { + LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 20, user inactivity\n", + enb_mod_idP, + rnti); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 20); + // send cause 20: user inactivity + return; } } - // add UE info to freeList - LOG_I(RRC, "put UE %x into freeList\n", rnti); - put_UE_in_freelist(enb_mod_idP, rnti, 1); + + LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", + enb_mod_idP, + rnti); + // add UE info to freeList + LOG_I(RRC, "Put UE %x into freeList\n", + rnti); + put_UE_in_freelist(enb_mod_idP, rnti, 1); +} + +void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti) { + eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; + pthread_mutex_lock(&lock_ue_freelist); + UE_free_list_t *free_list = &eNB_MAC->UE_free_list; + free_list->UE_free_ctrl[free_list->head_freelist].rnti = 0; + free_list->head_freelist = (free_list->head_freelist + 1) % (NUMBER_OF_UE_MAX+1); + free_list->num_UEs--; + pthread_mutex_unlock(&lock_ue_freelist); +} + +void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) { + UE_free_list_t *free_list = NULL; + eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; + pthread_mutex_lock(&lock_ue_freelist); + free_list = &eNB_MAC->UE_free_list; + free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti; + free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag; + free_list->num_UEs++; + free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1); + pthread_mutex_unlock(&lock_ue_freelist); +} + +void release_UE_in_freeList(module_id_t mod_id) { + int i, j, CC_id, pdu_number; + protocol_ctxt_t ctxt; + LTE_eNB_ULSCH_t *ulsch = NULL; + LTE_eNB_DLSCH_t *dlsch = NULL; + nfapi_ul_config_request_body_t *ul_req_tmp = NULL; + PHY_VARS_eNB *eNB_PHY = NULL; + struct rrc_eNB_ue_context_s *ue_context_pP = NULL; + eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; + boolean_t remove_UEContext; + rnti_t rnti; + int head, tail, ue_num; + pthread_mutex_lock(&lock_ue_freelist); + head = eNB_MAC->UE_free_list.head_freelist; + tail = eNB_MAC->UE_free_list.tail_freelist; + + if(head == tail) { + pthread_mutex_unlock(&lock_ue_freelist); + return; } -} -void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti) -{ + if(tail < head) { + tail = head + eNB_MAC->UE_free_list.num_UEs; + } - eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; - pthread_mutex_lock(&lock_ue_freelist); - UE_free_list_t *free_list = &eNB_MAC->UE_free_list; - free_list->UE_free_ctrl[free_list->head_freelist].rnti = 0; - free_list->head_freelist = (free_list->head_freelist + 1) % (NUMBER_OF_UE_MAX+1); - free_list->num_UEs--; - pthread_mutex_unlock(&lock_ue_freelist); -} + pthread_mutex_unlock(&lock_ue_freelist); -void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag) -{ - UE_free_list_t *free_list = NULL; - eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; - pthread_mutex_lock(&lock_ue_freelist); - free_list = &eNB_MAC->UE_free_list; - free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti; - free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag; - free_list->num_UEs++; - free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1); - pthread_mutex_unlock(&lock_ue_freelist); -} + for(ue_num = head; ue_num < tail; ue_num++) { + ue_num = ue_num % (NUMBER_OF_UE_MAX+1); + rnti = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].rnti; -void release_UE_in_freeList(module_id_t mod_id) -{ - int i, j , CC_id, pdu_number; - protocol_ctxt_t ctxt; - LTE_eNB_ULSCH_t *ulsch = NULL; - LTE_eNB_DLSCH_t *dlsch = NULL; - nfapi_ul_config_request_body_t *ul_req_tmp = NULL; - PHY_VARS_eNB *eNB_PHY = NULL; - struct rrc_eNB_ue_context_s *ue_context_pP = NULL; - eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; - boolean_t remove_UEContext; - rnti_t rnti; - int head, tail, ue_num; + if(rnti != 0) { + remove_UEContext = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].removeContextFlg; + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, rnti, 0, 0,mod_id); - pthread_mutex_lock(&lock_ue_freelist); - head = eNB_MAC->UE_free_list.head_freelist; - tail = eNB_MAC->UE_free_list.tail_freelist; - if(head == tail){ - pthread_mutex_unlock(&lock_ue_freelist); - return; - } - if(tail < head){ - tail = head + eNB_MAC->UE_free_list.num_UEs; - } - pthread_mutex_unlock(&lock_ue_freelist); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + eNB_PHY = RC.eNB[mod_id][CC_id]; - for(ue_num = head; ue_num < tail; ue_num++){ - ue_num = ue_num % (NUMBER_OF_UE_MAX+1); - rnti = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].rnti; - if(rnti != 0){ - remove_UEContext = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].removeContextFlg; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, rnti, 0, 0,mod_id); - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - eNB_PHY = RC.eNB[mod_id][CC_id]; - for (i=0; iulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ - void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); - LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti); - clean_eNb_ulsch(ulsch); - } - if(eNB_PHY->uci_vars[i].rnti == rnti){ - LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti); - memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); - } - } - for (i=0; idlsch[i][0]; - if((dlsch != NULL) && (dlsch->rnti == rnti)){ - void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - LOG_I(RRC, "clean_eNb_dlsch dlsch[%d] UE %x \n", i, rnti); - clean_eNb_dlsch(dlsch); - } - } + for (i=0; iulsch[i]; - if (rrc_agent_registered[mod_id]) { - agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change(mod_id, - rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } + if((ulsch != NULL) && (ulsch->rnti == rnti)) { + void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); + LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti); + clean_eNb_ulsch(ulsch); + } - for(j = 0; j < 10; j++){ - ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ - pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if((ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) || - (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) || - (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti) || - (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti) || - (ul_req_tmp->ul_config_pdu_list[pdu_index].srs_pdu.srs_pdu_rel8.rnti == rnti)){ - LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ - memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); - } - ul_req_tmp->number_of_pdus--; - } - } - } - } - } - rrc_mac_remove_ue(mod_id,rnti); - rrc_rlc_remove_ue(&ctxt); - pdcp_remove_UE(&ctxt); - - if(remove_UEContext){ - ue_context_pP = rrc_eNB_get_ue_context( - RC.rrc[mod_id],rnti); - if(ue_context_pP){ - rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id], - (struct rrc_eNB_ue_context_s*) ue_context_pP); - } - } - LOG_I(RRC, "[release_UE_in_freeList] remove UE %x from freeList\n", rnti); - remove_UE_from_freelist(mod_id, rnti); + if(eNB_PHY->uci_vars[i].rnti == rnti) { + LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti); + memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); + } } + + for (i=0; idlsch[i][0]; + + if((dlsch != NULL) && (dlsch->rnti == rnti)) { + void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); + LOG_I(RRC, "clean_eNb_dlsch dlsch[%d] UE %x \n", i, rnti); + clean_eNb_dlsch(dlsch); + } + } + + if (rrc_agent_registered[mod_id]) { + agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change(mod_id, + rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } + + for(j = 0; j < 10; j++) { + ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; + + if(ul_req_tmp) { + pdu_number = ul_req_tmp->number_of_pdus; + + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--) { + if((ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) || + (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) || + (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti) || + (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti) || + (ul_req_tmp->ul_config_pdu_list[pdu_index].srs_pdu.srs_pdu_rel8.rnti == rnti)) { + LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); + + if(pdu_index < pdu_number -1) { + memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + } + + ul_req_tmp->number_of_pdus--; + } + } + } + } + } + + rrc_mac_remove_ue(mod_id,rnti); + rrc_rlc_remove_ue(&ctxt); + pdcp_remove_UE(&ctxt); + + if(remove_UEContext) { + ue_context_pP = rrc_eNB_get_ue_context( + RC.rrc[mod_id],rnti); + + if(ue_context_pP) { + rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id], + (struct rrc_eNB_ue_context_s *) ue_context_pP); + } + } + + LOG_I(RRC, "[release_UE_in_freeList] remove UE %x from freeList\n", rnti); + remove_UE_from_freelist(mod_id, rnti); } + } } //----------------------------------------------------------------------------- +/* +* Process the rrc connection setup complete message from UE (SRB1 Active) +*/ void rrc_eNB_process_RRCConnectionSetupComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, + LTE_RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete ) //----------------------------------------------------------------------------- { LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - ue_context_pP->ue_context.Srb1.Active=1; + ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Status = RRC_CONNECTED; + ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); if (EPC_MODE_ENABLED == 1) { // Forward message to S1AP layer - rrc_eNB_send_S1AP_NAS_FIRST_REQ( - ctxt_pP, - ue_context_pP, - rrcConnectionSetupComplete); + rrc_eNB_send_S1AP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcConnectionSetupComplete); } else { // RRC loop back (no S1AP), send SecurityModeCommand to UE - rrc_eNB_generate_SecurityModeCommand( - ctxt_pP, - ue_context_pP); - // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + rrc_eNB_generate_SecurityModeCommand(ctxt_pP, ue_context_pP); } } //----------------------------------------------------------------------------- void rrc_eNB_generate_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - size = do_SecurityModeCommand( ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), ue_context_pP->ue_context.ciphering_algorithm, ue_context_pP->ue_context.integrity_algorithm); - - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Security Mode Command\n"); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1076,50 +1062,42 @@ rrc_eNB_generate_SecurityModeCommand( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void rrc_eNB_generate_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { - uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - size = do_UECapabilityEnquiry( ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1130,52 +1108,45 @@ rrc_eNB_generate_UECapabilityEnquiry( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- { - T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); LOG_DUMPMSG(RRC,DEBUG_RRC, (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReject\n"); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReject UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); } @@ -1183,26 +1154,24 @@ rrc_eNB_generate_RRCConnectionReject( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- { - LogicalChannelConfig_t *SRB1_logicalChannelConfig; - SRB_ToAddModList_t **SRB_configList; - SRB_ToAddMod_t *SRB1_config; + LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig; + LTE_SRB_ToAddModList_t **SRB_configList; + LTE_SRB_ToAddMod_t *SRB1_config; int cnt; - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishment(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, @@ -1211,7 +1180,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReestablishment\n" - ); + ); // configure SRB1 for UE if (*SRB_configList != NULL) { @@ -1221,7 +1190,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( if (SRB1_config->logicalChannelConfig) { if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; } else { SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; @@ -1234,38 +1203,38 @@ rrc_eNB_generate_RRCConnectionReestablishment( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ctxt_pP->rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + ctxt_pP->rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (struct LTE_PhysicalConfigDedicated * ) ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - ,(SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + ,(LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); break; } } @@ -1275,439 +1244,398 @@ rrc_eNB_generate_RRCConnectionReestablishment( MSC_RRC_UE, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishment UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id != -1){ + + if(UE_id != -1) { // activate release timer, if RRCComplete not received after 100 frames, remove UE RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + // remove UE after 100 frames after LTE_RRCConnectionReestablishmentRelease is triggered RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000; - }else{ + } else { LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Generating RRCConnectionReestablishment without UE_id(MAC) rnti %x\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishment without UE_id(MAC) rnti %x\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); } + // activate release timer, if RRCComplete not received after 100 frames, remove UE ue_context_pP->ue_context.ue_reestablishment_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + // remove UE after 100 frames after LTE_RRCConnectionReestablishmentRelease is triggered ue_context_pP->ue_context.ue_reestablishment_timer_thres = 1000; } //----------------------------------------------------------------------------- void rrc_eNB_process_RRCConnectionReestablishmentComplete( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const rnti_t reestablish_rnti, - rrc_eNB_ue_context_t* ue_context_pP, + rrc_eNB_ue_context_t *ue_context_pP, const uint8_t xid, - RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete + LTE_RRCConnectionReestablishmentComplete_r8_IEs_t *LTE_RRCConnectionReestablishmentComplete ) //----------------------------------------------------------------------------- { LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing LTE_RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t** SRB_configList2 = NULL; - DRB_ToAddModList_t** DRB_configList2 = NULL; - struct SRB_ToAddMod *SRB2_config = NULL; - struct DRB_ToAddMod *DRB_config = NULL; + LTE_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; + LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; + LTE_DRB_ToAddModList_t **DRB_configList2 = NULL; + struct LTE_SRB_ToAddMod *SRB2_config = NULL; + struct LTE_DRB_ToAddMod *DRB_config = NULL; int i = 0; uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + LTE_MeasObjectToAddModList_t *MeasObj_list = NULL; + LTE_MeasObjectToAddMod_t *MeasObj = NULL; + LTE_ReportConfigToAddModList_t *ReportConfig_list = NULL; + LTE_ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + LTE_MeasIdToAddModList_t *MeasId_list = NULL; + LTE_MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + LTE_RSRP_Range_t *rsrp = NULL; + struct LTE_MeasConfig__speedStatePars *Sparams = NULL; + LTE_QuantityConfig_t *quantityConfig = NULL; + LTE_CellsToAddMod_t *CellToAdd = NULL; + LTE_CellsToAddModList_t *CellsToAddModList = NULL; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - C_RNTI_t *cba_RNTI = NULL; + LTE_C_RNTI_t *cba_RNTI = NULL; uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); - ue_context_pP->ue_context.Status = RRC_CONNECTED; + ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED ue_context_pP->ue_context.reestablishment_xid = next_xid; - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; + // get old configuration of SRB2 if (*SRB_configList2 != NULL) { - if((*SRB_configList2)->list.count!=0){ + if((*SRB_configList2)->list.count!=0) { LOG_D(RRC, "SRB_configList2(%p) count is %d\n SRB_configList2->list.array[0] addr is %p", - SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]); + SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]); } + for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) { - if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){ + if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ) { LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid); SRB2_config = (*SRB_configList2)->list.array[i]; break; } } } + SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid]; DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid]; - if(SRB_configList2!=NULL){ + if(SRB_configList2!=NULL) { if (*SRB_configList2) { free(*SRB_configList2); LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); } - }else{ - LOG_E(RRC, "SRB_configList2 is null\n"); + } else { + LOG_E(RRC, "SRB_configList2 is null\n"); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + if (SRB2_config != NULL) { // Add SRB2 to SRB configuration list - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n", - SRB2_config->srb_Identity); + SRB2_config->srb_Identity); LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n", - SRB2_config->srb_Identity, next_xid); + SRB2_config->srb_Identity, next_xid); } else { // SRB configuration list only contains SRB1. LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n"); } - - - if(DRB_configList2!=NULL){ + if(DRB_configList2!=NULL) { if (*DRB_configList2) { free(*DRB_configList2); LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); } - }else{ - LOG_E(RRC, "DRB_configList2 is null\n"); + } else { + LOG_E(RRC, "DRB_configList2 is null\n"); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); if (DRB_configList != NULL) { LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n"); + for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) { DRB_config = DRB_configList->list.array[i]; - - // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete + // Add DRB to DRB configuration list, for LTE_RRCConnectionReconfigurationComplete ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); } } + ue_context_pP->ue_context.Srb1.Active = 1; //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; +#if defined(ENABLE_USE_MME) + hashtable_rc_t h_rc; + int j; + rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL; + uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id; + uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; + eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]; -#if defined(ENABLE_USE_MME) - hashtable_rc_t h_rc; - int j; - rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; - uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id; - uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]; - if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p); - if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - } + if (eNB_ue_s1ap_id > 0) { + h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&rrc_ue_s1ap_ids_p); + + if (h_rc == HASH_TABLE_OK) { + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; } - if (ue_initial_id != 0) { - h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p); - if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - } + } + + if (ue_initial_id != 0) { + h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_s1ap_ids_p); + + if (h_rc == HASH_TABLE_OK) { + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; } + } - gtpv1u_enb_create_tunnel_req_t create_tunnel_req; + gtpv1u_enb_create_tunnel_req_t create_tunnel_req; + /* Save e RAB information for later */ + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); - /* Save e RAB information for later */ - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); - - for ( j = 0, i = 0; i < NB_RB_MAX; i++) { - if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED || ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_DONE) { - create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - - memcpy(&create_tunnel_req.sgw_addr[j], - &ue_context_pP->ue_context.e_rab[i].param.sgw_addr, - sizeof(transport_layer_addr_t)); - j++; - } + for ( j = 0, i = 0; i < NB_RB_MAX; i++) { + if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED || ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_DONE) { + create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + memcpy(&create_tunnel_req.sgw_addr[j], + &ue_context_pP->ue_context.e_rab[i].param.sgw_addr, + sizeof(transport_layer_addr_t)); + j++; } + } - create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above - create_tunnel_req.num_tunnels = j; - - gtpv1u_update_s1u_tunnel( - ctxt_pP->instance, - &create_tunnel_req, - reestablish_rnti); + create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above + create_tunnel_req.num_tunnels = j; + gtpv1u_update_s1u_tunnel( + ctxt_pP->instance, + &create_tunnel_req, + reestablish_rnti); #endif /* Update RNTI in ue_context */ ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else ue_context_pP->ue_context.rnti = ctxt_pP->rnti; #if defined(ENABLE_USE_MME) - uint8_t send_security_mode_command = FALSE; - rrc_pdcp_config_security( - ctxt_pP, - ue_context_pP, - send_security_mode_command); - LOG_D(RRC, "set security successfully \n"); + uint8_t send_security_mode_command = FALSE; + rrc_pdcp_config_security( + ctxt_pP, + ue_context_pP, + send_security_mode_command); + LOG_D(RRC, "set security successfully \n"); #endif // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - + (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - + CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0; ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; + LTE_ReportConfigEUTRA__triggerType_PR_periodical; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + a1_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) { LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", ctxt_pP->module_id, ctxt_pP->frame); ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA2.a2_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA2.a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = - TimeToTrigger_ms40; + LTE_TimeToTrigger_ms40; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA4.a4_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA4.a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold1.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold2.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + rsrp = CALLOC(1, sizeof(LTE_RSRP_Range_t)); *rsrp = 20; - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->present = LTE_MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = LTE_SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = LTE_SpeedStateScaleFactors__sf_High_oDot5; Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120; quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA)); memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); quantityConfig->quantityConfigCDMA2000 = NULL; quantityConfig->quantityConfigGERAN = NULL; @@ -1716,37 +1644,35 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4; LOG_I(RRC, "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", ctxt_pP->module_id, ctxt_pP->frame); // store the information in an intermediate structure for Hanodver management //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(LTE_SRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(LTE_DRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = DRB_configList; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(LTE_MAC_MainConfig_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = - CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + CALLOC(1, sizeof(LTE_PhysicalConfigDedicated_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(LTE_PhysicalConfigDedicated_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - } #ifdef CBA //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t)); cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); cba_RNTI->buf = cba_RNTI_buf; cba_RNTI->size = 2; @@ -1768,20 +1694,19 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - #if defined(ENABLE_ITTI) /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); /* Add all NAS PDUs to the list */ for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i); + LOG_D(RRC, "Add LTE_DedicatedInfoNAS(%d) to LTE_DedicatedInfoNASList\n", i); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); } @@ -1791,11 +1716,10 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -1805,43 +1729,39 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - - // send RRCConnectionReconfiguration + // send LTE_RRCConnectionReconfiguration memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, next_xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // maybe ue_context_pP->ue_context.sps_Config, - (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated, + (LTE_SRB_ToAddModList_t *)*SRB_configList2, // SRB_configList + (LTE_DRB_ToAddModList_t *)DRB_configList, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // maybe ue_context_pP->ue_context.sps_Config, + (struct LTE_PhysicalConfigDedicated *)ue_context_pP->ue_context.physicalConfigDedicated, #ifdef EXMIMO_IOT NULL, NULL, NULL,NULL, #else - (MeasObjectToAddModList_t*)MeasObj_list, // MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, // ReportConfig_list, - (QuantityConfig_t*)quantityConfig, //quantityConfig, - (MeasIdToAddModList_t*)NULL, + (LTE_MeasObjectToAddModList_t *)MeasObj_list, // MeasObj_list, + (LTE_ReportConfigToAddModList_t *)ReportConfig_list, // ReportConfig_list, + (LTE_QuantityConfig_t *)quantityConfig, //quantityConfig, + (LTE_MeasIdToAddModList_t *)NULL, #endif - (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, // Sparams, - (RSRP_Range_t*)rsrp, // rsrp, - (C_RNTI_t*)cba_RNTI, // cba_RNTI - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, //dedicatedInfoNASList - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + (LTE_MAC_MainConfig_t *)ue_context_pP->ue_context.mac_MainConfig, + (LTE_MeasGapConfig_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, + (struct LTE_MeasConfig__speedStatePars *)Sparams, // Sparams, + (LTE_RSRP_Range_t *)rsrp, // rsrp, + (LTE_C_RNTI_t *)cba_RNTI, // cba_RNTI + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, //dedicatedInfoNASList + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif ); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Connection Reconfiguration\n"); - - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -1854,78 +1774,77 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - if(size==65535){ + + if(size==65535) { LOG_E(RRC,"RRC decode err!!! do_RRCConnectionReconfiguration\n"); put_UE_in_freelist(ctxt_pP->module_id, reestablish_rnti, 0); return; - }else{ + } else { LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } + // delete UE data of prior RNTI. UE use current RNTI. -// protocol_ctxt_t ctxt_prior = *ctxt_pP; -// ctxt_prior.rnti = reestablish_rnti; -// -// LTE_eNB_ULSCH_t *ulsch = NULL; -// nfapi_ul_config_request_body_t *ul_req_tmp = NULL; -// PHY_VARS_eNB *eNB_PHY = NULL; -// eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; -// for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { -// eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; -// for (int i=0; iulsch[i]; -// if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ -// void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); -// LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); -// clean_eNb_ulsch(ulsch); -// break; -// } -// } -// -// for(int j = 0; j < 10; j++){ -// ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; -// if(ul_req_tmp){ -// int pdu_number = ul_req_tmp->number_of_pdus; -// for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ -// if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){ -// LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number); -// if(pdu_index < pdu_number -1){ -// memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); -// } -// ul_req_tmp->number_of_pdus--; -// } -// } -// } -// } -// } -// rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti); -// rrc_rlc_remove_ue(&ctxt_prior); -// pdcp_remove_UE(&ctxt_prior); + // protocol_ctxt_t ctxt_prior = *ctxt_pP; + // ctxt_prior.rnti = reestablish_rnti; + // + // LTE_eNB_ULSCH_t *ulsch = NULL; + // nfapi_ul_config_request_body_t *ul_req_tmp = NULL; + // PHY_VARS_eNB *eNB_PHY = NULL; + // eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; + // for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + // eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; + // for (int i=0; iulsch[i]; + // if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ + // void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); + // LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); + // clean_eNb_ulsch(ulsch); + // break; + // } + // } + // + // for(int j = 0; j < 10; j++){ + // ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; + // if(ul_req_tmp){ + // int pdu_number = ul_req_tmp->number_of_pdus; + // for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ + // if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){ + // LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number); + // if(pdu_index < pdu_number -1){ + // memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + // } + // ul_req_tmp->number_of_pdus--; + // } + // } + // } + // } + // } + // rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti); + // rrc_rlc_remove_ue(&ctxt_prior); + // pdcp_remove_UE(&ctxt_prior); // add UE info to freeList for RU_thread to remove the UE instead of remove it here LOG_I(RRC, "[RRCConnectionReestablishment]put UE %x into freeList\n", reestablish_rnti); put_UE_in_freelist(ctxt_pP->module_id, reestablish_rnti, 0); @@ -1934,332 +1853,305 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReestablishmentReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id != -1){ + + if(UE_id != -1) { RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20; - }else{ + } else { LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Generating RRCConnectionReestablishmentReject without UE_id(MAC) rnti %x\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + PROTOCOL_RRC_CTXT_UE_FMT" Generating LTE_RRCConnectionReestablishmentReject without UE_id(MAC) rnti %x\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); } T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); LOG_DUMPMSG(RRC,DEBUG_RRC, (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReestablishmentReject\n"); - - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishmentReject UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishmentReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); } //----------------------------------------------------------------------------- +/* +* Generate the RRC Connection Release to UE. +* If received, UE should switch to RRC_IDLE mode. +*/ void rrc_eNB_generate_RRCConnectionRelease( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { - - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size = 0; + memset(buffer, 0, RRC_BUF_SIZE); T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - memset(buffer, 0, RRC_BUF_SIZE); size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); - // set release timer - //ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - //ue_context_pP->ue_context.ue_release_timer_thres=100; - // set release timer -// ue_context_pP->ue_context.ue_release_timer_rrc = 1; - // remove UE after 10 frames after RRCConnectionRelease is triggered -// ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100; ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_release_timer = 0; - //ue_context_pP->ue_context.ue_release_timer_s1 = 0; + ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionRelease UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); pthread_mutex_lock(&rrc_release_freelist); - for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 0){ - if(ue_context_pP->ue_context.ue_release_timer_s1 > 0){ + + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_pP->ue_context.ue_release_timer_s1 > 0) { rrc_release_info.RRC_release_ctrl[release_num].flag = 1; - }else{ + } else { rrc_release_info.RRC_release_ctrl[release_num].flag = 2; } + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rnti; rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = rrc_eNB_mui; rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt_pP->rnti, rrc_eNB_mui,rrc_release_info.RRC_release_ctrl[release_num].flag); + LOG_D(RRC, "Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n", + release_num, + ctxt_pP->rnti, + rrc_eNB_mui, + rrc_release_info.RRC_release_ctrl[release_num].flag); break; } } + pthread_mutex_unlock(&rrc_release_freelist); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + rrc_data_req(ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } -uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; +uint8_t qci_to_priority[9]= {2,4,3,5,1,6,7,8,9}; // TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context -#if defined(ENABLE_ITTI) +#if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters + struct LTE_DRB_ToAddMod *DRB_config = NULL; + struct LTE_RLC_Config *DRB_rlc_config = NULL; + struct LTE_PDCP_Config *DRB_pdcp_config = NULL; + struct LTE_PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL; - // DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList=ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2=NULL; + // LTE_DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; + LTE_DRB_ToAddModList_t *DRB_configList=ue_context_pP->ue_context.DRB_configList; + LTE_DRB_ToAddModList_t **DRB_configList2=NULL; //DRB_ToAddModList_t** RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList; - - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - long *logicalchannelgroup_drb; -// int drb_identity_index=0; - + // int drb_identity_index=0; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); int e_rab_done=0; - - for ( i = 0 ; - i < ue_context_pP->ue_context.setup_e_rabs ; - i++){ - if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){ - break; + for ( i = 0 ; + i < ue_context_pP->ue_context.setup_e_rabs ; + i++) { + if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs) { + break; } - + // bypass the new and already configured erabs if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) { -// drb_identity_index++; + // drb_identity_index++; continue; } - - DRB_config = CALLOC(1, sizeof(*DRB_config)); + DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); // allowed value 5..15, value : x+4 - *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation - - // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - // 1 + drb_identiy_index; + *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation + // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (LTE_DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + // 1 + drb_identiy_index; DRB_config->drb_Identity = i+1; - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - - switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){ + switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci) { /* * type: realtime data with medium packer error rate * action: swtich to RLC UM */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; - + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; + // PDCP + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + /* * type: non-realtime data with low packer error rate * action: swtich to RLC AM */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = LTE_RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25; + // PDCP + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + break; - // PDCP - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; - - break; - default : - LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.e_rab[i].xid = xid; - e_rab_done++; - continue; + default : + LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.e_rab[i].xid = xid; + e_rab_done++; + continue; } - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 ) - DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; + DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level; - else + else DRB_ul_SpecificParameters->priority= 4; - DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1;//(i+1) % 3; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList); - LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); e_rab_done++; - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; ue_context_pP->ue_context.e_rab[i].xid = xid; - { if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); - } - else { - LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); + } else { + LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); } + /* TODO parameters yet to process ... */ { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } } - } /* If list is empty free the list and reset the address */ @@ -2268,33 +2160,29 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co free(dedicatedInfoNASList); dedicatedInfoNASList = NULL; LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); - } + } } else { LOG_W(RRC,"dedlicated NAS list is empty\n"); } memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)*DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + (LTE_SRB_ToAddModList_t *)NULL, + (LTE_DRB_ToAddModList_t *)*DRB_configList2, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif ); - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Connection Reconfiguration\n"); - - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -2305,27 +2193,24 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; } } + #endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2334,40 +2219,35 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - - } int -rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i, j; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList2 = NULL; - - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + struct LTE_DRB_ToAddMod *DRB_config = NULL; + struct LTE_RLC_Config *DRB_rlc_config = NULL; + struct LTE_PDCP_Config *DRB_pdcp_config = NULL; + struct LTE_PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + LTE_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList; + LTE_DRB_ToAddModList_t *DRB_configList2 = NULL; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); // Transaction_id, DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) { // bypass the new and already configured erabs @@ -2384,6 +2264,7 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } DRB_config = NULL; + // search exist DRB_config for (j = 0; j < DRB_configList->list.count; j++) { if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) { @@ -2391,6 +2272,7 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons break; } } + if (NULL == DRB_config) { ue_context_pP->ue_context.modify_e_rab[i].xid = xid; ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; @@ -2402,85 +2284,89 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } DRB_rlc_config = DRB_config->rlc_Config; - DRB_pdcp_config = DRB_config->pdcp_Config; - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; + switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) { - /* - * type: realtime data with medium packer error rate - * action: swtich to RLC UM - */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; + /* + * type: realtime data with medium packer error rate + * action: swtich to RLC UM + */ + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; - /* - * type: non-realtime data with low packer error rate - * action: swtich to RLC AM - */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } - break; - default : - LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; - ue_context_pP->ue_context.nb_of_failed_e_rabs++; - continue; + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + + /* + * type: non-realtime data with low packer error rate + * action: swtich to RLC AM + */ + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = LTE_RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25; + + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } + + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } + + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + break; + + default : + LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; + ue_context_pP->ue_context.nb_of_failed_e_rabs++; + continue; } - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; DRB_lchan_config = DRB_config->logicalChannelConfig; DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters; @@ -2489,37 +2375,31 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons else DRB_ul_SpecificParameters->priority= 4; - DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - + DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config); - LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); //e_rab_done++; ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE; ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - { if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); + (char *)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i); - } - else { + } else { LOG_W(RRC, "Not received activate dedicated EPS bearer context request\n"); } } @@ -2537,27 +2417,24 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + (LTE_SRB_ToAddModList_t *)NULL, + (LTE_DRB_ToAddModList_t *)DRB_configList2, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif - ); - + ); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Connection Reconfiguration\n"); - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -2568,27 +2445,24 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL; } } + #endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2602,107 +2476,105 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons //----------------------------------------------------------------------------- void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid, - uint32_t nas_length, - uint8_t* nas_buffer) +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid, + uint32_t nas_length, + uint8_t *nas_buffer) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; - int i; - uint16_t size = 0; - DRB_ToReleaseList_t** DRB_Release_configList2=NULL; - DRB_Identity_t* DRB_release; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + uint8_t buffer[RRC_BUF_SIZE]; + int i; + uint16_t size = 0; + LTE_DRB_ToReleaseList_t **DRB_Release_configList2=NULL; + LTE_DRB_Identity_t *DRB_release; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; - DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; - if (*DRB_Release_configList2) { - free(*DRB_Release_configList2); + if (*DRB_Release_configList2) { + free(*DRB_Release_configList2); + } + + *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); + + for(i = 0; i < NB_RB_MAX; i++) { + if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid) { + DRB_release = CALLOC(1, sizeof(LTE_DRB_Identity_t)); + *DRB_release = i+1; + ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); + //free(DRB_release); } - *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); + } - for(i = 0; i < NB_RB_MAX; i++){ - if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){ - DRB_release = CALLOC(1, sizeof(DRB_Identity_t)); - *DRB_release = i+1; - ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); - //free(DRB_release); - } - } + /* If list is empty free the list and reset the address */ + if (nas_length > 0) { + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)nas_buffer, + nas_length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d\n",nas_length); + } else { + LOG_W(RRC,"dedlicated NAS list is empty\n"); + } - /* If list is empty free the list and reset the address */ - if (nas_length > 0) { - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)nas_buffer, - nas_length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d\n",nas_length); - } else { - LOG_W(RRC,"dedlicated NAS list is empty\n"); - } - - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - NULL, - NULL, - (DRB_ToReleaseList_t*)*DRB_Release_configList2, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + memset(buffer, 0, RRC_BUF_SIZE); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + NULL, + NULL, + (LTE_DRB_ToReleaseList_t *)*DRB_Release_configList2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif - ); - ue_context_pP->ue_context.e_rab_release_command_flag = 1; - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, - "[MSG] RRC Connection Reconfiguration\n"); - + ); + ue_context_pP->ue_context.e_rab_release_command_flag = 1; + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, + "[MSG] RRC Connection Reconfiguration\n"); #if defined(ENABLE_ITTI) + /* Free all NAS PDUs */ if (nas_length > 0) { - /* Free the NAS PDU buffer and invalidate it */ - free(nas_buffer); + /* Free the NAS PDU buffer and invalidate it */ + free(nas_buffer); } + #endif - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2711,78 +2583,69 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - } -#endif +#endif //----------------------------------------------------------------------------- void -rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t **SRB_configList2 = NULL; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + struct LTE_SRB_ToAddMod *SRB2_config = NULL; + struct LTE_SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; + LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; + struct LTE_DRB_ToAddMod *DRB_config = NULL; + struct LTE_RLC_Config *DRB_rlc_config = NULL; + struct LTE_PDCP_Config *DRB_pdcp_config = NULL; + struct LTE_PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + LTE_DRB_ToAddModList_t **DRB_configList = &ue_context_pP->ue_context.DRB_configList; + LTE_DRB_ToAddModList_t **DRB_configList2 = NULL; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; + LTE_MeasObjectToAddModList_t *MeasObj_list = NULL; + LTE_MeasObjectToAddMod_t *MeasObj = NULL; + LTE_ReportConfigToAddModList_t *ReportConfig_list = NULL; + LTE_ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + LTE_MeasIdToAddModList_t *MeasId_list = NULL; + LTE_MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) long *sr_ProhibitTimer_r9 = NULL; // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); //uint8_t sCellIndexToAdd = 0; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + LTE_RSRP_Range_t *rsrp = NULL; + struct LTE_MeasConfig__speedStatePars *Sparams = NULL; + LTE_QuantityConfig_t *quantityConfig = NULL; + LTE_CellsToAddMod_t *CellToAdd = NULL; + LTE_CellsToAddModList_t *CellsToAddModList = NULL; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - - C_RNTI_t *cba_RNTI = NULL; - + LTE_C_RNTI_t *cba_RNTI = NULL; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - #ifdef CBA //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t)); cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); cba_RNTI->buf = cba_RNTI_buf; cba_RNTI->size = 2; @@ -2804,52 +2667,43 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // Configure SRB2 /// SRB2 SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { free(*SRB_configList2); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - + SRB2_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms10; SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - + SRB2_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; // this list has the configuration for SRB1 and SRB2 ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); @@ -2862,61 +2716,56 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons if (*DRB_configList) { free(*DRB_configList); } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); memset(*DRB_configList, 0, sizeof(**DRB_configList)); - // list for the configured DRB for a this xid DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 - // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; //allowed values 1..32 // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - #ifdef RRC_DEFAULT_RAB_IS_AM - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + DRB_rlc_config->present = LTE_RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25; #else - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; #ifdef CBA - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms5;//T_Reordering_ms25; #else - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; #endif #endif - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - /* avoid gcc warnings */ (void)PDCP_rlc_AM; (void)PDCP_rlc_UM; - #ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; @@ -2924,62 +2773,47 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons #else PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; #endif - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + *maxHARQ_Tx = LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + *periodicBSR_Timer = LTE_PeriodicBSR_Timer_r12_sf64; mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = LTE_RetxBSR_Timer_r12_sf320; mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - + mac_MainConfig->timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_infinity; mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + mac_MainConfig->phr_Config->present = LTE_MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; //sps_RA_ConfigList_rlola = NULL; #endif @@ -2991,308 +2825,262 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons if ((*physicalConfigDedicated)->antennaInfo) { (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); - if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm3) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; - } - } - else { + } else { LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { - if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; + if ((rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) || + (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31; #else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI #endif } - } - else { + } else { LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); } - } - else { - LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); + } else { + LOG_E(RRC,"physical_config_dedicated not present in LTE_RRCConnectionReconfiguration. Not reconfiguring!\n"); } // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - + (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - + CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0; ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; + LTE_ReportConfigEUTRA__triggerType_PR_periodical; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + a1_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - + if (ho_state == 1 /*HO_MEASURMENT */ ) { LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", ctxt_pP->module_id, ctxt_pP->frame); ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA2.a2_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA2.a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = - TimeToTrigger_ms40; + LTE_TimeToTrigger_ms40; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA4.a4_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA4.a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold1.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold2.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + rsrp = CALLOC(1, sizeof(LTE_RSRP_Range_t)); *rsrp = 20; - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->present = LTE_MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = LTE_SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = LTE_SpeedStateScaleFactors__sf_High_oDot5; Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120; quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA)); memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); quantityConfig->quantityConfigCDMA2000 = NULL; quantityConfig->quantityConfigGERAN = NULL; @@ -3301,44 +3089,42 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4; LOG_I(RRC, "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", ctxt_pP->module_id, ctxt_pP->frame); // store the information in an intermediate structure for Hanodver management //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(LTE_SRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(LTE_DRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, sizeof(LTE_MAC_MainConfig_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = - CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + CALLOC(1, sizeof(LTE_PhysicalConfigDedicated_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(LTE_PhysicalConfigDedicated_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - } #if defined(ENABLE_ITTI) /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); /* Add all NAS PDUs to the list */ for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); } @@ -3349,11 +3135,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -3363,41 +3148,38 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)*DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, + (LTE_SRB_ToAddModList_t *)*SRB_configList2, // SRB_configList + (LTE_DRB_ToAddModList_t *)*DRB_configList, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + (struct LTE_PhysicalConfigDedicated *)*physicalConfigDedicated, #ifdef EXMIMO_IOT NULL, NULL, NULL,NULL, #else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, + (LTE_MeasObjectToAddModList_t *)MeasObj_list, + (LTE_ReportConfigToAddModList_t *)ReportConfig_list, + (LTE_QuantityConfig_t *)quantityConfig, + (LTE_MeasIdToAddModList_t *)MeasId_list, #endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + (LTE_MAC_MainConfig_t *)mac_MainConfig, + (LTE_MeasGapConfig_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, + (struct LTE_MeasConfig__speedStatePars *)Sparams, + (LTE_RSRP_Range_t *)rsrp, + (LTE_C_RNTI_t *)cba_RNTI, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif ); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Connection Reconfiguration\n"); - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -3410,106 +3192,94 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void -flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state, - agent_reconf_rrc * trig_param - ) +flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state, + agent_reconf_rrc *trig_param + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t **SRB_configList2 = NULL; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1, - // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; -#if Rel10 + // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + struct LTE_SRB_ToAddMod *SRB2_config = NULL; + struct LTE_SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; + LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; + struct LTE_DRB_ToAddMod *DRB_config = NULL; + struct LTE_RLC_Config *DRB_rlc_config = NULL; + struct LTE_PDCP_Config *DRB_pdcp_config = NULL; + struct LTE_PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; + struct LTE_LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + LTE_DRB_ToAddModList_t **DRB_configList = &ue_context_pP->ue_context.DRB_configList; + LTE_DRB_ToAddModList_t **DRB_configList2 = NULL; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; + LTE_MeasObjectToAddModList_t *MeasObj_list = NULL; + LTE_MeasObjectToAddMod_t *MeasObj = NULL; + LTE_ReportConfigToAddModList_t *ReportConfig_list = NULL; + LTE_ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1, + // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + LTE_MeasIdToAddModList_t *MeasId_list = NULL; + LTE_MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) long *sr_ProhibitTimer_r9 = NULL; // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); //uint8_t sCellIndexToAdd = 0; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + LTE_RSRP_Range_t *rsrp = NULL; + struct LTE_MeasConfig__speedStatePars *Sparams = NULL; + LTE_QuantityConfig_t *quantityConfig = NULL; + LTE_CellsToAddMod_t *CellToAdd = NULL; + LTE_CellsToAddModList_t *CellsToAddModList = NULL; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - - C_RNTI_t *cba_RNTI = NULL; - + LTE_C_RNTI_t *cba_RNTI = NULL; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - #ifdef CBA //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t)); cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); cba_RNTI->buf = cba_RNTI_buf; cba_RNTI->size = 2; @@ -3531,52 +3301,43 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // Configure SRB2 /// SRB2 SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { free(*SRB_configList2); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - + SRB2_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms10; SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - + SRB2_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; // this list has the configuration for SRB1 and SRB2 ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); @@ -3589,61 +3350,56 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt if (*DRB_configList) { free(*DRB_configList); } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); memset(*DRB_configList, 0, sizeof(**DRB_configList)); - // list for the configured DRB for a this xid DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 - // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; //allowed values 1..32 // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - #ifdef RRC_DEFAULT_RAB_IS_AM - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + DRB_rlc_config->present = LTE_RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25; #else - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; #ifdef CBA - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms5;//T_Reordering_ms25; #else - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; #endif #endif - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - /* avoid gcc warnings */ (void)PDCP_rlc_AM; (void)PDCP_rlc_UM; - #ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; @@ -3651,62 +3407,47 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt #else PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; #endif - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); - // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - + // ue_context_pP->ue_context.mac_MainConfig = LTE_MAC_MainConfig; mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + *maxHARQ_Tx = LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + *periodicBSR_Timer = LTE_PeriodicBSR_Timer_r12_sf64; mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = LTE_RetxBSR_Timer_r12_sf320; mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - + mac_MainConfig->timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_infinity; mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#ifdef Rel10 + mac_MainConfig->phr_Config->present = LTE_MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; //sps_RA_ConfigList_rlola = NULL; #endif @@ -3718,227 +3459,182 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt if ((*physicalConfigDedicated)->antennaInfo) { (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); - if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm3) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; - } - } - else { + } else { LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { - if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; + if ((rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) || + (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31; #else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI #endif } - } - else { + } else { LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); } - } - else { - LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); + } else { + LOG_E(RRC,"physical_config_dedicated not present in LTE_RRCConnectionReconfiguration. Not reconfiguring!\n"); } // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - /* * Add one EUTRA Measurement Object */ - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - + // Configure MeasObject MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - + (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - + CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0; ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; // Report Configurations for periodical, A1-A5 events /* RRC Strategy Measurement */ - - if (strcmp("one_shot", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 0; - trig_param->report_amount = 0; - + if (strcmp("one_shot", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 0; + trig_param->report_amount = 0; + } else if (strcmp("event_driven", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 6; + trig_param->report_amount = 2; + } else if (strcmp("periodical", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 1; + trig_param->report_amount = 7; + } else { + LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); } - else if (strcmp("event_driven", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 6; - trig_param->report_amount = 2; - - } - - else if (strcmp("periodical", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 1; - trig_param->report_amount = 7; - - } - - else { - - LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); - } - - - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - // Periodical Measurement Report - + // Periodical Measurement Report ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - - // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... - - + ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + LTE_ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + LTE_ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4; #if defined(ENABLE_ITTI) /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); /* Add all NAS PDUs to the list */ for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); } /* TODO parameters yet to process ... */ // { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; // } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -3948,41 +3644,38 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, xid, //Transaction_id, - (SRB_ToAddModList_t*)NULL, // SRB_configList - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, -// #ifdef EXMIMO_IOT -// NULL, NULL, NULL,NULL, -// #else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, -// #endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL + (LTE_SRB_ToAddModList_t *)NULL, // SRB_configList + (LTE_DRB_ToAddModList_t *)NULL, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + (struct LTE_PhysicalConfigDedicated *)*physicalConfigDedicated, + // #ifdef EXMIMO_IOT + // NULL, NULL, NULL,NULL, + // #else + (LTE_MeasObjectToAddModList_t *)MeasObj_list, + (LTE_ReportConfigToAddModList_t *)ReportConfig_list, + (LTE_QuantityConfig_t *)quantityConfig, + (LTE_MeasIdToAddModList_t *)MeasId_list, + // #endif + (LTE_MAC_MainConfig_t *)mac_MainConfig, + (LTE_MeasGapConfig_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, + (struct LTE_MeasConfig__speedStatePars *)Sparams, + (LTE_RSRP_Range_t *)rsrp, + (LTE_C_RNTI_t *)cba_RNTI, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL #endif ); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Connection Reconfiguration\n"); - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -3995,51 +3688,45 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- int rrc_eNB_generate_RRCConnectionReconfiguration_SCell( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, uint32_t dl_CarrierFreq_r10 ) //----------------------------------------------------------------------------- { - uint8_t size; uint8_t buffer[100]; - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) uint8_t sCellIndexToAdd = 0; //one SCell so far // uint8_t sCellIndexToAdd; @@ -4056,51 +3743,48 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, - (struct SPS_Config*)NULL, - (struct PhysicalConfigDedicated*)NULL, - (MeasObjectToAddModList_t*)NULL, - (ReportConfigToAddModList_t*)NULL, - (QuantityConfig_t*)NULL, - (MeasIdToAddModList_t*)NULL, - (MAC_MainConfig_t*)NULL, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)NULL, - (RSRP_Range_t*)NULL, - (C_RNTI_t*)NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL - -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SRB_ToAddModList_t *)NULL, + (LTE_DRB_ToAddModList_t *)NULL, + (LTE_DRB_ToReleaseList_t *)NULL, + (struct LTE_SPS_Config *)NULL, + (struct LTE_PhysicalConfigDedicated *)NULL, + (LTE_MeasObjectToAddModList_t *)NULL, + (LTE_ReportConfigToAddModList_t *)NULL, + (LTE_QuantityConfig_t *)NULL, + (LTE_MeasIdToAddModList_t *)NULL, + (LTE_MAC_MainConfig_t *)NULL, + (LTE_MeasGapConfig_t *)NULL, + (LTE_MobilityControlInfo_t *)NULL, + (struct LTE_MeasConfig__speedStatePars *)NULL, + (LTE_RSRP_Range_t *)NULL, + (LTE_C_RNTI_t *)NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)NULL, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) , ue_context_pP->ue_context.sCell_config #endif ); - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, buffer, size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); return(0); } @@ -4108,64 +3792,64 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( //----------------------------------------------------------------------------- void rrc_eNB_process_MeasurementReport( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - const MeasResults_t* const measResults2 + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, + const LTE_MeasResults_t *const measResults2 ) //----------------------------------------------------------------------------- { int i=0; int neighboring_cells=-1; - T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); if (measResults2 == NULL ) return; - - if (measResults2->measId > 0 ){ - if (ue_context_pP->ue_context.measResults == NULL) { - ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t)); - } - ue_context_pP->ue_context.measResults->measId=measResults2->measId; - ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; - ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); - } - if (measResults2->measResultNeighCells == NULL) - return; - if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { - neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; - - if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { - - ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); - } - ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; - for (i=0; i < neighboring_cells; i++){ - memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - sizeof(MeasResultListEUTRA_t)); - - LOG_D(RRC, "Physical Cell Id %d\n", - (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); - LOG_D(RRC, "RSRP of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); - LOG_D(RRC, "RSRQ of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); - } - } + if (measResults2->measId > 0 ) { + if (ue_context_pP->ue_context.measResults == NULL) { + ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(LTE_MeasResults_t)); + } -// #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + ue_context_pP->ue_context.measResults->measId=measResults2->measId; + ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; + ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, + ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, + ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); + } - -// #else + if (measResults2->measResultNeighCells == NULL) + return; + + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { + neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; + + if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { + ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); + } + + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; + + for (i=0; i < neighboring_cells; i++) { + memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + sizeof(LTE_MeasResultListEUTRA_t)); + LOG_D(RRC, "Physical Cell Id %d\n", + (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); + LOG_D(RRC, "RSRP of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); + LOG_D(RRC, "RSRQ of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); + } + } + + // #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + // #else // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); -// #endif - + // #endif // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { // rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, // ue_context_pP, @@ -4175,68 +3859,58 @@ rrc_eNB_process_MeasurementReport( // LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, // ctxt_pP->rnti); // } - //Look for IP address of the target eNB //Send Handover Request -> target eNB //Wait for Handover Acknowledgement <- target eNB //Send Handover Command - //x2delay(); // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); - // uint8_t buffer[100]; // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); // // send_check_message((char*)buffer,size); //send_handover_command(); - } //----------------------------------------------------------------------------- void rrc_eNB_generate_HandoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - PhysCellId_t targetPhyId + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + LTE_PhysCellId_t targetPhyId ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_target_p = NULL; //uint8_t UE_id_target = -1; uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); /* uint8_t buffer[100]; uint8_t size; - struct PhysicalConfigDedicated **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP]; + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP]; RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); */ - T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! - memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(LTE_MasterInformationBlock_t)); memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, - (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); - + (void *)ue_context_pP->ue_context.measConfig, sizeof(LTE_MeasConfig_t)); // FIXME handoverInfo not used... free( handoverInfo ); handoverInfo = 0; - //to be configured - memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, - 0, sizeof(SecurityAlgorithmConfig_t)); - - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); + memset((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, + 0, sizeof(LTE_SecurityAlgorithmConfig_t)); + memcpy((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(LTE_SystemInformationBlockType1_t)); + memcpy((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(LTE_SystemInformationBlockType2_t)); ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = - CALLOC(1, sizeof(ReestablishmentInfo_t)); + CALLOC(1, sizeof(LTE_ReestablishmentInfo_t)); ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId; ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL; // Check values later @@ -4273,12 +3947,12 @@ rrc_eNB_generate_HandoverPreparationInformation( mod_id_target); ue_context_target_p->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, - (void*)&ue_context_pP->ue_context.handover_info->as_context, - sizeof(AS_Context_t)); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, - (void*)&ue_context_pP->ue_context.handover_info->as_config, - sizeof(AS_Config_t)); + memcpy((void *)&ue_context_target_p->ue_context.handover_info->as_context, + (void *)&ue_context_pP->ue_context.handover_info->as_context, + sizeof(LTE_AS_Context_t)); + memcpy((void *)&ue_context_target_p->ue_context.handover_info->as_config, + (void *)&ue_context_pP->ue_context.handover_info->as_config, + sizeof(LTE_AS_Config_t)); ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; ue_context_target_p->ue_context.handover_info->ho_complete = 0; ue_context_pP->ue_context.handover_info->modid_t = mod_id_target; @@ -4287,11 +3961,9 @@ rrc_eNB_generate_HandoverPreparationInformation( ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; - } else { LOG_E(RRC, "\nError in obtaining free UE id in target eNB %ld for handover \n", targetPhyId); } - } else { LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); } @@ -4300,17 +3972,15 @@ rrc_eNB_generate_HandoverPreparationInformation( //----------------------------------------------------------------------------- void rrc_eNB_process_handoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", + "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending LTE_RRCConnectionReconfiguration to UE %d \n", ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); rrc_eNB_generate_RRCConnectionReconfiguration_handover( ctxt_pP, @@ -4323,12 +3993,12 @@ rrc_eNB_process_handoverPreparationInformation( //----------------------------------------------------------------------------- void check_handovers( - protocol_ctxt_t* const ctxt_pP + protocol_ctxt_t *const ctxt_pP ) //----------------------------------------------------------------------------- { int result; - struct rrc_eNB_ue_context_s* ue_context_p; + struct rrc_eNB_ue_context_s *ue_context_p; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; @@ -4341,7 +4011,7 @@ check_handovers( ctxt_pP->rnti, ctxt_pP->module_id, ue_context_p->ue_context.handover_info->modid_t); - // source eNB generates rrcconnectionreconfiguration to prepare the HO + // source eNB generates LTE_RRCConnectionreconfiguration to prepare the HO rrc_eNB_process_handoverPreparationInformation( ctxt_pP, ue_context_p); @@ -4365,95 +4035,88 @@ check_handovers( ue_context_p->ue_context.handover_info->size, ue_context_p->ue_context.handover_info->buf, PDCP_TRANSMISSION_MODE_CONTROL -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif - ); + ); + //AssertFatal(result == TRUE, "PDCP data request failed!\n"); - if(result != TRUE) - { + if(result != TRUE) { LOG_I(RRC, "PDCP data request failed!\n"); return; } + ue_context_p->ue_context.handover_info->ho_complete = 0xF2; } } } } -// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover +// 5.3.5.4 LTE_RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReconfiguration_handover( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t* const nas_pdu, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t *const nas_pdu, const uint32_t nas_length ) //----------------------------------------------------------------------------- { T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - uint8_t buffer[RRC_BUF_SIZE]; int i; uint8_t rv[2]; uint16_t Idx; - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; - LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed - SRB_ToAddModList_t *SRB_configList2; - - struct DRB_ToAddMod *DRB_config; - struct RLC_Config *DRB_rlc_config; - struct PDCP_Config *DRB_pdcp_config; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM; - struct LogicalChannelConfig *DRB_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; - DRB_ToAddModList_t *DRB_configList2; - - MAC_MainConfig_t *mac_MainConfig; - MeasObjectToAddModList_t *MeasObj_list; - MeasObjectToAddMod_t *MeasObj; - ReportConfigToAddModList_t *ReportConfig_list; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; - QuantityConfig_t *quantityConfig; - MobilityControlInfo_t *mobilityInfo; + // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + struct LTE_SRB_ToAddMod *SRB2_config; + struct LTE_SRB_ToAddMod__rlc_Config *SRB2_rlc_config; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; + LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed + LTE_SRB_ToAddModList_t *SRB_configList2; + struct LTE_DRB_ToAddMod *DRB_config; + struct LTE_RLC_Config *DRB_rlc_config; + struct LTE_PDCP_Config *DRB_pdcp_config; + struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM; + struct LTE_LogicalChannelConfig *DRB_lchan_config; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; + LTE_DRB_ToAddModList_t *DRB_configList2; + LTE_MAC_MainConfig_t *mac_MainConfig; + LTE_MeasObjectToAddModList_t *MeasObj_list; + LTE_MeasObjectToAddMod_t *MeasObj; + LTE_ReportConfigToAddModList_t *ReportConfig_list; + LTE_ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + LTE_MeasIdToAddModList_t *MeasId_list; + LTE_MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + LTE_QuantityConfig_t *quantityConfig; + LTE_MobilityControlInfo_t *mobilityInfo; // HandoverCommand_t handoverCommand; //uint8_t sourceModId = // get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId); -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) long *sr_ProhibitTimer_r9; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - - // RSRP_Range_t *rsrp; - struct MeasConfig__speedStatePars *Sparams; - CellsToAddMod_t *CellToAdd; - CellsToAddModList_t *CellsToAddModList; + // LTE_RSRP_Range_t *rsrp; + struct LTE_MeasConfig__speedStatePars *Sparams; + LTE_CellsToAddMod_t *CellToAdd; + LTE_CellsToAddModList_t *CellsToAddModList; // srb 1: for HO - struct SRB_ToAddMod *SRB1_config; - struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config; - struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; + struct LTE_SRB_ToAddMod *SRB1_config; + struct LTE_SRB_ToAddMod__rlc_Config *SRB1_rlc_config; + struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; + struct LTE_LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; // phy config dedicated - PhysicalConfigDedicated_t *physicalConfigDedicated2; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; + LTE_PhysicalConfigDedicated_t *physicalConfigDedicated2; + struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; protocol_ctxt_t ctxt; - LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", ctxt_pP->module_id, ctxt_pP->frame); @@ -4470,44 +4133,33 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - + SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms15; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p8; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kB1000; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t16; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms10; SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); SRB1_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); SRB1_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); - //2nd: now reconfigure phy config dedicated physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); *physicalConfigDedicated = physicalConfigDedicated2; - physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); physicalConfigDedicated2->pucch_ConfigDedicated = @@ -4528,52 +4180,46 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( // PDSCH //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, // PDSCH_ConfigDedicated__p_a_dB0); - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; - + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = LTE_PDSCH_ConfigDedicated__p_a_dB0; // PUCCH physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = - PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release; physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; - // Pusch_config_dedicated physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 - // UplinkPowerControlDedicated physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled = - UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + LTE_UplinkPowerControlDedicated__deltaMCS_Enabled_en1; physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB - *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB - + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = LTE_FilterCoefficient_fc4; // fc4 dB // TPC-PDCCH-Config - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = LTE_TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = LTE_TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; - - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = LTE_TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = LTE_TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; - // CQI ReportConfig /* physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); @@ -4590,7 +4236,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; */ - //soundingRS-UL-ConfigDedicated /* physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; @@ -4605,37 +4250,35 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); */ - //AntennaInfoDedicated physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); - physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + physicalConfigDedicated2->antennaInfo->present = LTE_PhysicalConfigDedicated__antennaInfo_PR_explicitValue; //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, - // AntennaInfoDedicated__transmissionMode_tm2); + // LTE_AntennaInfoDedicated__transmissionMode_tm2); /* switch (transmission_mode){ case 1: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm1; break; case 2: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm2; break; case 4: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm4; break; case 5: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm5; break; case 6: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm6; break; } */ physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = - AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; - // SchedulingRequestConfig - physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + physicalConfigDedicated2->schedulingRequestConfig->present = LTE_SchedulingRequestConfig_PR_setup; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; if (rrc_inst->carrier[0].sib1->tdd_Config==NULL) { // FD @@ -4643,24 +4286,24 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) } else { switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) { - case 1: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( - ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) - break; + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( + ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; - case 3: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % - 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % + 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - case 4: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & - 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & + 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) - break; + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; } } @@ -4668,386 +4311,318 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( //SchedulingRequestConfig__setup__dsr_TransMax_n4); // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = - SchedulingRequestConfig__setup__dsr_TransMax_n4; - + LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4; LOG_D(RRC, "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t*) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t*) NULL, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t*) NULL, - (MobilityControlInfo_t*) NULL, - (SchedulingInfoList_t*) NULL, - 0, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (LTE_TDD_Config_t *) NULL, + (LTE_MobilityControlInfo_t *) NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, + NULL, + NULL, + (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif - ); - +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL +#endif + ); // Configure target eNB SRB2 /// SRB2 SRB2_config = CALLOC(1, sizeof(*SRB2_config)); SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); memset(SRB_configList2, 0, sizeof(*SRB_configList2)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - + SRB2_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms10; SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - + SRB2_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 1; SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); - // Configure target eNB DRB DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - - //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + //DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; //allowed values 1..32 // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 + DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(DRB_config->logicalChannelIdentity) = (long)3; DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - + DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = NULL; DRB_pdcp_config->rlc_AM = NULL; PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - + PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 DRB_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + *maxHARQ_Tx = LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + *periodicBSR_Timer = LTE_PeriodicBSR_Timer_r12_sf64; mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; - + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = LTE_RetxBSR_Timer_r12_sf320; mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + mac_MainConfig->phr_Config->present = LTE_MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; //sps_RA_ConfigList_rlola = NULL; #endif // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - + CellToAdd->cellIndividualOffset = LTE_Q_OffsetRange_dB0; ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; + LTE_ReportConfigEUTRA__triggerType_PR_periodical; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + LTE_ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + a1_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. - a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + a2_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. a2_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. - a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + a4_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. a4_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; + LTE_ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold1.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + eventA5.a5_Threshold2.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->present = LTE_MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = LTE_SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = LTE_SpeedStateScaleFactors__sf_High_oDot5; Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120; quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); @@ -5059,105 +4634,93 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)); quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4; /* mobilityinfo */ - mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); mobilityInfo->targetPhysCellId = - (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; + (LTE_PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %ld mod_id: %d ue: %x \n", ctxt_pP->module_id, ctxt_pP->frame, mobilityInfo->targetPhysCellId, ctxt_pP->module_id, ue_context_pP->ue_context.rnti); - mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! - - mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here - + mobilityInfo->t304 = LTE_MobilityControlInfo__t304_ms50; // need to configure an appropriate value here // New UE Identity (C-RNTI) to identify an UE uniquely in a cell mobilityInfo->newUE_Identity.size = 2; mobilityInfo->newUE_Identity.bits_unused = 0; mobilityInfo->newUE_Identity.buf = rv; mobilityInfo->newUE_Identity.buf[0] = rv[0]; mobilityInfo->newUE_Identity.buf[1] = rv[1]; - //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); - // Configuring radioResourceConfigCommon mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t)); + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(LTE_RACH_ConfigCommon_t)); mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - sizeof(PRACH_ConfigInfo_t)); - + sizeof(LTE_PRACH_ConfigInfo_t)); mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t)); + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(LTE_PDSCH_ConfigCommon_t)); memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t)); + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(LTE_PUSCH_ConfigCommon_t)); mobilityInfo->radioResourceConfigCommon.phich_Config = NULL; mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t)); + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(LTE_PUCCH_ConfigCommon_t)); mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - sizeof(SoundingRS_UL_ConfigCommon_t)); + sizeof(LTE_SoundingRS_UL_ConfigCommon_t)); mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon)); memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon, (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon, - sizeof(UplinkPowerControlCommon_t)); + sizeof(LTE_UplinkPowerControlCommon_t)); mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL; mobilityInfo->radioResourceConfigCommon.p_Max = NULL; // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max)); //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t)); - mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(TDD_Config_t)); - //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t)); + mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(LTE_TDD_Config_t)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(LTE_TDD_Config_t)); mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; //End of configuration of radioResourceConfigCommon - mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 mobilityInfo->carrierFreq->dl_CarrierFreq = 36090; mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; - mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( - *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 - mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; + *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct LTE_CarrierBandwidthEUTRA)); LTE_AllowedMeasBandwidth_mbw25 + mobilityInfo->carrierBandwidth->dl_Bandwidth = LTE_CarrierBandwidthEUTRA__dl_Bandwidth_n25; mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; mobilityInfo->rach_ConfigDedicated = NULL; - // store the srb and drb list for ho management, mainly in case of failure - memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, - (void*)SRB_configList2, - sizeof(SRB_ToAddModList_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, - (void*)DRB_configList2, - sizeof(DRB_ToAddModList_t)); + (void *)SRB_configList2, + sizeof(LTE_SRB_ToAddModList_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, + (void *)DRB_configList2, + sizeof(LTE_DRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void*)mac_MainConfig, - sizeof(MAC_MainConfig_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, - sizeof(PhysicalConfigDedicated_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, + sizeof(LTE_MAC_MainConfig_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, + sizeof(LTE_PhysicalConfigDedicated_t)); /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, (void *)rrc_inst->sps_Config[ue_mod_idP], sizeof(SPS_Config_t)); @@ -5171,79 +4734,73 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - - // SRB2 + // SRB2 ue_context_pP->ue_context.Srb2.Active = 1; ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); - // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - rrc_pdcp_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL + (LTE_DRB_ToAddModList_t *) NULL, (LTE_DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); - rrc_rlc_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL + (LTE_DRB_ToAddModList_t *) NULL, (LTE_DRB_ToReleaseList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL , 0, 0 #endif ); - /* Initialize NAS list */ dedicatedInfoNASList = NULL; - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; memset(buffer, 0, RRC_BUF_SIZE); - - int size=do_RRCConnectionReconfiguration( - ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, - SRB_configList2, - DRB_configList2, - NULL, // DRB2_list, - NULL, //*sps_Config, - ue_context_pP->ue_context.physicalConfigDedicated, - MeasObj_list, - ReportConfig_list, - NULL, //quantityConfig, - MeasId_list, - mac_MainConfig, - NULL, - mobilityInfo, - Sparams, - NULL, - NULL, - dedicatedInfoNASList, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)NULL -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , NULL // SCellToAddMod_r10_t + int size=do_RRCConnectionReconfiguration( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + SRB_configList2, + DRB_configList2, + NULL, // DRB2_list, + NULL, //*sps_Config, + ue_context_pP->ue_context.physicalConfigDedicated, + MeasObj_list, + ReportConfig_list, + NULL, //quantityConfig, + MeasId_list, + mac_MainConfig, + NULL, + mobilityInfo, + Sparams, + NULL, + NULL, + dedicatedInfoNASList, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , NULL // SCellToAddMod_r10_t #endif - ); - if (size <= 0) - LOG_E(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x) failed\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - else - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + ); + + if (size <= 0) + LOG_E(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x) failed\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + else + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + // to be updated if needed /*if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig) { - if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->present == LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue; } else { @@ -5254,55 +4811,52 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; } */ - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *) mobilityInfo, - (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (LTE_TDD_Config_t *) NULL, + (LTE_MobilityControlInfo_t *) mobilityInfo, + (LTE_SchedulingInfoList_t *) NULL, 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); /* handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; */ -//#warning "COMPILATION PROBLEM" + //#warning "COMPILATION PROBLEM" #ifdef PROBLEM_COMPILATION_RESOLVED if (sourceModId != 0xFF) { @@ -5329,15 +4883,15 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( /* void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP, - RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, uint8_t CH_index) { - if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) - if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) { rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index, - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); + LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); } @@ -5347,10 +4901,14 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( */ //----------------------------------------------------------------------------- +/* +* TODO: * add function description +* * format the function correctly +*/ void rrc_eNB_process_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, const uint8_t xid ) //----------------------------------------------------------------------------- @@ -5363,20 +4921,16 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (void)oip_ifup; (void)dest_ip_offset; #endif - uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; ue_context_pP->ue_context.ue_reestablishment_timer = 0; - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; - DRB_ToReleaseList_t* DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; - DRB_Identity_t* drb_id_p = NULL; - + LTE_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; + LTE_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; + LTE_DRB_Identity_t *drb_id_p = NULL; T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - #if defined(ENABLE_SECURITY) /* Derive the keys from kenb */ @@ -5389,9 +4943,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ue_context_pP->ue_context.kenb, &kRRCenc); derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, ue_context_pP->ue_context.kenb, &kRRCint); - #endif - // Refresh SRBs/DRBs MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, @@ -5401,12 +4953,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti); - rrc_pdcp_config_asn1_req( ctxt_pP, SRB_configList, //NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, -// (DRB_ToReleaseList_t *) NULL, + DRB_configList, + // (LTE_DRB_ToReleaseList_t *) NULL, DRB_Release_configList2, /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] | (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4), @@ -5415,8 +4966,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( kRRCenc, kRRCint, kUPenc -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif ,NULL); // Refresh SRBs/DRBs @@ -5424,47 +4975,47 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ctxt_pP, SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, DRB_configList, -// (DRB_ToReleaseList_t *) NULL + // (LTE_DRB_ToReleaseList_t *) NULL DRB_Release_configList2 -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL , 0, 0 #endif ); - + // set the SRB active in Ue context if (SRB_configList != NULL) { for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ){ - ue_context_pP->ue_context.Srb1.Active=1; - } - else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_pP->ue_context.Srb2.Active=1; - ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ue_context_pP->ue_context.primaryCC_id); + if (SRB_configList->list.array[i]->srb_Identity == 1 ) { + ue_context_pP->ue_context.Srb1.Active=1; + } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_pP->ue_context.Srb2.Active=1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ue_context_pP->ue_context.primaryCC_id); } else { - LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", - ctxt_pP->module_id, - ctxt_pP->frame, + LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", + ctxt_pP->module_id, + ctxt_pP->frame, ue_context_pP->ue_context.primaryCC_id, - SRB_configList->list.array[i]->srb_Identity); + SRB_configList->list.array[i]->srb_Identity); } } + free(SRB_configList); ue_context_pP->ue_context.SRB_configList2[xid] = NULL; } - + // Loop through DRBs and establish if necessary if (DRB_configList != NULL) { for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, @@ -5472,7 +5023,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (int)*DRB_configList->list.array[i]->logicalChannelIdentity); // for pre-ci tests LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], @@ -5488,7 +5039,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( RADIO_ACCESS_BEARER,Rlc_info_um); */ ue_context_pP->ue_context.DRB_active[drb_id] = 1; - LOG_D(RRC, "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); @@ -5500,11 +5050,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ctxt_pP->module_id); oip_ifup = nas_config( ctxt_pP->module_id, // interface index - ctxt_pP->module_id + 1, // thrid octet + ctxtReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA_pP->module_id + 1, // thrid octet ctxt_pP->module_id + 1); // fourth octet if (oip_ifup == 0) { // interface is up --> send a config the DRB - module_id_t ue_module_id; + module_id_t ue_module_id; dest_ip_offset = 8; LOG_I(OIP, "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", @@ -5524,7 +5074,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( # endif #endif - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); @@ -5534,43 +5083,41 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( } rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); - + ); } else { // remove LCHAN from MAC/PHY - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // DRB has just been removed so remove RLC + PDCP for DRB /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, @@ -5590,96 +5137,95 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - (LogicalChannelConfig_t *) NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + (LTE_LogicalChannelConfig_t *) NULL, + (LTE_MeasGapConfig_t *) NULL, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); } } } - free(DRB_configList); + + free(DRB_configList); ue_context_pP->ue_context.DRB_configList2[xid] = NULL; } - if(DRB_Release_configList2 != NULL){ - for (i = 0; i < DRB_Release_configList2->list.count; i++) { - if (DRB_Release_configList2->list.array[i]) { - drb_id_p = DRB_Release_configList2->list.array[i]; - drb_id = *drb_id_p; - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { - ue_context_pP->ue_context.DRB_active[drb_id] = 0; - } - } + if(DRB_Release_configList2 != NULL) { + for (i = 0; i < DRB_Release_configList2->list.count; i++) { + if (DRB_Release_configList2->list.array[i]) { + drb_id_p = DRB_Release_configList2->list.array[i]; + drb_id = *drb_id_p; + + if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { + ue_context_pP->ue_context.DRB_active[drb_id] = 0; + } } - free(DRB_Release_configList2); - ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; + } + + free(DRB_Release_configList2); + ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; } } //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- { - - LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; - SRB_ToAddModList_t **SRB_configList; - SRB_ToAddMod_t *SRB1_config; + LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + LTE_SRB_ToAddModList_t **SRB_configList; + LTE_SRB_ToAddMod_t *SRB1_config; int cnt; - T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionSetup(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, - (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, &ue_context_pP->ue_context.physicalConfigDedicated); - LOG_DUMPMSG(RRC,DEBUG_RRC, (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, "[MSG] RRC Connection Setup\n"); - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE if (*SRB_configList != NULL) { for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { @@ -5688,7 +5234,7 @@ rrc_eNB_generate_RRCConnectionSetup( if (SRB1_config->logicalChannelConfig) { if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; } else { SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; @@ -5701,40 +5247,40 @@ rrc_eNB_generate_RRCConnectionSetup( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - 0, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + 0, #endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + (LTE_RadioResourceConfigCommonSIB_t *) NULL, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (LTE_MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL #endif -#if (RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) + , + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); break; } } @@ -5745,22 +5291,19 @@ rrc_eNB_generate_RRCConnectionSetup( MSC_RRC_UE, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", + MSC_AS_TIME_FMT" LTE_RRCConnectionSetup UE %x size %u", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionSetup (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - //ue_context_pP->ue_context.ue_release_timer_thres=100; - // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE - ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres=1000; + // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE + ue_context_pP->ue_context.ue_release_timer=1; + // remove UE after 10 frames after LTE_RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres=1000; } @@ -5769,7 +5312,7 @@ rrc_eNB_generate_RRCConnectionSetup( char openair_rrc_eNB_configuration( const module_id_t enb_mod_idP, - RrcConfigurationReq* configuration + RrcConfigurationReq *configuration ) #else char @@ -5781,18 +5324,18 @@ openair_rrc_eNB_init( { protocol_ctxt_t ctxt; int CC_id; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Init...\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - #if OCP_FRAMEWORK + while ( RC.rrc[enb_mod_idP] == NULL ) { LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n"); sleep(1); } -#endif + +#endif AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); AssertFatal(MAX_MOBILES_PER_ENB < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); #ifdef ENABLE_ITTI @@ -5824,32 +5367,24 @@ openair_rrc_eNB_init( // for (j = 0; j < (MAX_MOBILES_PER_ENB + 1); j++) { // RC.rrc[enb_mod_idP]->Srb2[j].Active = 0; // } - - RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); - memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); - /// System Information INIT - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) // can clear it at runtime RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag = 0; - // This has to come from some top-level configuration // only CC_id 0 is logged -#if (RRC_VERSION < MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0)) LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n", #else LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel14 RRC detected, MBMS flag %d\n", #endif PROTOCOL_RRC_CTXT_ARGS(&ctxt), RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag); - #else LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); #endif @@ -5873,7 +5408,6 @@ openair_rrc_eNB_init( RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); } - #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { @@ -5883,32 +5417,33 @@ openair_rrc_eNB_init( , configuration #endif ); + for (int ue_id = 0; ue_id < MAX_MOBILES_PER_ENB; ue_id++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; - RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); + RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; + RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t *) malloc16(256); } } - rrc_init_global_param(); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) switch (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag) { - case 1: - case 2: - case 3: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; - break; + case 1: + case 2: + case 3: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; + break; - case 4: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; - break; + case 4: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; + break; - default: - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; - break; + default: + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; + break; } // if we are here the RC.rrc[enb_mod_idP]->MBMS_flag > 0, @@ -5918,43 +5453,38 @@ openair_rrc_eNB_init( /// MTCH data bearer init init_MBMS(ctxt.module_id, CC_id, 0); } -#endif +#endif openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); } openair_rrc_on(&ctxt); - return 0; - } /*------------------------------------------------------------------------------*/ int rrc_eNB_decode_ccch( - protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, + protocol_ctxt_t *const ctxt_pP, + const SRB_INFO *const Srb_info, const int CC_id ) //----------------------------------------------------------------------------- { - module_id_t Idx; - asn_dec_rval_t dec_rval; - UL_CCCH_Message_t *ul_ccch_msg = NULL; - RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; - RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; + module_id_t Idx; + asn_dec_rval_t dec_rval; + LTE_UL_CCCH_Message_t *ul_ccch_msg = NULL; + LTE_RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest = NULL; + LTE_RRCConnectionReestablishmentRequest_r8_IEs_t *rrcConnectionReestablishmentRequest = NULL; int i, rval; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; uint64_t random_value = 0; int stmsi_received = 0; - T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[0], ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], @@ -5962,16 +5492,16 @@ rrc_eNB_decode_ccch( ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload); dec_rval = uper_decode( NULL, - &asn_DEF_UL_CCCH_Message, - (void**)&ul_ccch_msg, - (uint8_t*) Srb_info->Rx_buffer.Payload, + &asn_DEF_LTE_UL_CCCH_Message, + (void **)&ul_ccch_msg, + (uint8_t *) Srb_info->Rx_buffer.Payload, 100, 0, 0); /* -#if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) + #if defined(ENABLE_ITTI) + # if defined(DISABLE_ITTI_XER_PRINT) { MessageDef *message_p; @@ -5980,13 +5510,13 @@ rrc_eNB_decode_ccch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); } -# else + # else { char message_string[10000]; size_t message_string_size; if ((message_string_size = - xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { + xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { MessageDef *msg_p; msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText)); @@ -5996,8 +5526,8 @@ rrc_eNB_decode_ccch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } -# endif -#endif + # endif + #endif */ for (i = 0; i < 8; i++) { @@ -6011,469 +5541,455 @@ rrc_eNB_decode_ccch( return -1; } - if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { - + if (ul_ccch_msg->message.present == LTE_UL_CCCH_MessageType_PR_c1) { switch (ul_ccch_msg->message.choice.c1.present) { + case LTE_UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + break; - case UL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, - PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), - Srb_info->Rx_buffer.payload_size, - "[MSG] RRC Connection Reestablishment Request\n"); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrcConnectionReestablishmentRequest = - &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : - (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : - "reconfigurationFailure")); - /*{ - uint64_t c_rnti = 0; - - memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, - rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); - ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); - } - - if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && - (ue_mod_id != UE_INDEX_INVALID)){ - rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); - }else { - rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); - } - */ - /* reject all reestablishment attempts for the moment */ -// rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, -// rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), -// CC_id); -{ - uint16_t c_rnti = 0; - - if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", + case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), + Srb_info->Rx_buffer.payload_size, + "[MSG] RRC Connection Reestablishment Request\n"); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrcConnectionReestablishmentRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest cause %s\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); + ((rrcConnectionReestablishmentRequest->reestablishmentCause == LTE_ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == LTE_ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ + uint64_t c_rnti = 0; - for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { - LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", - i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); - } - - if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || - rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - - } - - c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); - LOG_D(RRC, "c_rnti is %x\n", c_rnti); - - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); - if (ue_context_p == NULL) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); - if(UE_id == -1){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE_id(MAC) rnti %x, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - - if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) && - (RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the Previous UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - } - - if(ue_context_p->ue_context.ue_reestablishment_timer > 0){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) don't receive, delete the Previous UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - protocol_ctxt_t ctxt_old_p; - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, - ctxt_pP->instance, - ENB_FLAG_YES, - c_rnti, - ctxt_pP->frame, - ctxt_pP->subframe); - rrc_eNB_process_RRCConnectionReconfigurationComplete(&ctxt_old_p, - ue_context_p, - ue_context_p->ue_context.reestablishment_xid); - for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - } else { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; - } - } - } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - ue_context_p->ue_context.reestablishment_xid = -1; - - // insert C-RNTI to map - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if (reestablish_rnti_map[i][0] == 0) { - reestablish_rnti_map[i][0] = ctxt_pP->rnti; - reestablish_rnti_map[i][1] = c_rnti; - break; + memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, + rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); + ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - ue_context_p->ue_context.reestablishment_cause); -#else - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); -#endif - -#ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); -#else - - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL -#endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL, - 0,0 -# endif - ); -#endif //NO_RRM - } - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: - T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), - Srb_info->Rx_buffer.payload_size, - "[MSG] RRC Connection Request\n"); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); - - if (ue_context_p != NULL) { - // erase content - rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); - - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed); - } else { - rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && + (ue_mod_id != UE_INDEX_INVALID)){ + rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); + }else { + rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); + } + */ + /* reject all reestablishment attempts for the moment */ + // rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, + // rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + // CC_id); { - if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { - if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5) - { - LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", - (long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size); - return -1; - } - memcpy(((uint8_t*) & random_value) + 3, - rrcConnectionRequest->ue_Identity.choice.randomValue.buf, - rrcConnectionRequest->ue_Identity.choice.randomValue.size); - /* if there is already a registered UE (with another RNTI) with this random_value, - * the current one must be removed from MAC/PHY (zombie UE) - */ - if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - } - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { - /* Save s-TMSI */ - S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; - mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); - m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); - random_value = (((uint64_t)mme_code) << 32) | m_tmsi; - if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { - LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); - stmsi_received=1; - /* replace rnti in the context */ - /* for that, remove the context from the RB tree */ - RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* and insert again, after changing rnti everywhere it has to be changed */ - ue_context_p->ue_id_rnti = ctxt_pP->rnti; - ue_context_p->ue_context.rnti = ctxt_pP->rnti; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - ue_context_p->ue_context.reestablishment_xid = -1; - } else { - LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); -// ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); - if (ue_context_p == NULL) - LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); - if (ue_context_p != NULL) { - ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; - } else { - /* TODO: do we have to break here? */ - //break; - } - } + uint16_t c_rnti = 0; - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.random_ue_identity); - } else { + if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReject(ctxt_pP, - rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), - CC_id); + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); break; } + LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); + + for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { + LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", + i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); + } + + if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || + rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); + LOG_D(RRC, "c_rnti is %x\n", c_rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); + + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); + + if(UE_id == -1) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest without UE_id(MAC) rnti %x, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + if((RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) && + (RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres > 20)) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RCConnectionReestablishmentComplete(Previous) don't receive, delete the Previous UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1000; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + } + + if(ue_context_p->ue_context.ue_reestablishment_timer > 0) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) don't receive, delete the Previous UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + protocol_ctxt_t ctxt_old_p; + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, + ctxt_pP->instance, + ENB_FLAG_YES, + c_rnti, + ctxt_pP->frame, + ctxt_pP->subframe); + rrc_eNB_process_RRCConnectionReconfigurationComplete(&ctxt_old_p, + ue_context_p, + ue_context_p->ue_context.reestablishment_xid); + + for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + } else { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + } + } + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + ue_context_p->ue_context.reestablishment_xid = -1; + + // insert C-RNTI to map + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (reestablish_rnti_map[i][0] == 0) { + reestablish_rnti_map[i][0] = ctxt_pP->rnti; + reestablish_rnti_map[i][1] = c_rnti; + break; + } + } + + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + ue_context_p->ue_context.reestablishment_cause); +#else + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); +#endif +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + ue_context_p->ue_context.primaryCC_id = CC_id; + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (LTE_DRB_ToAddModList_t *) NULL, + (LTE_DRB_ToReleaseList_t *) NULL, + 0xff, + NULL, + NULL, + NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL +#endif + ,NULL); + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (LTE_DRB_ToAddModList_t *) NULL, + (LTE_DRB_ToReleaseList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL, + 0,0 +# endif + ); +#endif //NO_RRM } + break; + + case LTE_UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: + T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Srb_info->Rx_buffer.Payload), + Srb_info->Rx_buffer.payload_size, + "[MSG] RRC Connection Request\n"); LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); if (ue_context_p != NULL) { - - -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; - if (stmsi_received==0) - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); - else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); -#else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity); -#endif - if (stmsi_received == 0) - RC.rrc[ctxt_pP->module_id]->Nb_ue++; - + // erase content + rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" LTE_RRCConnectionRequest UE %x size %u (UE already in context)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed); } else { - // no context available - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ctxt_pP->rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + { + if (LTE_InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { + if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5) { + LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", + (long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size); + return -1; + } + + memcpy(((uint8_t *) & random_value) + 3, + rrcConnectionRequest->ue_Identity.choice.randomValue.buf, + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + + /* if there is already a registered UE (with another RNTI) with this random_value, + * the current one must be removed from MAC/PHY (zombie UE) + */ + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { + LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; + } + + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } else if (LTE_InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { + /* Save s-TMSI */ + LTE_S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; + mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); + m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); + random_value = (((uint64_t)mme_code) << 32) | m_tmsi; + + if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { + LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); + stmsi_received=1; + /* replace rnti in the context */ + /* for that, remove the context from the RB tree */ + RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* and insert again, after changing rnti everywhere it has to be changed */ + ue_context_p->ue_id_rnti = ctxt_pP->rnti; + ue_context_p->ue_context.rnti = ctxt_pP->rnti; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + ue_context_p->ue_context.reestablishment_xid = -1; + } else { + LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); + // ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); + + if (ue_context_p == NULL) + LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); + + if (ue_context_p != NULL) { + ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; + } else { + /* TODO: do we have to break here? */ + //break; + } + } + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.random_ue_identity); + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReject(ctxt_pP, + rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + } + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - random_value); - rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); - return -1; + ue_context_p); + + if (ue_context_p != NULL) { +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; + ue_context_p->ue_context.reestablishment_cause = LTE_ReestablishmentCause_spare1; + + if (stmsi_received==0) + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity); +#endif + + if (stmsi_received == 0) + RC.rrc[ctxt_pP->module_id]->Nb_ue++; + } else { + // no context available + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ctxt_pP->rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } + + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + random_value); + rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + return -1; + } } - } #ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); #else - - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL + ue_context_p->ue_context.primaryCC_id = CC_id; + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (LTE_DRB_ToAddModList_t *) NULL, + (LTE_DRB_ToReleaseList_t *) NULL, + 0xff, + NULL, + NULL, + NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL #endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - , (PMCH_InfoList_r9_t *) NULL - , 0, 0 + ,NULL); + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (LTE_DRB_ToAddModList_t *) NULL, + (LTE_DRB_ToReleaseList_t *) NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + , (LTE_PMCH_InfoList_r9_t *) NULL + , 0, 0 #endif - ); + ); #endif //NO_RRM + break; - break; - - default: - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rval = -1; - break; + default: + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + break; } rval = 0; @@ -6489,28 +6005,25 @@ rrc_eNB_decode_ccch( //----------------------------------------------------------------------------- int rrc_eNB_decode_dcch( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const rb_id_t Srb_id, - const uint8_t* const Rx_sdu, + const uint8_t *const Rx_sdu, const sdu_size_t sdu_sizeP ) //----------------------------------------------------------------------------- { - asn_dec_rval_t dec_rval; //UL_DCCH_Message_t uldcchmsg; - UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; + LTE_UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; int i; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; #if defined(ENABLE_ITTI) # if defined(ENABLE_USE_MME) - MessageDef * msg_delete_tunnels_p = NULL; + MessageDef *msg_delete_tunnels_p = NULL; uint8_t xid; #endif #endif - - int dedicated_DRB=0; - + int dedicated_DRB=0; T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); @@ -6523,19 +6036,18 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), Srb_id); } - //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); dec_rval = uper_decode( NULL, - &asn_DEF_UL_DCCH_Message, - (void**)&ul_dcch_msg, + &asn_DEF_LTE_UL_DCCH_Message, + (void **)&ul_dcch_msg, Rx_sdu, sdu_sizeP, 0, 0); - { for (i = 0; i < sdu_sizeP; i++) { LOG_T(RRC, "%x.", Rx_sdu[i]); @@ -6555,163 +6067,171 @@ rrc_eNB_decode_dcch( RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti); - if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { - + if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_c1) { switch (ul_dcch_msg->message.choice.c1.present) { - case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; - - case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: - break; - - case UL_DCCH_MessageType__c1_PR_measurementReport: - // to avoid segmentation fault - if(!ue_context_p){ - LOG_I(RRC, "Processing measurementReport UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + case LTE_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ break; - } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " - "%d bytes (measurementReport) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - rrc_eNB_process_MeasurementReport( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.measurementReport. - criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: - // to avoid segmentation fault - if(!ue_context_p){ - LOG_I(RRC, "Processing RRCConnectionReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + case LTE_UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: break; - } - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Rx_sdu),sdu_sizeP, - "[MSG] RRC Connection Reconfiguration Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + case LTE_UL_DCCH_MessageType__c1_PR_measurementReport: - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); + // to avoid segmentation fault + if(!ue_context_p) { + LOG_I(RRC, "Processing measurementReport UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + break; + } - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. - present == - RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { - /*NN: revise the condition */ - /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ - if (EPC_MODE_ENABLED) { - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ - dedicated_DRB = 1; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - //clear - int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id == -1){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); - break; - } - if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1){ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld) C-RNTI Complete\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - dedicated_DRB = 2; - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; - } - } else { - dedicated_DRB = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - ue_context_p->ue_context.reestablishment_xid = -1; - } else { - dedicated_DRB = 1; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - - rrc_eNB_process_RRCConnectionReconfigurationComplete( + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " + "%d bytes (measurementReport) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + rrc_eNB_process_MeasurementReport( ctxt_pP, ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + &ul_dcch_msg->message.choice.c1.choice.measurementReport. + criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); + break; + + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: + + // to avoid segmentation fault + if(!ue_context_p) { + LOG_I(RRC, "Processing LTE_RRCConnectionReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + break; + } + + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Rx_sdu),sdu_sizeP, + "[MSG] RRC Connection Reconfiguration Complete\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" LTE_RRCConnectionReconfigurationComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. + present == + LTE_RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { + /*NN: revise the condition */ + /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ + if (EPC_MODE_ENABLED) { + if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + dedicated_DRB = 1; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + //clear + int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + + if(UE_id == -1) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReconfigurationComplete without rnti %x, fault\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + break; + } + + if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1) { + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld) C-RNTI Complete\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + dedicated_DRB = 2; + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; + } + } else { + dedicated_DRB = 0; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + + ue_context_p->ue_context.reestablishment_xid = -1; + } else { + dedicated_DRB = 1; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + + rrc_eNB_process_RRCConnectionReconfigurationComplete( + ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); + } + } - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); - } - } #if defined(ENABLE_ITTI) #if defined(ENABLE_USE_MME) - if (dedicated_DRB == 1){ -// rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, -// ue_context_p, -// ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); -if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { - rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + if (dedicated_DRB == 1) { + // rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, + // ue_context_p, + // ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { + rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); ue_context_p->ue_context.nb_of_modify_e_rabs = 0; ue_context_p->ue_context.nb_of_failed_e_rabs = 0; memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); + for(int i = 0; i < NB_RB_MAX; i++) { ue_context_p->ue_context.modify_e_rab[i].xid = -1; } - - } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){ + } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1) { xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; ue_context_p->ue_context.e_rab_release_command_flag = 0; //gtp tunnel delete msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for(i = 0; i < NB_RB_MAX; i++){ - if(xid == ue_context_p->ue_context.e_rab[i].xid){ - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; - ue_context_p->ue_context.enb_gtp_teid[i] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); - ue_context_p->ue_context.enb_gtp_ebi[i] = 0; - } + + for(i = 0; i < NB_RB_MAX; i++) { + if(xid == ue_context_p->ue_context.e_rab[i].xid) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; + ue_context_p->ue_context.enb_gtp_teid[i] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); + ue_context_p->ue_context.enb_gtp_ebi[i] = 0; + } } + itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); //S1AP_E_RAB_RELEASE_RESPONSE rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP, - ue_context_p, - xid); + ue_context_p, + xid); } else { - rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); } - }else if(dedicated_DRB == 0){ - if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ - rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, - ue_context_p); + } else if(dedicated_DRB == 0) { + if(ue_context_p->ue_context.reestablishment_cause == LTE_ReestablishmentCause_spare1) { + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, + ue_context_p); } else { - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; + ue_context_p->ue_context.reestablishment_cause = LTE_ReestablishmentCause_spare1; + for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; @@ -6720,443 +6240,443 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { } } } - }else if(dedicated_DRB == 2){ - for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - } else { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; - } - } - } -#endif + } else if(dedicated_DRB == 2) { + for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + } else { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + } + } + } + +#endif #else // establish a dedicated bearer - if (dedicated_DRB == 0 ) { - // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; - rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); - } -#endif - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + if (dedicated_DRB == 0 ) { + // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; + rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); + } - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC Connection Reestablishment Complete\n"); +#endif + break; - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC Connection Reestablishment Complete\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishmentComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + { + rnti_t reestablish_rnti = 0; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - { - rnti_t reestablish_rnti = 0; - // select C-RNTI from map - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { - reestablish_rnti = reestablish_rnti_map[i][1]; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - reestablish_rnti); - // clear currentC-RNTI from map - reestablish_rnti_map[i][0] = 0; - reestablish_rnti_map[i][1] = 0; + // select C-RNTI from map + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { + reestablish_rnti = reestablish_rnti_map[i][1]; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + reestablish_rnti); + // clear currentC-RNTI from map + reestablish_rnti_map[i][0] = 0; + reestablish_rnti_map[i][1] = 0; + break; + } + } + + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); + + if (!ue_context_p) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentComplete without UE context, falt\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); break; } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); - if (!ue_context_p) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + //clear + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + + if(UE_id == -1) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); + break; + } + + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == + LTE_RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { + rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } + } + + //ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 1; + // remove UE after 100 frames after LTE_RRCConnectionReestablishmentRelease is triggered + ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; + } + break; + + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: + + // to avoid segmentation fault + if(!ue_context_p) { + LOG_I(RRC, "Processing LTE_RRCConnectionSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); break; } - //clear - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - if(UE_id == -1){ - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE_id(MAC) rnti %x, fault\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ctxt_pP->rnti); - break; - } - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == - RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { - rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC Connection SetupComplete\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" LTE_RRCConnectionSetupComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == + LTE_RRCConnectionSetupComplete__criticalExtensions_PR_c1) { + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. + present == + LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } } } - //ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered - ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; - } - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: - // to avoid segmentation fault - if(!ue_context_p){ - LOG_I(RRC, "Processing RRCConnectionSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + ue_context_p->ue_context.ue_release_timer=0; break; - } - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC Connection SetupComplete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete: + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionSetupComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == - RRCConnectionSetupComplete__criticalExtensions_PR_c1) { - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. - present == - RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - ue_context_p->ue_context.Status = RRC_CONNECTED; - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } + // to avoid segmentation fault + if(!ue_context_p) { + LOG_I(RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + break; } - } - ue_context_p->ue_context.ue_release_timer=0; - break; + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC Security Mode Complete\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); - case UL_DCCH_MessageType__c1_PR_securityModeComplete: - T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // to avoid segmentation fault - if(!ue_context_p){ - LOG_I(RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg); + } + + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry( + ctxt_pP, + ue_context_p); break; - } - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC Security Mode Complete\n"); + case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure: + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC Security Mode Failure\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_W(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeFailure) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg); + } - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); - } - // confirm with PDCP about the security mode for DCCH - //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); - // continue the procedure - rrc_eNB_generate_UECapabilityEnquiry( - ctxt_pP, - ue_context_p); - break; + // cancel the security mode in PDCP + // followup with the remaining procedure + //#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" + rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); + break; - case UL_DCCH_MessageType__c1_PR_securityModeFailure: - T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC Security Mode Failure\n"); - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_W(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeFailure) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); - } - // cancel the security mode in PDCP - - // followup with the remaining procedure -//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" - rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); - break; - - case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // to avoid segmentation fault - if(!ue_context_p){ + // to avoid segmentation fault + if(!ue_context_p) { LOG_I(RRC, "Processing ueCapabilityInformation UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); break; - } + } - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC UECapablility Information\n"); - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(UECapabilityInformation) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); - } - LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); - if (ue_context_p->ue_context.UE_Capability) { - LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); - ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability); - ue_context_p->ue_context.UE_Capability = 0; - } - dec_rval = uper_decode(NULL, - &asn_DEF_UE_EUTRA_Capability, - (void **)&ue_context_p->ue_context.UE_Capability, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.buf, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.size, 0, 0); - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); - } - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC UECapablility Information\n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - dec_rval.consumed); - ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability); - ue_context_p->ue_context.UE_Capability = 0; - } + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); - if (EPC_MODE_ENABLED) { + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)ul_dcch_msg); + } - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } - } else { - ue_context_p->ue_context.nb_of_e_rabs = 1; - for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){ - ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; - ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; - ue_context_p->ue_context.e_rab[i].param.qos.qci=9; - } - ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; - } + LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); - rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, - ue_context_p, - RC.rrc[ctxt_pP->module_id]->HO_flag); - break; + if (ue_context_p->ue_context.UE_Capability) { + LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); + ASN_STRUCT_FREE(asn_DEF_LTE_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); + ue_context_p->ue_context.UE_Capability = 0; + } - case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + dec_rval = uper_decode(NULL, + &asn_DEF_LTE_UE_EUTRA_Capability, + (void **)&ue_context_p->ue_context.UE_Capability, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, 0); - break; + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); + } - case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // to avoid segmentation fault - if(!ue_context_p){ + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + ASN_STRUCT_FREE(asn_DEF_LTE_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); + ue_context_p->ue_context.UE_Capability = 0; + } + + if (EPC_MODE_ENABLED) { + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + } else { + ue_context_p->ue_context.nb_of_e_rabs = 1; + + for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) { + ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; + ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; + ue_context_p->ue_context.e_rab[i].param.qos.qci=9; + } + + ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; + } + + rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, + ue_context_p, + RC.rrc[ctxt_pP->module_id]->HO_flag); + break; + + case LTE_UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; + + case LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + // to avoid segmentation fault + if(!ue_context_p) { LOG_I(RRC, "Processing ulInformationTransfer UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); break; - } + } - LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); - LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, - "[MSG] RRC UL Information Transfer \n"); + LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); + LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, + "[MSG] RRC UL Information Transfer \n"); + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } - break; + break; - case UL_DCCH_MessageType__c1_PR_counterCheckResponse: - T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + case LTE_UL_DCCH_MessageType__c1_PR_counterCheckResponse: + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) - break; + case LTE_UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) + case LTE_UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; +#endif +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + case LTE_UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - break; + case LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; + case LTE_UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; #endif -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; -#endif - - default: - T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - __FILE__, __LINE__); - return -1; + default: + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; } return 0; //TTN for D2D - } else if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_messageClassExtension){ - LOG_I(RRC, "THINH [UL_DCCH_MessageType_PR_messageClassExtension]\n"); + } else if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_messageClassExtension) { + LOG_I(RRC, "THINH [UL_DCCH_MessageType_PR_messageClassExtension]\n"); - switch (ul_dcch_msg->message.choice.messageClassExtension.present) { - case UL_DCCH_MessageType__messageClassExtension_PR_NOTHING: /* No components present */ + switch (ul_dcch_msg->message.choice.messageClassExtension.present) { + case LTE_UL_DCCH_MessageType__messageClassExtension_PR_NOTHING: /* No components present */ break; - case UL_DCCH_MessageType__messageClassExtension_PR_c2: //SidelinkUEInformation - //case UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12: //SidelinkUEInformation - LOG_I(RRC,"THINH [UL_DCCH_MessageType__messageClassExtension_PR_c2]\n"); + case LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2: //SidelinkUEInformation + //case UL_DCCH_MessageType__messageClassExtension__c2_PR_sidelinkUEInformation_r12: //SidelinkUEInformation + LOG_I(RRC,"THINH [UL_DCCH_MessageType__messageClassExtension_PR_c2]\n"); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC SidelinkUEInformation \n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" SidelinkUEInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" SidelinkUEInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(SidelinkUEInformation) ---> RRC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), DCCH, sdu_sizeP); - rrc_eNB_process_SidelinkUEInformation( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12); + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.messageClassExtension.choice.c2.choice.sidelinkUEInformation_r12); break; - default: + + default: break; - } - //end TTN + } + + //end TTN } else { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -7168,16 +6688,15 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { } #if defined(ENABLE_ITTI) -void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP){ - +void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP) { int i; int e_rab_done=0; - for (i = 0; + + for (i = 0; i < 3;//NB_RB_MAX - 3; // S1AP_MAX_E_RAB i++) { - - if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE){ + if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE) { ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1; ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9; @@ -7186,18 +6705,17 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED; ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length = 0; - // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); + // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); ue_context_pP->ue_context.e_rab[i].param.sgw_addr.length = 0; ue_context_pP->ue_context.e_rab[i].param.gtp_teid=0; - ue_context_pP->ue_context.nb_of_e_rabs++; e_rab_done++; - LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", - ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); + LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", + ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); } } + ue_context_pP->ue_context.setup_e_rabs+=e_rab_done; - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); } @@ -7210,23 +6728,20 @@ void rrc_enb_init(void) { //----------------------------------------------------------------------------- void *rrc_enb_process_itti_msg(void *notUsed) { - MessageDef *msg_p; - const char *msg_name_p; - instance_t instance; - int result; - SRB_INFO *srb_info_p; - int CC_id; - - protocol_ctxt_t ctxt; + MessageDef *msg_p; + const char *msg_name_p; + instance_t instance; + int result; + SRB_INFO *srb_info_p; + int CC_id; + protocol_ctxt_t ctxt; + // Wait for a message + itti_receive_msg(TASK_RRC_ENB, &msg_p); + msg_name_p = ITTI_MSG_NAME(msg_p); + instance = ITTI_MSG_INSTANCE(msg_p); + LOG_I(RRC,"Received message %s\n",msg_name_p); - // Wait for a message - itti_receive_msg(TASK_RRC_ENB, &msg_p); - - msg_name_p = ITTI_MSG_NAME(msg_p); - instance = ITTI_MSG_INSTANCE(msg_p); - LOG_I(RRC,"Received message %s\n",msg_name_p); - - switch (ITTI_MSG_ID(msg_p)) { + switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: LOG_W(RRC, " *** Exiting RRC thread\n"); itti_exit_task(); @@ -7236,7 +6751,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); break; - /* Messages from MAC */ + /* Messages from MAC */ case RRC_MAC_CCCH_DATA_IND: PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, @@ -7247,25 +6762,24 @@ void *rrc_enb_process_itti_msg(void *notUsed) { LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), msg_name_p); - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; - LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { - LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); - break; + LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); + break; } + memcpy(srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND(msg_p).sdu, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; - rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); break; - - /* Messages from PDCP */ + + /* Messages from PDCP */ case RRC_DCCH_DATA_IND: PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, @@ -7281,18 +6795,18 @@ void *rrc_enb_process_itti_msg(void *notUsed) { RRC_DCCH_DATA_IND(msg_p).dcch_index, RRC_DCCH_DATA_IND(msg_p).sdu_p, RRC_DCCH_DATA_IND(msg_p).sdu_size); - // Message buffer has been processed, free it now. result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); - if (result != EXIT_SUCCESS) { - LOG_I(RRC, "Failed to free memory (%d)!\n",result); - break; - } - break; + if (result != EXIT_SUCCESS) { + LOG_I(RRC, "Failed to free memory (%d)!\n",result); + break; + } + + break; # if defined(ENABLE_USE_MME) - /* Messages from S1AP */ + /* Messages from S1AP */ case S1AP_DOWNLINK_NAS: rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); break; @@ -7309,8 +6823,8 @@ void *rrc_enb_process_itti_msg(void *notUsed) { LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p); rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance); break; - - case S1AP_E_RAB_SETUP_REQ: + + case S1AP_E_RAB_SETUP_REQ: rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance); LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p); break; @@ -7322,7 +6836,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { case S1AP_E_RAB_RELEASE_COMMAND: rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance); break; - + case S1AP_UE_CONTEXT_RELEASE_REQ: rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); break; @@ -7332,19 +6846,20 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; case GTPV1U_ENB_DELETE_TUNNEL_RESP: + /* Nothing to do. Apparently everything is done in S1AP processing */ //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", //instance, msg_name_p); - if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) - && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { + if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) + && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = - rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; + rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; } - break; + break; # endif - /* Messages from eNB app */ + /* Messages from eNB app */ case RRC_CONFIGURATION_REQ: LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); @@ -7353,33 +6868,31 @@ void *rrc_enb_process_itti_msg(void *notUsed) { default: LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); break; - } + } - result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - if (result != EXIT_SUCCESS) { - LOG_I(RRC, "Failed to free memory (%d)!\n",result); - } - msg_p = NULL; - return NULL; + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + + if (result != EXIT_SUCCESS) { + LOG_I(RRC, "Failed to free memory (%d)!\n",result); + } + + msg_p = NULL; + return NULL; } //----------------------------------------------------------------------------- -void* +void * rrc_enb_task( - void* args_p + void *args_p ) //----------------------------------------------------------------------------- { rrc_enb_init(); - itti_mark_task_ready(TASK_RRC_ENB); LOG_I(RRC,"Entering main loop of RRC message task\n"); - while (1) { - (void) rrc_enb_process_itti_msg(NULL); - } } #endif @@ -7389,13 +6902,10 @@ void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) //----------------------------------------------------------------------------- { - module_id_t module_id; int CC_id; - /* for no gcc warnings */ (void)CC_id; - LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_eNB_INST=%d\n", RC.nb_inst); if (RC.nb_inst > 0) { @@ -7405,7 +6915,7 @@ openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) RC.rrc[module_id]->HO_flag = (uint8_t)HO_active; } -#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active); for (module_id=0; module_idcriticalExtensions.present == SidelinkUEInformation_r12__criticalExtensions_PR_c1){ - if (sidelinkUEInformation->criticalExtensions.choice.c1.present == SidelinkUEInformation_r12__criticalExtensions__c1_PR_sidelinkUEInformation_r12){ - // express its interest to receive SL communication - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 != NULL){ - - } - - // express its interest to transmit non-relay one-to-many SL communication - if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12 != NULL) && (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12 != NULL)){ - n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.count; - destinationInfoList = CALLOC(1, sizeof(SL_DestinationInfoList_r12_t)); - for (int i=0; i< n_destinations; i++ ){ - //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.array[i]); - ASN_SEQUENCE_ADD(&destinationInfoList->list, sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.array[i]); - } - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); - return 0; - - } - - // express its interest to transmit non-relay one-to-one SL communication - if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13 != NULL)) { - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12 != NULL){ - n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.count; - destinationInfoList = CALLOC(1, sizeof(SL_DestinationInfoList_r12_t)); - for (int i=0; i< n_destinations; i++ ){ - //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.array[i]); - ASN_SEQUENCE_ADD(&destinationInfoList->list,sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.array[i]); - } - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); - return 0; - } - } - - // express its interest to transmit relay related one-to-one SL communication - if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) &&(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13 != NULL)) { - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count > 0) { - n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count; - destinationInfoList = CALLOC(1, sizeof(SL_DestinationInfoList_r12_t)); - for (int i=0; i< n_destinations; i++ ){ - //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.array[i]); - ASN_SEQUENCE_ADD(&destinationInfoList->list, sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.array[i]); - } - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); - return 0; - } - } - - //express its interest to transmit relay related one-to-many SL communication - if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13 != NULL)) { - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count > 0){ - n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count; - destinationInfoList = CALLOC(1, sizeof(SL_DestinationInfoList_r12_t)); - for (int i=0; i< n_destinations; i++ ){ - //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.array[i]); - ASN_SEQUENCE_ADD(&destinationInfoList->list,sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.array[i]); - } - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); - return 0; - } - } - - //For SL Discovery - //express its interest to receive SL discovery announcements - //express its interest to transmit non-PS related discovery announcements - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12 != NULL){ - n_discoveryMessages = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12); - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, NULL, n_discoveryMessages); - return 0; - } - //express its interest to transmit PS related discovery announcements - if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13 !=NULL)) { - if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13 > 0){ - n_discoveryMessages = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13; - //generate RRC Reconfiguration - rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, NULL, n_discoveryMessages); - return 0; - } - } + //For SL Communication + if (sidelinkUEInformation->criticalExtensions.present == LTE_SidelinkUEInformation_r12__criticalExtensions_PR_c1) { + if (sidelinkUEInformation->criticalExtensions.choice.c1.present == LTE_SidelinkUEInformation_r12__criticalExtensions__c1_PR_sidelinkUEInformation_r12) { + // express its interest to receive SL communication + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commRxInterestedFreq_r12 != NULL) { } - } - return 0; + + // express its interest to transmit non-relay one-to-many SL communication + if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12 != NULL) && + (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->carrierFreq_r12 != NULL)) { + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.count; + destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t)); + + for (int i=0; i< n_destinations; i++ ) { + //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.array[i]); + ASN_SEQUENCE_ADD(&destinationInfoList->list, sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.commTxResourceReq_r12->destinationInfoList_r12.list.array[i]); + } + + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); + return 0; + } + + // express its interest to transmit non-relay one-to-one SL communication + if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && + (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13 != NULL)) { + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->carrierFreq_r12 != NULL) { + n_destinations = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.count; + destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t)); + + for (int i=0; i< n_destinations; i++ ) { + //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.array[i]); + ASN_SEQUENCE_ADD(&destinationInfoList->list, + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceReqUC_r13->destinationInfoList_r12.list.array[i]); + } + + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); + return 0; + } + } + + // express its interest to transmit relay related one-to-one SL communication + if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && + (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13 != NULL)) { + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count + > 0) { + n_destinations = + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.count; + destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t)); + + for (int i=0; i< n_destinations; i++ ) { + //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.array[i]); + ASN_SEQUENCE_ADD(&destinationInfoList->list, + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelayUC_r13->destinationInfoList_r12.list.array[i]); + } + + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); + return 0; + } + } + + //express its interest to transmit relay related one-to-many SL communication + if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && + (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13 != NULL)) { + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count + > 0) { + n_destinations = + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.count; + destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t)); + + for (int i=0; i< n_destinations; i++ ) { + //sl_DestinationIdentityList[i] = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.array[i]); + ASN_SEQUENCE_ADD(&destinationInfoList->list, + sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->commTxResourceInfoReqRelay_r13->commTxResourceReqRelay_r13->destinationInfoList_r12.list.array[i]); + } + + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, destinationInfoList, 0); + return 0; + } + } + + //For SL Discovery + //express its interest to receive SL discovery announcements + //express its interest to transmit non-PS related discovery announcements + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12 != NULL) { + n_discoveryMessages = *(sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.discTxResourceReq_r12); + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, NULL, n_discoveryMessages); + return 0; + } + + //express its interest to transmit PS related discovery announcements + if ((sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension != NULL) && + (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13 !=NULL)) { + if (sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13 > 0) { + n_discoveryMessages = sidelinkUEInformation->criticalExtensions.choice.c1.choice.sidelinkUEInformation_r12.nonCriticalExtension->discTxResourceReqPS_r13->discTxResourceReq_r13; + //generate RRC Reconfiguration + rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(ctxt_pP, ue_context_pP, NULL, n_discoveryMessages); + return 0; + } + } + } + } + + return 0; } //----------------------------------------------------------------------------- int rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - SL_DestinationInfoList_r12_t *destinationInfoList, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + LTE_SL_DestinationInfoList_r12_t *destinationInfoList, int n_discoveryMessages ) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; uint16_t size = -1; memset(buffer, 0, RRC_BUF_SIZE); @@ -7568,58 +7094,56 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( // allocate dedicated pools for UE -sl-CommConfig/sl-DiscConfig (sl-V2X-ConfigDedicated) //populate dedicated resources for SL communication (sl-CommConfig) if ((destinationInfoList != NULL) && (destinationInfoList->list.count > 0)) { - - LOG_I(RRC,"[eNB %d] Frame %d, Generate RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x), number of destinations %d\n", - ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti,destinationInfoList->list.count ); - //get dedicated resources from available pool and assign to the UE - SL_CommConfig_r12_t sl_CommConfig[destinationInfoList->list.count]; - //get a RP from the available RPs - sl_CommConfig[0] = rrc_eNB_get_sidelink_commTXPool(ctxt_pP, ue_context_pP, destinationInfoList); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, - (SL_CommConfig_r12_t*)&sl_CommConfig, - (SL_DiscConfig_r12_t*)NULL - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL - #endif - ); - // + LOG_I(RRC,"[eNB %d] Frame %d, Generate LTE_RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x), number of destinations %d\n", + ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti,destinationInfoList->list.count ); + //get dedicated resources from available pool and assign to the UE + LTE_SL_CommConfig_r12_t sl_CommConfig[destinationInfoList->list.count]; + //get a RP from the available RPs + sl_CommConfig[0] = rrc_eNB_get_sidelink_commTXPool(ctxt_pP, ue_context_pP, destinationInfoList); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id + (LTE_SRB_ToAddModList_t *)NULL, + (LTE_DRB_ToAddModList_t *)NULL, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)NULL, + (LTE_SL_CommConfig_r12_t *)&sl_CommConfig, + (LTE_SL_DiscConfig_r12_t *)NULL +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL +#endif + ); + // } + //populate dedicated resources for SL discovery (sl-DiscConfig) if (n_discoveryMessages > 0) { - SL_DiscConfig_r12_t sl_DiscConfig[n_discoveryMessages]; - //get a RP from the available RPs - sl_DiscConfig[0] = rrc_eNB_get_sidelink_discTXPool(ctxt_pP, ue_context_pP, n_discoveryMessages ); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL, - (SL_CommConfig_r12_t*)NULL, - (SL_DiscConfig_r12_t*)&sl_DiscConfig - #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - , (SCellToAddMod_r10_t*)NULL - #endif - ); + LTE_SL_DiscConfig_r12_t sl_DiscConfig[n_discoveryMessages]; + //get a RP from the available RPs + sl_DiscConfig[0] = rrc_eNB_get_sidelink_discTXPool(ctxt_pP, ue_context_pP, n_discoveryMessages ); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id + (LTE_SRB_ToAddModList_t *)NULL, + (LTE_DRB_ToAddModList_t *)NULL, + (LTE_DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct LTE_SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)NULL, + (LTE_SL_CommConfig_r12_t *)NULL, + (LTE_SL_DiscConfig_r12_t *)&sl_DiscConfig +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + , (LTE_SCellToAddMod_r10_t *)NULL +#endif + ); } - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x)\n", + LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration_Sidelink (bytes %d, UE id %x)\n", ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - rrc_data_req( ctxt_pP, DCCH, @@ -7628,306 +7152,327 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - // rrc_data_req(); - return size; } -SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, SL_DestinationInfoList_r12_t *destinationInfoList ){ - // for the moment, use scheduled resource allocation - SL_CommConfig_r12_t *sl_CommConfig; - SL_CommResourcePool_r12_t *sc_CommTxConfig; - - sl_CommConfig = CALLOC(1, sizeof(struct SL_CommConfig_r12)); - sl_CommConfig->commTxResources_r12 = CALLOC(1, sizeof(*sl_CommConfig->commTxResources_r12)); - sl_CommConfig->commTxResources_r12->present = SL_CommConfig_r12__commTxResources_r12_PR_setup; - - sl_CommConfig->commTxResources_r12->choice.setup.present = SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12; - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size = 2; - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf = CALLOC(1,2); - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[0] = 0x00; - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[1] = 0x01;//ctxt_pP->rnti;//rnti - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.bits_unused = 0; - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = CALLOC(1,sizeof(*sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12)); - //*sl_CommConfig_test->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = 12; //Msc - sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL = RetxBSR_Timer_r12_sf320; //MacConfig, for testing only - //sl_CommConfig_test->commTxResources_r12->choice.setup.choice.scheduled_r12.sc_CommTxConfig_r12; - - sc_CommTxConfig = & sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sc_CommTxConfig_r12; - - sc_CommTxConfig->sc_CP_Len_r12 = SL_CP_Len_r12_normal; - sc_CommTxConfig->sc_Period_r12 = SL_PeriodComm_r12_sf40; - sc_CommTxConfig->data_CP_Len_r12 = SL_CP_Len_r12_normal; - //sc_TF_ResourceConfig_r12 - sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_Num_r12 = 20; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_Start_r12 = 5; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_End_r12 = 44; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = SL_OffsetIndicator_r12_PR_small_r12; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; - - sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = SubframeBitmapSL_r12_PR_bs40_r12; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; - sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); - sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; - //dataHoppingConfig_r12 - sc_CommTxConfig->dataHoppingConfig_r12.hoppingParameter_r12 = 0; - sc_CommTxConfig->dataHoppingConfig_r12.numSubbands_r12 = SL_HoppingConfigComm_r12__numSubbands_r12_ns1; - sc_CommTxConfig->dataHoppingConfig_r12.rb_Offset_r12 = 0; - //ue_SelectedResourceConfig_r12 - sc_CommTxConfig->ue_SelectedResourceConfig_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->ue_SelectedResourceConfig_r12)); - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Num_r12 = 20; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Start_r12 = 5; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_End_r12 = 44; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = SL_OffsetIndicator_r12_PR_small_r12; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0 ; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = SubframeBitmapSL_r12_PR_bs40_r12; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = 5; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = CALLOC(1,5); - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = 0; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[0] = 0xF0; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[1] = 0xFF; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[2] = 0xFF; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[3] = 0xFF; - sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[4] = 0xFF; - //rxParametersNCell_r12 - sc_CommTxConfig->rxParametersNCell_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->rxParametersNCell_r12)); - sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12 )); - sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12->subframeAssignment = 0 ; - sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12->specialSubframePatterns = 0; - sc_CommTxConfig->rxParametersNCell_r12->syncConfigIndex_r12 = 0; - //txParameters_r12 - sc_CommTxConfig->txParameters_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->txParameters_r12)); - sc_CommTxConfig->txParameters_r12->sc_TxParameters_r12.alpha_r12 = Alpha_r12_al0; - sc_CommTxConfig->txParameters_r12->sc_TxParameters_r12.p0_r12 = 0; - sc_CommTxConfig->ext1 = NULL ; - - return *sl_CommConfig; +LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, LTE_SL_DestinationInfoList_r12_t *destinationInfoList ) { + // for the moment, use scheduled resource allocation + LTE_SL_CommConfig_r12_t *sl_CommConfig; + LTE_SL_CommResourcePool_r12_t *sc_CommTxConfig; + sl_CommConfig = CALLOC(1, sizeof(struct LTE_SL_CommConfig_r12)); + sl_CommConfig->commTxResources_r12 = CALLOC(1, sizeof(*sl_CommConfig->commTxResources_r12)); + sl_CommConfig->commTxResources_r12->present = LTE_SL_CommConfig_r12__commTxResources_r12_PR_setup; + sl_CommConfig->commTxResources_r12->choice.setup.present = LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12; + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size = 2; + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf = CALLOC(1,2); + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[0] = 0x00; + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf[1] = 0x01;//ctxt_pP->rnti;//rnti + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.bits_unused = 0; + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = CALLOC(1,sizeof(*sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12)); + //*sl_CommConfig_test->commTxResources_r12->choice.setup.choice.scheduled_r12.mcs_r12 = 12; //Msc + sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL = LTE_RetxBSR_Timer_r12_sf320; //MacConfig, for testing only + //sl_CommConfig_test->commTxResources_r12->choice.setup.choice.scheduled_r12.sc_CommTxConfig_r12; + sc_CommTxConfig = & sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sc_CommTxConfig_r12; + sc_CommTxConfig->sc_CP_Len_r12 = LTE_SL_CP_Len_r12_normal; + sc_CommTxConfig->sc_Period_r12 = LTE_SL_PeriodComm_r12_sf40; + sc_CommTxConfig->data_CP_Len_r12 = LTE_SL_CP_Len_r12_normal; + //sc_TF_ResourceConfig_r12 + sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_Num_r12 = 20; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_Start_r12 = 5; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.prb_End_r12 = 44; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; + sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); + sc_CommTxConfig->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; + //dataHoppingConfig_r12 + sc_CommTxConfig->dataHoppingConfig_r12.hoppingParameter_r12 = 0; + sc_CommTxConfig->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; + sc_CommTxConfig->dataHoppingConfig_r12.rb_Offset_r12 = 0; + //ue_SelectedResourceConfig_r12 + sc_CommTxConfig->ue_SelectedResourceConfig_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->ue_SelectedResourceConfig_r12)); + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Num_r12 = 20; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Start_r12 = 5; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_End_r12 = 44; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0 ; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = 5; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = CALLOC(1,5); + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = 0; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[0] = 0xF0; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[1] = 0xFF; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[2] = 0xFF; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[3] = 0xFF; + sc_CommTxConfig->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[4] = 0xFF; + //rxParametersNCell_r12 + sc_CommTxConfig->rxParametersNCell_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->rxParametersNCell_r12)); + sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12 )); + sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12->subframeAssignment = 0 ; + sc_CommTxConfig->rxParametersNCell_r12->tdd_Config_r12->specialSubframePatterns = 0; + sc_CommTxConfig->rxParametersNCell_r12->syncConfigIndex_r12 = 0; + //txParameters_r12 + sc_CommTxConfig->txParameters_r12 = CALLOC (1, sizeof (*sc_CommTxConfig->txParameters_r12)); + sc_CommTxConfig->txParameters_r12->sc_TxParameters_r12.alpha_r12 = LTE_Alpha_r12_al0; + sc_CommTxConfig->txParameters_r12->sc_TxParameters_r12.p0_r12 = 0; + sc_CommTxConfig->ext1 = NULL ; + return *sl_CommConfig; } -SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, int n_discoveryMessages ){ - //TODO - SL_DiscConfig_r12_t sl_DiscConfig; - sl_DiscConfig.discTxResources_r12 = CALLOC(1,sizeof(*sl_DiscConfig.discTxResources_r12)); - sl_DiscConfig.discTxResources_r12->present = SL_DiscConfig_r12__discTxResources_r12_PR_setup; - sl_DiscConfig.discTxResources_r12->choice.setup.present = SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12; - //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discHoppingConfig_r12; - //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discTF_IndexList_r12; - //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discTxConfig_r12; - return sl_DiscConfig; +LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool( const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, int n_discoveryMessages ) { + //TODO + LTE_SL_DiscConfig_r12_t sl_DiscConfig; + sl_DiscConfig.discTxResources_r12 = CALLOC(1,sizeof(*sl_DiscConfig.discTxResources_r12)); + sl_DiscConfig.discTxResources_r12->present = LTE_SL_DiscConfig_r12__discTxResources_r12_PR_setup; + sl_DiscConfig.discTxResources_r12->choice.setup.present = LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12; + //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discHoppingConfig_r12; + //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discTF_IndexList_r12; + //sl_DiscConfig.discTxResources_r12->choice.setup.choice.scheduled_r12.discTxConfig_r12; + return sl_DiscConfig; } + RRC_status_t rrc_rx_tx( - protocol_ctxt_t* const ctxt_pP, - const int CC_id + protocol_ctxt_t *const ctxt_pP, + const int CC_id ) //----------------------------------------------------------------------------- { - //uint8_t UE_id; - int32_t current_timestamp_ms, ref_timestamp_ms; + int32_t current_timestamp_ms = 0; + int32_t ref_timestamp_ms = 0; struct timeval ts; - struct rrc_eNB_ue_context_s *ue_context_p = NULL,*ue_to_be_removed = NULL; - + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_to_be_removed = NULL; #ifdef LOCALIZATION - double estimated_distance; - protocol_ctxt_t ctxt; + double estimated_distance = 0; + protocol_ctxt_t ctxt; #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX, VCD_FUNCTION_IN); + check_handovers(ctxt_pP); // counter, get the value and aggregate + // check for UL failure or for UE to be released + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + ctxt_pP->rnti = ue_context_p->ue_id_rnti; - check_handovers(ctxt_pP); - // counetr, and get the value and aggregate + if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe == 0)) { + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + LOG_I(RRC, "UE rnti %x: S-TMSI %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.ul_failure_timer); + } else { + LOG_I(RRC, "UE rnti %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.ul_failure_timer); + } + } - // check for UL failure - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt_pP->rnti = ue_context_p->ue_id_rnti; - if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { - LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.ul_failure_timer); - } - else { - LOG_I(RRC,"UE rnti %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.ul_failure_timer); - } + if (ue_context_p->ue_context.ul_failure_timer > 0) { + ue_context_p->ue_context.ul_failure_timer++; + + if (ue_context_p->ue_context.ul_failure_timer >= 20000) { + // remove UE after 20 seconds after MAC (or else) has indicated UL failure + LOG_I(RRC, "Removing UE %x instance, because of uplink failure timer timeout\n", + ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; // break RB_FOREACH } - if (ue_context_p->ue_context.ul_failure_timer>0) { - ue_context_p->ue_context.ul_failure_timer++; - if (ue_context_p->ue_context.ul_failure_timer >= 20000) { - // remove UE after 20 seconds after MAC has indicated UL failure - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } - } - if (ue_context_p->ue_context.ue_release_timer_s1>0) { - ue_context_p->ue_context.ue_release_timer_s1++; - if (ue_context_p->ue_context.ue_release_timer_s1 >= - ue_context_p->ue_context.ue_release_timer_thres_s1) { - LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", - ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); -// ue_context_p->ue_context.ue_release_timer_s1 = 0; + } + + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) { + ue_context_p->ue_context.ue_release_timer_s1++; + + if (ue_context_p->ue_context.ue_release_timer_s1 >= ue_context_p->ue_context.ue_release_timer_thres_s1) { + LOG_I(RRC, "Removing UE %x instance, because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.ue_release_timer_thres_s1); #if defined(ENABLE_USE_MME) #if defined(ENABLE_ITTI) - rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); + rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); #endif #else - ue_to_be_removed = ue_context_p; + ue_to_be_removed = ue_context_p; #endif - ue_context_p->ue_context.ue_release_timer_s1 = 0; - break; - } - } + ue_context_p->ue_context.ue_release_timer_s1 = 0; + break; // break RB_FOREACH + } // end if timer_s1 timeout + } // end if timer_s1 > 0 (S1 UE_CONTEXT_RELEASE_REQ ongoing) - if (ue_context_p->ue_context.ue_release_timer_rrc>0) { - ue_context_p->ue_context.ue_release_timer_rrc++; - if (ue_context_p->ue_context.ue_release_timer_rrc >= - ue_context_p->ue_context.ue_release_timer_thres_rrc) { - LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ue_release_timer_rrc = 0; - ue_to_be_removed = ue_context_p; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - break; - } + if (ue_context_p->ue_context.ue_release_timer_rrc > 0) { + ue_context_p->ue_context.ue_release_timer_rrc++; + + if (ue_context_p->ue_context.ue_release_timer_rrc >= ue_context_p->ue_context.ue_release_timer_thres_rrc) { + LOG_I(RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n", + ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ue_release_timer_rrc = 0; + ue_to_be_removed = ue_context_p; + break; // break RB_FOREACH } - pthread_mutex_lock(&rrc_release_freelist); - if(rrc_release_info.num_UEs > 0){ - uint16_t release_total = 0; - for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ - if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){ - release_total++; - } - if( (rrc_release_info.RRC_release_ctrl[release_num].flag > 2) && - (rrc_release_info.RRC_release_ctrl[release_num].rnti == ue_context_p->ue_context.rnti)){ - ue_context_p->ue_context.ue_release_timer_rrc = 1; - ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; + } + + pthread_mutex_lock(&rrc_release_freelist); + + if (rrc_release_info.num_UEs > 0) { + uint16_t release_total = 0; + + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag > 0) { + release_total++; + } + + if ((rrc_release_info.RRC_release_ctrl[release_num].flag > 2) && + (rrc_release_info.RRC_release_ctrl[release_num].rnti == ue_context_p->ue_context.rnti)) { + ue_context_p->ue_context.ue_release_timer_rrc = 1; + ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; #if defined(ENABLE_USE_MME) #if defined(ENABLE_ITTI) - int e_rab; - MessageDef *msg_complete_p = NULL; - MessageDef *msg_delete_tunnels_p = NULL; - uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; - if(rrc_release_info.RRC_release_ctrl[release_num].flag == 4){ - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); - } - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - // do not wait response - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = - ue_context_p->ue_context.enb_gtp_ebi[e_rab]; - // erase data - ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; - } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( - RC.rrc[ctxt_pP->module_id], - 0, - eNB_ue_s1ap_id); - if (NULL != rrc_ue_s1ap_ids) { - rrc_eNB_S1AP_remove_ue_ids( - RC.rrc[ctxt_pP->module_id], - rrc_ue_s1ap_ids); - } -#endif -#endif - rrc_release_info.RRC_release_ctrl[release_num].flag = 0; - rrc_release_info.num_UEs--; - break; - } - if(release_total >= rrc_release_info.num_UEs) - break; - } - } - pthread_mutex_unlock(&rrc_release_freelist); + int e_rab = 0; + MessageDef *msg_complete_p = NULL; + MessageDef *msg_delete_tunnels_p = NULL; + uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; - if (ue_context_p->ue_context.ue_reestablishment_timer>0) { - ue_context_p->ue_context.ue_reestablishment_timer++; - if (ue_context_p->ue_context.ue_reestablishment_timer >= - ue_context_p->ue_context.ue_reestablishment_timer_thres) { - LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - ue_to_be_removed = ue_context_p; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - break; + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 4) { // if timer_s1 == 0 + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); + msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; + itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_complete_p); + } + + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + // do not wait response + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + + for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = + ue_context_p->ue_context.enb_gtp_ebi[e_rab]; + // erase data + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + + itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; + rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); + + if (rrc_ue_s1ap_ids != NULL) { + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[ctxt_pP->module_id], rrc_ue_s1ap_ids); + } + +#endif +#endif + rrc_release_info.RRC_release_ctrl[release_num].flag = 0; + rrc_release_info.num_UEs--; + break; // break for (release_num) + } // end if ((rrc_release_info.RRC_release_ctrl[release_num].flag > 2) && ... + + if (release_total >= rrc_release_info.num_UEs) { + break; // break for (release_num) } - } + } // end for (release_num) + } // end if (rrc_release_info.num_UEs > 0) - if (ue_context_p->ue_context.ue_release_timer>0) { - ue_context_p->ue_context.ue_release_timer++; - if (ue_context_p->ue_context.ue_release_timer >= - ue_context_p->ue_context.ue_release_timer_thres) { - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - ue_context_p->ue_context.ue_release_timer = 0; - break; - } + pthread_mutex_unlock(&rrc_release_freelist); + + if ((ue_context_p->ue_context.ue_rrc_inactivity_timer > 0) && (RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres > 0)) { + ue_context_p->ue_context.ue_rrc_inactivity_timer++; // (un)comment this line to (de)activate the RRC inactivity timer + + if (ue_context_p->ue_context.ue_rrc_inactivity_timer >= RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres) { + LOG_I(RRC, "Removing UE %x instance because of rrc_inactivity_timer timeout\n", + ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; // break RB_FOREACH } } - if (ue_to_be_removed) { - if(ue_to_be_removed->ue_context.ul_failure_timer >= 20000) { - ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; - ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; - ue_to_be_removed->ue_context.ue_release_timer = 0; - ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; - } - rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); - if(ue_to_be_removed->ue_context.ul_failure_timer >= 20000){ - ue_to_be_removed->ue_context.ul_failure_timer = 0; + + if (ue_context_p->ue_context.ue_reestablishment_timer > 0) { + ue_context_p->ue_context.ue_reestablishment_timer++; + + if (ue_context_p->ue_context.ue_reestablishment_timer >= ue_context_p->ue_context.ue_reestablishment_timer_thres) { + LOG_I(RRC, "Removing UE %x instance because of reestablishment_timer timeout\n", + ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; // lead to send S1 UE_CONTEXT_RELEASE_REQ + ue_to_be_removed = ue_context_p; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + break; // break RB_FOREACH } } + if (ue_context_p->ue_context.ue_release_timer > 0) { + ue_context_p->ue_context.ue_release_timer++; + + if (ue_context_p->ue_context.ue_release_timer >= ue_context_p->ue_context.ue_release_timer_thres) { + LOG_I(RRC, "Removing UE %x instance because of RRC Connection Setup timer timeout\n", + ue_context_p->ue_context.rnti); + /* + * TODO: Naming problem here: ue_release_timer seems to have been used when RRC Connection Release was sent. + * It is no more the case. + * The timer should be renamed. + */ + ue_to_be_removed = ue_context_p; + ue_context_p->ue_context.ue_release_timer = 0; + break; // break RB_FOREACH + } + } + } // end RB_FOREACH + + if (ue_to_be_removed) { + if ((ue_to_be_removed->ue_context.ul_failure_timer >= 20000) || + ((ue_to_be_removed->ue_context.ue_rrc_inactivity_timer >= RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres) && + (RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres > 0))) { + ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; + ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; + ue_to_be_removed->ue_context.ue_release_timer = 0; + ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; + } + + rrc_eNB_free_UE(ctxt_pP->module_id, ue_to_be_removed); + + if (ue_to_be_removed->ue_context.ul_failure_timer >= 20000) { + ue_to_be_removed->ue_context.ul_failure_timer = 0; + } + + if ((ue_to_be_removed->ue_context.ue_rrc_inactivity_timer >= RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres) && + (RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres > 0)) { + ue_to_be_removed->ue_context.ue_rrc_inactivity_timer = 0; //reset timer after S1 command UE context release request is sent + } + } + #ifdef RRC_LOCALIZATION + /* for the localization, only primary CC_id might be relevant*/ + gettimeofday(&ts, NULL); + current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; + ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + ctxt = *ctxt_pP; + ctxt.rnti = ue_context_p->ue_context.rnti; + estimated_distance = rrc_get_estimated_ue_distance(&ctxt, CC_id, RC.rrc[ctxt_pP->module_id]->loc_type); - /* for the localization, only primary CC_id might be relevant*/ - gettimeofday(&ts, NULL); - current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; - ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt = *ctxt_pP; - ctxt.rnti = ue_context_p->ue_context.rnti; - estimated_distance = rrc_get_estimated_ue_distance( - &ctxt, - CC_id, - RC.rrc[ctxt_pP->module_id]->loc_type); - - if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && - estimated_distance != -1) { - LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", - ctxt.rnti, - ctxt_pP->module_id, - current_timestamp_ms, - ctxt_pP->frame, - estimated_distance); - LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status); - push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, - estimated_distance); - RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; - } - } - + if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && + estimated_distance != -1) { + LOG_D(LOCALIZE, "RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", + ctxt.rnti, + ctxt_pP->module_id, + current_timestamp_ms, + ctxt_pP->frame, + estimated_distance); + LOG_D(LOCALIZE, "RRC status %d\n", + ue_context_p->ue_context.Status); + push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, estimated_distance); + RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; + } // end if + } // end RB_FOREACH #endif - (void)ts; /* remove gcc warning "unused variable" */ - (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ - (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return (RRC_OK); + (void)ts; /* remove gcc warning "unused variable" */ + (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ + (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX, VCD_FUNCTION_OUT); + return RRC_OK; } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index d225b6eae0..56219d9ebd 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -37,22 +37,26 @@ # include "enb_config.h" # include "common/ran_context.h" -# if defined(ENABLE_ITTI) -# include "asn1_conversions.h" -# include "intertask_interface.h" -# include "pdcp.h" -# include "pdcp_primitives.h" -# include "s1ap_eNB.h" -# else -# include "../../S1AP/s1ap_eNB.h" -# endif +# include "s1ap_eNB_defs.h" +# include "s1ap_eNB_management_procedures.h" +# include "s1ap_eNB_ue_context.h" + +#if defined(ENABLE_ITTI) + #include "asn1_conversions.h" + #include "intertask_interface.h" + #include "pdcp.h" + #include "pdcp_primitives.h" + #include "s1ap_eNB.h" +#else + #include "../../S1AP/s1ap_eNB.h" +#endif #if defined(ENABLE_SECURITY) -# include "UTIL/OSA/osa_defs.h" + #include "UTIL/OSA/osa_defs.h" #endif #include "msc.h" -#include "UERadioAccessCapabilityInformation.h" +#include "LTE_UERadioAccessCapabilityInformation.h" #include "gtpv1u_eNB_task.h" #include "RRC/LTE/rrc_eNB_GTPV1U.h" @@ -74,33 +78,30 @@ static const uint16_t S1AP_ENCRYPTION_EEA2_MASK = 0x4000; static const uint16_t S1AP_INTEGRITY_EIA1_MASK = 0x8000; static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000; -#if (RRC_VERSION >= MAKE_VERSION(9, 2, 0)) -# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_eia0_v920 +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 2, 0)) + #define INTEGRITY_ALGORITHM_NONE LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia0_v920 #else -#ifdef EXMIMO_IOT -# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_eia2 -#else -# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_reserved -#endif + #ifdef EXMIMO_IOT + #define INTEGRITY_ALGORITHM_NONE LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia2 + #else + #define INTEGRITY_ALGORITHM_NONE LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_reserved + #endif #endif -void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_context_pP) -{ +void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_context_pP) { /* Process NAS message locally to get the IMSI */ nas_message_t nas_msg; memset(&nas_msg, 0, sizeof(nas_message_t)); - int size = 0; - nas_message_security_header_t *header = &nas_msg.header; /* Decode the first octet of the header (security header type or EPS * bearer identity, and protocol discriminator) */ - DECODE_U8((char *) pdu_buf, *(uint8_t*) (header), size); + DECODE_U8((char *) pdu_buf, *(uint8_t *) (header), size); /* Decode NAS message only if decodable*/ if (!(header->security_header_type <= SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED - && header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE - && pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE)) + && header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE + && pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE)) return; if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { @@ -114,11 +115,9 @@ void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_c * can modify it as we want. The callee retains the original address! */ pdu_buf += size; pdu_len -= size; - /* Decode plain NAS message */ EMM_msg *e_msg = &nas_msg.plain.emm; emm_msg_header_t *emm_header = &e_msg->header; - /* First decode the EMM message header */ int e_head_size = 0; @@ -161,9 +160,13 @@ void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_c # if defined(ENABLE_ITTI) //------------------------------------------------------------------------------ -struct rrc_ue_s1ap_ids_s* +/* +* Get the UE S1 struct containing hashtables S1_id/UE_id. +* Is also used to set the S1_id of the UE, depending on inputs. +*/ +struct rrc_ue_s1ap_ids_s * rrc_eNB_S1AP_get_ue_ids( - eNB_RRC_INST* const rrc_instance_pP, + eNB_RRC_INST *const rrc_instance_pP, const uint16_t ue_initial_id, const uint32_t eNB_ue_s1ap_id ) @@ -171,48 +174,136 @@ rrc_eNB_S1AP_get_ue_ids( { rrc_ue_s1ap_ids_t *result = NULL; rrc_ue_s1ap_ids_t *result2 = NULL; + /*****************************/ + instance_t instance = 0; + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + s1ap_eNB_ue_context_t *ue_desc_p = NULL; + rrc_eNB_ue_context_t *ue_context_p = NULL; + /*****************************/ hashtable_rc_t h_rc; - // we assume that a rrc_ue_s1ap_ids_s is initially inserted in initial_id2_s1ap_ids - if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result); - } if (ue_initial_id != UE_INITIAL_ID_INVALID) { - h_rc = hashtable_get(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&result); - if (h_rc == HASH_TABLE_OK) { - if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result2); - if (h_rc != HASH_TABLE_OK) { - result2 = malloc(sizeof(*result2)); - if (NULL != result2) { - *result2 = *result; - result2->eNB_ue_s1ap_id = eNB_ue_s1ap_id; - result->eNB_ue_s1ap_id = eNB_ue_s1ap_id; - h_rc = hashtable_insert(rrc_instance_pP->s1ap_id2_s1ap_ids, - (hash_key_t)eNB_ue_s1ap_id, - result2); + h_rc = hashtable_get(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&result); + + if (h_rc == HASH_TABLE_OK) { + if (eNB_ue_s1ap_id > 0) { + h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&result2); + + if (h_rc != HASH_TABLE_OK) { // this case is equivalent to associate eNB_ue_s1ap_id and ue_initial_id + result2 = malloc(sizeof(*result2)); + + if (NULL != result2) { + *result2 = *result; + result2->eNB_ue_s1ap_id = eNB_ue_s1ap_id; + result->eNB_ue_s1ap_id = eNB_ue_s1ap_id; + h_rc = hashtable_insert(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, result2); + if (h_rc != HASH_TABLE_OK) { LOG_E(S1AP, "[eNB %ld] Error while hashtable_insert in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32"\n", - rrc_instance_pP - RC.rrc[0], eNB_ue_s1ap_id); + rrc_instance_pP - RC.rrc[0], + eNB_ue_s1ap_id); } - } - } - } - } - } + } + } else { // here we should check that the association was done correctly + if ((result->ue_initial_id != result2->ue_initial_id) || (result->eNB_ue_s1ap_id != result2->eNB_ue_s1ap_id)) { + LOG_E(S1AP, "[eNB %ld] Error while hashtable_get, two rrc_ue_s1ap_ids_t that should be equal, are not:\n \ + ue_initial_id 1 = %"PRIu16",\n \ + ue_initial_id 2 = %"PRIu16",\n \ + eNB_ue_s1ap_id 1 = %"PRIu32",\n \ + eNB_ue_s1ap_id 2 = %"PRIu32"\n", + rrc_instance_pP - RC.rrc[0], + result->ue_initial_id, + result2->ue_initial_id, + result->eNB_ue_s1ap_id, + result2->eNB_ue_s1ap_id); + + // Still return *result + } + } + } // end if if (eNB_ue_s1ap_id > 0) + } else { // end if (h_rc == HASH_TABLE_OK) + LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in initial_id2_s1ap_ids ue_initial_id %"PRIu16"\n", + rrc_instance_pP - RC.rrc[0], + ue_initial_id); + + return NULL; + /* + * At the moment this is written, this case shouldn't (cannot) happen and is equivalent to an error. + * One could try to find the struct instance based on s1ap_id2_s1ap_ids and eNB_ue_s1ap_id (if > 0), + * but this behavior is not expected at the moment. + */ + } // end else (h_rc != HASH_TABLE_OK) + } else { // end if (ue_initial_id != UE_INITIAL_ID_INVALID) + if (eNB_ue_s1ap_id > 0) { + h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&result); + + if (h_rc != HASH_TABLE_OK) { + /* + * This case is uncommon, but can happen when: + * -> if the first NAS message was a Detach Request (non exhaustiv), the UE RRC context exist + * but is not associated with eNB_ue_s1ap_id + * -> ... (?) + */ + LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32", trying to find it through S1AP context\n", + rrc_instance_pP - RC.rrc[0], + eNB_ue_s1ap_id); + instance = ENB_MODULE_ID_TO_INSTANCE(rrc_instance_pP - RC.rrc[0]); // get eNB instance + s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); // get s1ap_eNB_instance + + if (s1ap_eNB_instance_p != NULL) { + ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, eNB_ue_s1ap_id); // get s1ap_eNB_ue_context + } else { + LOG_E(S1AP, "[eNB instance %d] Couldn't find the eNB S1AP context\n", + instance); + + return NULL; + } + + if (ue_desc_p != NULL) { + result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id); + + if (result != NULL) { + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instance)], result->ue_rnti); + + if ((ue_context_p != NULL) && (ue_context_p->ue_context.eNB_ue_s1ap_id == 0)) { + ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id; + } else { + LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n", + rrc_instance_pP - RC.rrc[0], + ue_context_p->ue_context.eNB_ue_s1ap_id, + eNB_ue_s1ap_id, + result->ue_rnti); + } + } + } else { + LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32", even when looking at S1AP context\n", + rrc_instance_pP - RC.rrc[0], + eNB_ue_s1ap_id); + + return NULL; + } + } // end if (h_rc != HASH_TABLE_OK) + } // end if (eNB_ue_s1ap_id > 0) + } // end else (ue_initial_id == UE_INITIAL_ID_INVALID) + return result; } + //------------------------------------------------------------------------------ +/* +* Remove UE ids (ue_initial_id and S1_id) from hashtables. +*/ void rrc_eNB_S1AP_remove_ue_ids( - eNB_RRC_INST* const rrc_instance_pP, - struct rrc_ue_s1ap_ids_s* const ue_ids_pP + eNB_RRC_INST *const rrc_instance_pP, + struct rrc_ue_s1ap_ids_s *const ue_ids_pP ) //------------------------------------------------------------------------------ { const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id; const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id; hashtable_rc_t h_rc; + if (rrc_instance_pP == NULL) { LOG_E(RRC, "Bad RRC instance\n"); return; @@ -224,21 +315,23 @@ rrc_eNB_S1AP_remove_ue_ids( } if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id); - if (h_rc != HASH_TABLE_OK) { - LOG_W(RRC, "S1AP Did not find entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); - } else { - LOG_W(RRC, "S1AP removed entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); - } + h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id); + + if (h_rc != HASH_TABLE_OK) { + LOG_W(RRC, "S1AP Did not find entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); + } else { + LOG_W(RRC, "S1AP removed entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); + } } if (ue_initial_id != UE_INITIAL_ID_INVALID) { h_rc = hashtable_remove(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id); - if (h_rc != HASH_TABLE_OK) { - LOG_W(RRC, "S1AP Did not find entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); - } else { - LOG_W(RRC, "S1AP removed entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); - } + + if (h_rc != HASH_TABLE_OK) { + LOG_W(RRC, "S1AP Did not find entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); + } else { + LOG_W(RRC, "S1AP removed entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); + } } } @@ -276,25 +369,17 @@ get_next_ue_initial_id( *\param eNB_ue_s1ap_id The value sent by S1AP. *\return the UE index or UE_INDEX_INVALID if not found. */ -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_get_ue_context_from_s1ap_ids( const instance_t instanceP, const uint16_t ue_initial_idP, const uint32_t eNB_ue_s1ap_idP -) -{ - rrc_ue_s1ap_ids_t* temp = NULL; - temp = - rrc_eNB_S1AP_get_ue_ids( - RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], - ue_initial_idP, - eNB_ue_s1ap_idP); +) { + rrc_ue_s1ap_ids_t *temp = NULL; + temp = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], ue_initial_idP, eNB_ue_s1ap_idP); - if (temp) { - - return rrc_eNB_get_ue_context( - RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], - temp->ue_rnti); + if (temp != NULL) { + return rrc_eNB_get_ue_context(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], temp->ue_rnti); } return NULL; @@ -305,21 +390,19 @@ rrc_eNB_get_ue_context_from_s1ap_ids( *\param algorithms The bit mask of available algorithms received from S1AP. *\return the selected algorithm. */ -static CipheringAlgorithm_r12_t rrc_eNB_select_ciphering(uint16_t algorithms) -{ - -//#warning "Forced return SecurityAlgorithmConfig__cipheringAlgorithm_eea0, to be deleted in future" - return CipheringAlgorithm_r12_eea0; +static LTE_CipheringAlgorithm_r12_t rrc_eNB_select_ciphering(uint16_t algorithms) { + //#warning "Forced return SecurityAlgorithmConfig__cipheringAlgorithm_eea0, to be deleted in future" + return LTE_CipheringAlgorithm_r12_eea0; if (algorithms & S1AP_ENCRYPTION_EEA2_MASK) { - return CipheringAlgorithm_r12_eea2; + return LTE_CipheringAlgorithm_r12_eea2; } if (algorithms & S1AP_ENCRYPTION_EEA1_MASK) { - return CipheringAlgorithm_r12_eea1; + return LTE_CipheringAlgorithm_r12_eea1; } - return CipheringAlgorithm_r12_eea0; + return LTE_CipheringAlgorithm_r12_eea0; } /*! \fn e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrity(uint16_t algorithms) @@ -327,15 +410,13 @@ static CipheringAlgorithm_r12_t rrc_eNB_select_ciphering(uint16_t algorithms) *\param algorithms The bit mask of available algorithms received from S1AP. *\return the selected algorithm. */ -static e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrity(uint16_t algorithms) -{ - +static e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrity(uint16_t algorithms) { if (algorithms & S1AP_INTEGRITY_EIA2_MASK) { - return SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; + return LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; } if (algorithms & S1AP_INTEGRITY_EIA1_MASK) { - return SecurityAlgorithmConfig__integrityProtAlgorithm_eia1; + return LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia1; } return INTEGRITY_ALGORITHM_NONE; @@ -350,18 +431,15 @@ static e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrit */ static int rrc_eNB_process_security( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - security_capabilities_t* security_capabilities_pP -) -{ - boolean_t changed = FALSE; - CipheringAlgorithm_r12_t cipheringAlgorithm; - e_SecurityAlgorithmConfig__integrityProtAlgorithm integrityProtAlgorithm; - + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + security_capabilities_t *security_capabilities_pP +) { + boolean_t changed = FALSE; + LTE_CipheringAlgorithm_r12_t cipheringAlgorithm; + e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrityProtAlgorithm; /* Save security parameters */ ue_context_pP->ue_context.security_capabilities = *security_capabilities_pP; - // translation LOG_D(RRC, "[eNB %d] NAS security_capabilities.encryption_algorithms %u AS ciphering_algorithm %lu NAS security_capabilities.integrity_algorithms %u AS integrity_algorithm %u\n", @@ -392,7 +470,6 @@ rrc_eNB_process_security( (unsigned long)cipheringAlgorithm, integrityProtAlgorithm, changed ? "changed" : "same"); - return changed; } @@ -404,16 +481,15 @@ rrc_eNB_process_security( */ //------------------------------------------------------------------------------ static void process_eNB_security_key ( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t* security_key_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t *security_key_pP ) //------------------------------------------------------------------------------ { #if defined(ENABLE_SECURITY) char ascii_buffer[65]; uint8_t i; - /* Saves the security key */ memcpy (ue_context_pP->ue_context.kenb, security_key_pP, SECURITY_KEY_LENGTH); memset (ue_context_pP->ue_context.nh, 0, SECURITY_KEY_LENGTH); @@ -424,7 +500,6 @@ static void process_eNB_security_key ( } ascii_buffer[2 * i] = '\0'; - LOG_I (RRC, "[eNB %d][UE %x] Saved security key %s\n", ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ascii_buffer); #endif } @@ -433,17 +508,14 @@ static void process_eNB_security_key ( //------------------------------------------------------------------------------ void rrc_pdcp_config_security( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const uint8_t send_security_mode_command ) //------------------------------------------------------------------------------ { - #if defined(ENABLE_SECURITY) - - - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; @@ -465,16 +537,13 @@ rrc_pdcp_config_security( derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, ue_context_pP->ue_context.kenb, &kRRCint); - #if !defined(USRP_REC_PLAY) SET_LOG_DUMP(DEBUG_SECURITY) ; #endif - if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) { if (print_keys ==1 ) { print_keys =0; - LOG_DUMPMSG(RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kenb, 32,"\nKeNB:" ); LOG_DUMPMSG(RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" ); LOG_DUMPMSG(RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" ); @@ -482,8 +551,7 @@ rrc_pdcp_config_security( } key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); - h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); - + h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { pdcp_config_set_security( @@ -511,8 +579,8 @@ rrc_pdcp_config_security( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //------------------------------------------------------------------------------ { @@ -520,7 +588,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_RESP); S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; @@ -551,11 +618,8 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( ue_context_pP->ue_id_rnti, S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id, e_rabs_done, e_rabs_failed); - - S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } # endif @@ -563,55 +627,50 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_UPLINK_NAS( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* const ul_dcch_msg + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + LTE_UL_DCCH_Message_t *const ul_dcch_msg ) //------------------------------------------------------------------------------ { #if defined(ENABLE_ITTI) { - ULInformationTransfer_t *ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice.ulInformationTransfer; + LTE_ULInformationTransfer_t *ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice.ulInformationTransfer; - if ((ulInformationTransfer->criticalExtensions.present == ULInformationTransfer__criticalExtensions_PR_c1) - && (ulInformationTransfer->criticalExtensions.choice.c1.present - == ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) - && (ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present - == ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { + if ((ulInformationTransfer->criticalExtensions.present == LTE_ULInformationTransfer__criticalExtensions_PR_c1) + && (ulInformationTransfer->criticalExtensions.choice.c1.present + == LTE_ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) + && (ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present + == LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { /* This message hold a dedicated info NAS payload, forward it to NAS */ - struct ULInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = - &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType; + struct LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = + &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType; uint32_t pdu_length; uint8_t *pdu_buffer; MessageDef *msg_p; - pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UPLINK_NAS); S1AP_UPLINK_NAS (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; - extract_imsi(S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer, S1AP_UPLINK_NAS (msg_p).nas_pdu.length, ue_context_pP); - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } } #else { - ULInformationTransfer_t *ulInformationTransfer; + LTE_ULInformationTransfer_t *ulInformationTransfer; ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice. ulInformationTransfer; if (ulInformationTransfer->criticalExtensions.present == - ULInformationTransfer__criticalExtensions_PR_c1) { + LTE_ULInformationTransfer__criticalExtensions_PR_c1) { if (ulInformationTransfer->criticalExtensions.choice.c1.present == - ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) { - + LTE_ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) { ULInformationTransfer_r8_IEs_t *ulInformationTransferR8; ulInformationTransferR8 = @@ -619,15 +678,13 @@ rrc_eNB_send_S1AP_UPLINK_NAS( c1.choice.ulInformationTransfer_r8; if (ulInformationTransferR8->dedicatedInfoType.present == - ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) { - + LTE_ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) { extract_imsi(ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size, ue_context_pP); - s1ap_eNB_new_data_request (mod_id, ue_index, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size); + ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, + ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size); } } } @@ -637,123 +694,116 @@ rrc_eNB_send_S1AP_UPLINK_NAS( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* ul_dcch_msg + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + LTE_UL_DCCH_Message_t *ul_dcch_msg ) //------------------------------------------------------------------------------ { - UECapabilityInformation_t *ueCapabilityInformation = &ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation; + LTE_UECapabilityInformation_t *ueCapabilityInformation = &ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation; /* 4096 is arbitrary, should be big enough */ unsigned char buf[4096]; unsigned char *buf2; - UERadioAccessCapabilityInformation_t rac; + LTE_UERadioAccessCapabilityInformation_t rac; - if (ueCapabilityInformation->criticalExtensions.present != UECapabilityInformation__criticalExtensions_PR_c1 - || ueCapabilityInformation->criticalExtensions.choice.c1.present != UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8) { + if (ueCapabilityInformation->criticalExtensions.present != LTE_UECapabilityInformation__criticalExtensions_PR_c1 + || ueCapabilityInformation->criticalExtensions.choice.c1.present != LTE_UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8) { LOG_E(RRC, "[eNB %d][UE %x] bad UE capabilities\n", ctxt_pP->module_id, ue_context_pP->ue_context.rnti); return; } - asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, NULL, ueCapabilityInformation, buf, 4096); + asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_LTE_UECapabilityInformation, NULL, ueCapabilityInformation, buf, 4096); if (ret.encoded == -1) abort(); - memset(&rac, 0, sizeof(UERadioAccessCapabilityInformation_t)); - - rac.criticalExtensions.present = UERadioAccessCapabilityInformation__criticalExtensions_PR_c1; - rac.criticalExtensions.choice.c1.present = UERadioAccessCapabilityInformation__criticalExtensions__c1_PR_ueRadioAccessCapabilityInformation_r8; + memset(&rac, 0, sizeof(LTE_UERadioAccessCapabilityInformation_t)); + rac.criticalExtensions.present = LTE_UERadioAccessCapabilityInformation__criticalExtensions_PR_c1; + rac.criticalExtensions.choice.c1.present = LTE_UERadioAccessCapabilityInformation__criticalExtensions__c1_PR_ueRadioAccessCapabilityInformation_r8; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.buf = buf; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.size = (ret.encoded+7)/8; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.nonCriticalExtension = NULL; - /* 8192 is arbitrary, should be big enough */ buf2 = malloc16(8192); + if (buf2 == NULL) abort(); - ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, NULL, &rac, buf2, 8192); + ret = uper_encode_to_buffer(&asn_DEF_LTE_UERadioAccessCapabilityInformation, NULL, &rac, buf2, 8192); if (ret.encoded == -1) abort(); MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CAPABILITIES_IND); S1AP_UE_CAPABILITIES_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.length = (ret.encoded+7)/8; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.buffer = buf2; - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } //------------------------------------------------------------------------------ +/* +* Initial UE NAS message on S1AP. +*/ void rrc_eNB_send_S1AP_NAS_FIRST_REQ( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + LTE_RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete ) //------------------------------------------------------------------------------ - - { - eNB_RRC_INST *rrc=RC.rrc[ctxt_pP->module_id]; + eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; #if defined(ENABLE_ITTI) { - MessageDef* message_p = NULL; - rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; + MessageDef *message_p = NULL; + rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL; hashtable_rc_t h_rc; - - message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_FIRST_REQ); + message_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_NAS_FIRST_REQ); memset(&message_p->ittiMsg.s1ap_nas_first_req, 0, sizeof(s1ap_nas_first_req_t)); - - ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id (ctxt_pP->module_id); - S1AP_NAS_FIRST_REQ (message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; - + ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id); + S1AP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p = malloc(sizeof(*rrc_ue_s1ap_ids_p)); rrc_ue_s1ap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID; rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - h_rc = hashtable_insert(RC.rrc[ctxt_pP->module_id]->initial_id2_s1ap_ids, - (hash_key_t)ue_context_pP->ue_context.ue_initial_id, - rrc_ue_s1ap_ids_p); + (hash_key_t)ue_context_pP->ue_context.ue_initial_id, + rrc_ue_s1ap_ids_p); + if (h_rc != HASH_TABLE_OK) { LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n", - ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id); + ctxt_pP->module_id, + ue_context_pP->ue_context.ue_initial_id); } /* Assume that cause is coded in the same way in RRC and S1ap, just check that the value is in S1ap range */ AssertFatal(ue_context_pP->ue_context.establishment_cause < RRC_CAUSE_LAST, - "Establishment cause invalid (%jd/%d) for eNB %d!", - ue_context_pP->ue_context.establishment_cause, RRC_CAUSE_LAST, ctxt_pP->module_id); - + "Establishment cause invalid (%jd/%d) for eNB %d!", + ue_context_pP->ue_context.establishment_cause, + RRC_CAUSE_LAST, + ctxt_pP->module_id); S1AP_NAS_FIRST_REQ (message_p).establishment_cause = ue_context_pP->ue_context.establishment_cause; - - /* Forward NAS message */S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer = - rrcConnectionSetupComplete->dedicatedInfoNAS.buf; + /* Forward NAS message */ + S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer = rrcConnectionSetupComplete->dedicatedInfoNAS.buf; S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length = rrcConnectionSetupComplete->dedicatedInfoNAS.size; - extract_imsi(S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer, S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length, ue_context_pP); - /* Fill UE identities with available information */ { S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask = UE_IDENTITIES_NONE; if (ue_context_pP->ue_context.Initialue_identity_s_TMSI.presence) { /* Fill s-TMSI */ - UE_S_TMSI* s_TMSI = &ue_context_pP->ue_context.Initialue_identity_s_TMSI; - + UE_S_TMSI *s_TMSI = &ue_context_pP->ue_context.Initialue_identity_s_TMSI; S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask |= UE_IDENTITIES_s_tmsi; S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code = s_TMSI->mme_code; S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi = s_TMSI->m_tmsi; LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ with s_TMSI: MME code %u M-TMSI %u ue %x\n", - ctxt_pP->module_id, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi, - ue_context_pP->ue_context.rnti); - } + ctxt_pP->module_id, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi, + ue_context_pP->ue_context.rnti); + } // end if S-TMSI presence /* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */ int selected_plmn_identity = rrcConnectionSetupComplete->selectedPLMN_Identity - 1; @@ -761,8 +811,7 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( if (rrcConnectionSetupComplete->registeredMME != NULL) { /* Fill GUMMEI */ - struct RegisteredMME *r_mme = rrcConnectionSetupComplete->registeredMME; - + struct LTE_RegisteredMME *r_mme = rrcConnectionSetupComplete->registeredMME; S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask |= UE_IDENTITIES_gummei; if (r_mme->plmn_Identity != NULL) { @@ -770,9 +819,9 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( /* Use first indicated PLMN MCC if it is defined */ S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc = *r_mme->plmn_Identity->mcc->list.array[selected_plmn_identity]; LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", - ctxt_pP->module_id, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc, - ue_context_pP->ue_context.rnti); + ctxt_pP->module_id, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc, + ue_context_pP->ue_context.rnti); } if (r_mme->plmn_Identity->mnc.list.count > 0) { @@ -783,32 +832,29 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc, ue_context_pP->ue_context.rnti); } - } else { + } else { // end if plmn_Identity != NULL S1AP_NAS_FIRST_REQ(message_p).ue_identity.gummei.mcc = rrc->configuration.mcc[selected_plmn_identity]; S1AP_NAS_FIRST_REQ(message_p).ue_identity.gummei.mnc = rrc->configuration.mnc[selected_plmn_identity]; S1AP_NAS_FIRST_REQ(message_p).ue_identity.gummei.mnc_len = rrc->configuration.mnc_digit_length[selected_plmn_identity]; - } + } // end else (plmn_Identity == NULL) S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code = BIT_STRING_to_uint8 (&r_mme->mmec); S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_group_id = BIT_STRING_to_uint16 (&r_mme->mmegi); - - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)&message_p->ittiMsg.s1ap_nas_first_req, - sizeof(s1ap_nas_first_req_t), - MSC_AS_TIME_FMT" S1AP_NAS_FIRST_REQ eNB %u UE %x", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->module_id, - ctxt_pP->rnti); - + MSC_LOG_TX_MESSAGE(MSC_S1AP_ENB, + MSC_S1AP_MME, + (const char *)&message_p->ittiMsg.s1ap_nas_first_req, + sizeof(s1ap_nas_first_req_t), + MSC_AS_TIME_FMT" S1AP_NAS_FIRST_REQ eNB %u UE %x", + MSC_AS_TIME_ARGS(ctxt_pP), + ctxt_pP->module_id, + ctxt_pP->rnti); LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI mme_code %u mme_group_id %u ue %x\n", ctxt_pP->module_id, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_group_id, ue_context_pP->ue_context.rnti); - } - } + } // end if MME info present + } // end "Fill UE identities with available information" sub-part itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, message_p); } #else @@ -828,10 +874,10 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( //------------------------------------------------------------------------------ int rrc_eNB_process_S1AP_DOWNLINK_NAS( - MessageDef* msg_p, - const char* msg_name, + MessageDef *msg_p, + const char *msg_name, instance_t instance, - mui_t* rrc_eNB_mui + mui_t *rrc_eNB_mui ) //------------------------------------------------------------------------------ { @@ -839,15 +885,12 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( uint32_t eNB_ue_s1ap_id; uint32_t length; uint8_t *buffer; - uint8_t srb_id; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t srb_id; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; ue_initial_id = S1AP_DOWNLINK_NAS (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d\n", instance, msg_name, @@ -855,7 +898,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( eNB_ue_s1ap_id); if (ue_context_p == NULL) { - MSC_LOG_RX_MESSAGE( MSC_RRC_ENB, MSC_S1AP_ENB, @@ -865,20 +907,14 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, eNB_ue_s1ap_id); - /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_DOWNLINK_NAS: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_NON_DELIVERY_IND); S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.length = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.buffer = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer; - // TODO add failure cause when defined! - - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_S1AP_ENB, @@ -888,14 +924,11 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, eNB_ue_s1ap_id); - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); - srb_id = ue_context_p->ue_context.Srb2.Srb_info.Srb_id; - /* Is it the first income from S1AP ? */ if (ue_context_p->ue_context.eNB_ue_s1ap_id == 0) { @@ -911,8 +944,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id); - - /* Create message for PDCP (DLInformationTransfer_t) */ length = do_DLInformationTransfer ( instance, @@ -920,37 +951,32 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( rrc_eNB_get_next_transaction_identifier (instance), S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length, S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer); - LOG_DUMPMSG(RRC,DEBUG_RRC,buffer,length,"[MSG] RRC DL Information Transfer\n"); - - /* - * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. + /* + * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. */ /* Transfer data to PDCP */ rrc_data_req ( - &ctxt, - srb_id, - *rrc_eNB_mui++, - SDU_CONFIRM_NO, - length, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + &ctxt, + srb_id, + *rrc_eNB_mui++, + SDU_CONFIRM_NO, + length, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); return (0); } } /*------------------------------------------------------------------------------*/ -int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { uint16_t ue_initial_id; uint32_t eNB_ue_s1ap_id; //MessageDef *message_gtpv1u_p = NULL; gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; - uint8_t inde_list[NB_RB_MAX - 3]={0}; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t inde_list[NB_RB_MAX - 3]= {0}; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; @@ -961,63 +987,49 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int i; - - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); ue_context_p->ue_context.nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; - + for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) { ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; - - create_tunnel_req.eps_bearer_id[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].e_rab_id; create_tunnel_req.sgw_S1u_teid[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[i], &S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].sgw_addr, sizeof(transport_layer_addr_t)); inde_list[create_tunnel_req.num_tunnels]= i; create_tunnel_req.num_tunnels++; } - - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above -// create_tunnel_req.num_tunnels = i; + create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above + // create_tunnel_req.num_tunnels = i; gtpv1u_create_s1u_tunnel( instance, &create_tunnel_req, &create_tunnel_resp); - rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( - &ctxt, - &create_tunnel_resp, - &inde_list[0]); + &ctxt, + &create_tunnel_resp, + &inde_list[0]); ue_context_p->ue_context.setup_e_rabs=ue_context_p->ue_context.nb_of_e_rabs; } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; } - rrc_eNB_process_security ( &ctxt, ue_context_p, @@ -1026,10 +1038,8 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char &ctxt, ue_context_p, S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key); - { uint8_t send_security_mode_command = TRUE; - #ifndef EXMIMO_IOT if ((ue_context_p->ue_context.ciphering_algorithm == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) @@ -1044,7 +1054,6 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char send_security_mode_command); if (send_security_mode_command) { - rrc_eNB_generate_SecurityModeCommand ( &ctxt, ue_context_p); @@ -1063,30 +1072,23 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char } /*------------------------------------------------------------------------------*/ -int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; - eNB_ue_s1ap_id = S1AP_UE_CTXT_MODIFICATION_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CTXT_MODIFICATION_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_FAIL); S1AP_UE_CTXT_MODIFICATION_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); /* TODO parameters yet to process ... */ { @@ -1112,85 +1114,72 @@ int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char &ctxt, ue_context_p, S1AP_UE_CTXT_MODIFICATION_REQ(msg_p).security_key); - /* TODO reconfigure lower layers... */ } /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_RESP); S1AP_UE_CTXT_MODIFICATION_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } - return (0); } } /*------------------------------------------------------------------------------*/ -int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char *msg_name, instance_t instance) { uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - + struct rrc_eNB_ue_context_s *ue_context_p = NULL; eNB_ue_s1ap_id = S1AP_UE_CONTEXT_RELEASE_REQ(msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); /* TODO change message ID. */ S1AP_UE_CONTEXT_RELEASE_RESP(msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); return (-1); } else { /* TODO release context. */ - /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); S1AP_UE_CONTEXT_RELEASE_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } - return (0); } } //------------------------------------------------------------------------------ -void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( - const module_id_t enb_mod_idP, - const rrc_eNB_ue_context_t* const ue_context_pP, - const s1ap_Cause_t causeP, - const long cause_valueP -) +/* +* Send the S1 command UE_CONTEXT_RELEASE_REQUEST to the MME. +*/ +void +rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( + const module_id_t enb_mod_idP, + const rrc_eNB_ue_context_t *const ue_context_pP, + const s1ap_Cause_t causeP, + const long cause_valueP) //------------------------------------------------------------------------------ { if (ue_context_pP == NULL) { - LOG_W(RRC, - "[eNB] In S1AP_UE_CONTEXT_RELEASE_COMMAND: invalid UE\n"); + LOG_E(RRC, "[eNB] In S1AP_UE_CONTEXT_RELEASE_REQ: invalid UE\n"); } else { - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); - + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL, + 0, + "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", + ue_context_pP->ue_context.eNB_ue_s1ap_id); MessageDef *msg_context_release_req_p = NULL; msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_REQ); S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; @@ -1201,81 +1190,65 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( } -/*------------------------------------------------------------------------------*/ -int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const char *msg_name, instance_t instance) -{ - uint32_t eNB_ue_s1ap_id; - protocol_ctxt_t ctxt; +//----------------------------------------------------------------------------- +/* +* Process the S1 command UE_CONTEXT_RELEASE_COMMAND, sent by MME. +* The eNB should remove all e-rab, S1 context, and other context of the UE. +*/ +int +rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND( + MessageDef *msg_p, + const char *msg_name, + instance_t instance) { + //----------------------------------------------------------------------------- + uint32_t eNB_ue_s1ap_id = 0; + protocol_ctxt_t ctxt; struct rrc_eNB_ue_context_s *ue_context_p = NULL; - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; - + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; eNB_ue_s1ap_id = S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p).eNB_ue_s1ap_id; - - - ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); + ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index */ - MessageDef *msg_complete_p; - - LOG_W(RRC, - "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", + MessageDef *msg_complete_p = NULL; + LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - - MSC_LOG_EVENT( - MSC_RRC_ENB, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", - eNB_ue_s1ap_id); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - + MSC_LOG_EVENT(MSC_RRC_ENB, "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", + eNB_ue_s1ap_id); + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL, + 0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p); + rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( - RC.rrc[instance], - UE_INITIAL_ID_INVALID, - eNB_ue_s1ap_id); - - if (NULL != rrc_ue_s1ap_ids) { - rrc_eNB_S1AP_remove_ue_ids( - RC.rrc[instance], - rrc_ue_s1ap_ids); + if (rrc_ue_s1ap_ids != NULL) { + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); } - return (-1); + + return -1; } else { ue_context_p->ue_context.ue_release_timer_s1 = 0; PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); rrc_eNB_generate_RRCConnectionRelease(&ctxt, ue_context_p); - /* - LOG_W(RRC, - "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_COMMAND: TODO call rrc_eNB_connection_release for eNB %d\n", - instance, - eNB_ue_s1ap_id); - */ - return (0); + return 0; } } -int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { uint16_t ue_initial_id; uint32_t eNB_ue_s1ap_id; gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; - uint8_t inde_list[NB_RB_MAX - 3]={0}; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t inde_list[NB_RB_MAX - 3]= {0}; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; uint8_t e_rab_done; - ue_initial_id = S1AP_E_RAB_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); @@ -1285,185 +1258,159 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_REQUEST_FAIL); S1AP_E_RAB_SETUP_REQ (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int i; - - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); uint8_t nb_e_rabs_tosetup = S1AP_E_RAB_SETUP_REQ (msg_p).nb_e_rabs_tosetup; e_rab_done = 0; // keep the previous bearer // the index for the rec - for (i = 0; - // i < nb_e_rabs_tosetup; - i < NB_RB_MAX - 3; // loop all e-rabs in e_rab[] - i++) { - //if (ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status == E_RAB_STATUS_DONE) - // LOG_W(RRC,"E-RAB already configured, reconfiguring\n"); + for (i = 0; + // i < nb_e_rabs_tosetup; + i < NB_RB_MAX - 3; // loop all e-rabs in e_rab[] + i++) { + //if (ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status == E_RAB_STATUS_DONE) + // LOG_W(RRC,"E-RAB already configured, reconfiguring\n"); // check e-rab status, if e rab status is greater than E_RAB_STATUS_DONE, don't not config this one if(ue_context_p->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) - continue; + continue; + //ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status = E_RAB_STATUS_NEW; //ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].param = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[i]; ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.e_rab[i].param = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done]; - create_tunnel_req.eps_bearer_id[e_rab_done] = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].e_rab_id; create_tunnel_req.sgw_S1u_teid[e_rab_done] = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[e_rab_done], & S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].sgw_addr, sizeof(transport_layer_addr_t)); - - LOG_I(RRC,"E_RAB setup REQ: local index %d teid %u, eps id %d \n", - i, - create_tunnel_req.sgw_S1u_teid[e_rab_done], - create_tunnel_req.eps_bearer_id[i] ); + LOG_I(RRC,"E_RAB setup REQ: local index %d teid %u, eps id %d \n", + i, + create_tunnel_req.sgw_S1u_teid[e_rab_done], + create_tunnel_req.eps_bearer_id[i] ); inde_list[e_rab_done] = i; - e_rab_done++; - if(e_rab_done >= nb_e_rabs_tosetup){ - break; + e_rab_done++; + + if(e_rab_done >= nb_e_rabs_tosetup) { + break; } } + ue_context_p->ue_context.nb_of_e_rabs=nb_e_rabs_tosetup; - - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above create_tunnel_req.num_tunnels = e_rab_done; - // NN: not sure if we should create a new tunnel: need to check teid, etc. gtpv1u_create_s1u_tunnel( instance, &create_tunnel_req, &create_tunnel_resp); - rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( - &ctxt, - &create_tunnel_resp, - &inde_list[0]); - + &ctxt, + &create_tunnel_resp, + &inde_list[0]); ue_context_p->ue_context.setup_e_rabs+=nb_e_rabs_tosetup; - } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; } - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0); - return (0); } } /*NN: careful about the typcast of xid (long -> uint8_t*/ -int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid ){ - +int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid ) { MessageDef *msg_p = NULL; int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_RESP); S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - - for (e_rab = 0; e_rab < ue_context_pP->ue_context.setup_e_rabs ; e_rab++) { - /* only respond to the corresponding transaction */ + for (e_rab = 0; e_rab < ue_context_pP->ue_context.setup_e_rabs ; e_rab++) { + /* only respond to the corresponding transaction */ //if (((xid+1)%4) == ue_context_pP->ue_context.e_rab[e_rab].xid) { if (xid == ue_context_pP->ue_context.e_rab[e_rab].xid) { - if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; - // TODO add other information from S1-U when it will be integrated - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab]; - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab]; - //S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length += 4; - ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - - LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ", - e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, - ue_context_pP->ue_context.nb_of_e_rabs, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[0], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[1], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[2], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[3]); - - e_rabs_done++; - } else if ((ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_NEW) || - (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){ - LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); - }else { /* to be improved */ - ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; - e_rabs_failed++; - // TODO add cause when it will be integrated - } - + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; + // TODO add other information from S1-U when it will be integrated + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab]; + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab]; + //S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length += 4; + ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ", + e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, + ue_context_pP->ue_context.nb_of_e_rabs, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[0], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[1], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[2], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[3]); + e_rabs_done++; + } else if ((ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_NEW) || + (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)) { + LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); + } else { /* to be improved */ + ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; + e_rabs_failed++; + // TODO add cause when it will be integrated + } + S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; - // NN: add conditions for e_rabs_failed + // NN: add conditions for e_rabs_failed } else { - /*debug info for the xid */ + /*debug info for the xid */ LOG_D(RRC,"xid does not corresponds (context e_rab index %d, status %d, xid %d/%d) \n ", - e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, ue_context_pP->ue_context.e_rab[e_rab].xid); - } + e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, ue_context_pP->ue_context.e_rab[e_rab].xid); + } } - if ((e_rabs_done > 0) ){ - LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n", - ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); - - - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); - } - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.e_rab[i].xid = -1; + if ((e_rabs_done > 0) ) { + LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n", + ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), + sizeof(s1ap_e_rab_setup_resp_t), + MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_id_rnti, + S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id, + e_rabs_done, e_rabs_failed); + itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } - + + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_pP->ue_context.e_rab[i].xid = -1; + } + return 0; } -int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { int i; uint16_t ue_initial_id; uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; - ue_initial_id = S1AP_E_RAB_MODIFY_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); @@ -1475,27 +1422,23 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_MODIFY_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; for (nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; nb_of_e_rabs_failed++) { S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - S1AP_E_RAB_MODIFY_REQ (msg_p).e_rab_modify_params[nb_of_e_rabs_failed].e_rab_id; + S1AP_E_RAB_MODIFY_REQ (msg_p).e_rab_modify_params[nb_of_e_rabs_failed].e_rab_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 31;//S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances; } - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; + S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); return (-1); - } else { PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int j; @@ -1509,9 +1452,10 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam // already treated continue; } + for (j = i+1; j < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; j++) { if (is_treated[j] == FALSE && - S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { + S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { // handle multiple E-RAB ID ue_context_p->ue_context.modify_e_rab[j].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.modify_e_rab[j].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id; @@ -1522,6 +1466,7 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam is_treated[j] = TRUE; } } + if (is_treated[i] == TRUE) { // handle multiple E-RAB ID ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW; @@ -1545,9 +1490,10 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam for (j = 0; j < NB_RB_MAX-3; j++) { if (ue_context_p->ue_context.e_rab[j].param.e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { - if(ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_TORELEASE || ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_DONE){ + if(ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_TORELEASE || ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_DONE) { break; } + ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_NOTHING; ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id; @@ -1556,7 +1502,6 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam ue_context_p->ue_context.modify_e_rab[i].param.nas_pdu.buffer = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].nas_pdu.buffer; ue_context_p->ue_context.modify_e_rab[i].param.sgw_addr = ue_context_p->ue_context.e_rab[j].param.sgw_addr; ue_context_p->ue_context.modify_e_rab[i].param.gtp_teid = ue_context_p->ue_context.e_rab[j].param.gtp_teid; - is_treated[i] = TRUE; break; } @@ -1576,7 +1521,6 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam ue_context_p->ue_context.nb_of_modify_e_rabs = S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; ue_context_p->ue_context.nb_of_failed_e_rabs = nb_of_failed_e_rabs; } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; @@ -1591,36 +1535,31 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam { int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; -// S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; + // S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < ue_context_p->ue_context.nb_of_failed_e_rabs; nb_of_e_rabs_failed++) { S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].param.e_rab_id; + ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].param.e_rab_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].cause; } + S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); - ue_context_p->ue_context.nb_of_modify_e_rabs = 0; ue_context_p->ue_context.nb_of_failed_e_rabs = 0; memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); - return (0); } } // end of ue_context_p != NULL } /*NN: careful about the typcast of xid (long -> uint8_t*/ -int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid ) { - +int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid ) { MessageDef *msg_p = NULL; int i; int e_rab; @@ -1630,7 +1569,6 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_modify_e_rabs; e_rab++) { - /* only respond to the corresponding transaction */ if (xid == ue_context_pP->ue_context.modify_e_rab[e_rab].xid) { if (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_DONE) { @@ -1643,202 +1581,200 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, break; } } + if (i < ue_context_pP->ue_context.setup_e_rabs) { S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; - // TODO add other information from S1-U when it will be integrated - + // TODO add other information from S1-U when it will be integrated LOG_D (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_modify_e_rabs %d, e_rab_id %d \n ", - e_rabs_done, e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, - ue_context_pP->ue_context.nb_of_modify_e_rabs, - S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id); - + e_rabs_done, e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, + ue_context_pP->ue_context.nb_of_modify_e_rabs, + S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id); e_rabs_done++; } else { // unexpected S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; - S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK; S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause_value = 30;//S1ap_CauseRadioNetwork_unknown_E_RAB_ID; - e_rabs_failed++; } } else if ((ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_NEW) || - (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){ + (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)) { LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); } else { /* status == E_RAB_STATUS_FAILED; */ S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; // add failure cause when defined S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = ue_context_pP->ue_context.modify_e_rab[e_rab].cause; - e_rabs_failed++; } } else { /*debug info for the xid */ LOG_D(RRC,"xid does not corresponds (context e_rab index %d, status %d, xid %d/%d) \n ", - e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, ue_context_pP->ue_context.modify_e_rab[e_rab].xid); + e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, ue_context_pP->ue_context.modify_e_rab[e_rab].xid); } } - S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; + // NN: add conditions for e_rabs_failed if (e_rabs_done > 0 || e_rabs_failed > 0) { LOG_D(RRC,"S1AP_E_RAB_MODIFY_RESP: sending the message: nb_of_modify_e_rabs %d, total e_rabs %d, index %d\n", - ue_context_pP->ue_context.nb_of_modify_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); -MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_MODIFY_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); - + ue_context_pP->ue_context.nb_of_modify_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), + sizeof(s1ap_e_rab_setup_resp_t), + MSC_AS_TIME_FMT" E_RAB_MODIFY_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_id_rnti, + S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id, + e_rabs_done, e_rabs_failed); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } return 0; } -int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance){ - uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - protocol_ctxt_t ctxt; - e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; - uint8_t nb_e_rabs_torelease; - int erab; - int i; - uint8_t b_existed,is_existed; - uint8_t xid; - uint8_t e_rab_release_drb; - MessageDef * msg_delete_tunnels_p = NULL; - e_rab_release_drb = 0; - memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB); +int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance) { + uint32_t eNB_ue_s1ap_id; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + protocol_ctxt_t ctxt; + e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; + uint8_t nb_e_rabs_torelease; + int erab; + int i; + uint8_t b_existed,is_existed; + uint8_t xid; + uint8_t e_rab_release_drb; + MessageDef *msg_delete_tunnels_p = NULL; + e_rab_release_drb = 0; + memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB); + eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id; + nb_e_rabs_torelease = S1AP_E_RAB_RELEASE_COMMAND (msg_p).nb_e_rabs_torelease; + ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); - eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id; - nb_e_rabs_torelease = S1AP_E_RAB_RELEASE_COMMAND (msg_p).nb_e_rabs_torelease; - ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); - if(ue_context_p != NULL){ - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); + if(ue_context_p != NULL) { + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); + xid = rrc_eNB_get_next_transaction_identifier(ctxt.module_id); + LOG_D(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d release_e_rabs %d \n", + S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, eNB_ue_s1ap_id,nb_e_rabs_torelease); - xid = rrc_eNB_get_next_transaction_identifier(ctxt.module_id); + for(erab = 0; erab < nb_e_rabs_torelease; erab++) { + b_existed = 0; + is_existed = 0; - LOG_D(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d release_e_rabs %d \n", - S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, eNB_ue_s1ap_id,nb_e_rabs_torelease); - for(erab = 0; erab < nb_e_rabs_torelease; erab++){ - b_existed = 0; - is_existed = 0; - for ( i = erab-1; i>= 0; i--){ - if (e_rab_release_params[erab].e_rab_id == e_rab_release_params[i].e_rab_id){ - is_existed = 1; - break; - } - } - if(is_existed == 1){ - //e_rab_id is existed - continue; - } - for ( i = 0; i < NB_RB_MAX; i++){ - if (e_rab_release_params[erab].e_rab_id == ue_context_p->ue_context.e_rab[i].param.e_rab_id){ - b_existed = 1; - break; - } - } - if(b_existed == 0) { - //no e_rab_id - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 30; - ue_context_p->ue_context.nb_release_of_e_rabs++; - } else { - if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_FAILED){ - ue_context_p->ue_context.e_rab[i].xid = xid; - continue; - } else if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED){ - ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE; - ue_context_p->ue_context.e_rab[i].xid = xid; - e_rab_release_drb++; - }else{ - //e_rab_id status NG - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 0; - ue_context_p->ue_context.nb_release_of_e_rabs++; - } - } + for ( i = erab-1; i>= 0; i--) { + if (e_rab_release_params[erab].e_rab_id == e_rab_release_params[i].e_rab_id) { + is_existed = 1; + break; } - if(e_rab_release_drb > 0) { - //RRCConnectionReconfiguration To UE - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer); + } + + if(is_existed == 1) { + //e_rab_id is existed + continue; + } + + for ( i = 0; i < NB_RB_MAX; i++) { + if (e_rab_release_params[erab].e_rab_id == ue_context_p->ue_context.e_rab[i].param.e_rab_id) { + b_existed = 1; + break; + } + } + + if(b_existed == 0) { + //no e_rab_id + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 30; + ue_context_p->ue_context.nb_release_of_e_rabs++; + } else { + if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_FAILED) { + ue_context_p->ue_context.e_rab[i].xid = xid; + continue; + } else if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) { + ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE; + ue_context_p->ue_context.e_rab[i].xid = xid; + e_rab_release_drb++; } else { - //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for(i = 0; i < NB_RB_MAX; i++){ - if(xid == ue_context_p->ue_context.e_rab[i].xid){ - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; - ue_context_p->ue_context.enb_gtp_teid[i] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); - ue_context_p->ue_context.enb_gtp_ebi[i] = 0; - } - } - - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); - - //S1AP_E_RAB_RELEASE_RESPONSE - rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); + //e_rab_id status NG + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 0; + ue_context_p->ue_context.nb_release_of_e_rabs++; } - } else { - LOG_E(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d Error ue_context_p NULL \n", - S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id); - return -1; + } } - return 0; + if(e_rab_release_drb > 0) { + //RRCConnectionReconfiguration To UE + rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer); + } else { + //gtp tunnel delete + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + + for(i = 0; i < NB_RB_MAX; i++) { + if(xid == ue_context_p->ue_context.e_rab[i].xid) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; + ue_context_p->ue_context.enb_gtp_teid[i] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); + ue_context_p->ue_context.enb_gtp_ebi[i] = 0; + } + } + + itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + //S1AP_E_RAB_RELEASE_RESPONSE + rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); + } + } else { + LOG_E(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d Error ue_context_p NULL \n", + S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id); + return -1; + } + + return 0; } -int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, uint8_t xid){ - int e_rabs_released = 0; - MessageDef *msg_p; +int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, uint8_t xid) { + int e_rabs_released = 0; + MessageDef *msg_p; + msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE); + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE); - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - - for (int i = 0; i < NB_RB_MAX; i++){ - if (xid == ue_context_pP->ue_context.e_rab[i].xid){ - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rab_release[e_rabs_released].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - e_rabs_released++; - //clear - memset(&ue_context_pP->ue_context.e_rab[i],0,sizeof(e_rab_param_t)); - } + for (int i = 0; i < NB_RB_MAX; i++) { + if (xid == ue_context_pP->ue_context.e_rab[i].xid) { + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rab_release[e_rabs_released].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + e_rabs_released++; + //clear + memset(&ue_context_pP->ue_context.e_rab[i],0,sizeof(e_rab_param_t)); } - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_released = e_rabs_released; - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_failed = ue_context_pP->ue_context.nb_release_of_e_rabs; - memcpy(&(S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rabs_failed[0]),&ue_context_pP->ue_context.e_rabs_release_failed[0],sizeof(e_rab_failed_t)*ue_context_pP->ue_context.nb_release_of_e_rabs); + } - ue_context_pP->ue_context.setup_e_rabs -= e_rabs_released; - LOG_I(RRC,"S1AP-E-RAB RELEASE RESPONSE: ENB_UE_S1AP_ID %d release_e_rabs %d setup_e_rabs %d \n", - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id, - e_rabs_released, ue_context_pP->ue_context.setup_e_rabs); - - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); - //clear xid - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.e_rab[i].xid = -1; - } - //clear release e_rabs - ue_context_pP->ue_context.nb_release_of_e_rabs = 0; - memset(&ue_context_pP->ue_context.e_rabs_release_failed[0],0,sizeof(e_rab_failed_t)*S1AP_MAX_E_RAB); - return 0; + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_released = e_rabs_released; + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_failed = ue_context_pP->ue_context.nb_release_of_e_rabs; + memcpy(&(S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rabs_failed[0]),&ue_context_pP->ue_context.e_rabs_release_failed[0],sizeof(e_rab_failed_t)*ue_context_pP->ue_context.nb_release_of_e_rabs); + ue_context_pP->ue_context.setup_e_rabs -= e_rabs_released; + LOG_I(RRC,"S1AP-E-RAB RELEASE RESPONSE: ENB_UE_S1AP_ID %d release_e_rabs %d setup_e_rabs %d \n", + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id, + e_rabs_released, ue_context_pP->ue_context.setup_e_rabs); + itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); + + //clear xid + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_pP->ue_context.e_rab[i].xid = -1; + } + + //clear release e_rabs + ue_context_pP->ue_context.nb_release_of_e_rabs = 0; + memset(&ue_context_pP->ue_context.e_rabs_release_failed[0],0,sizeof(e_rab_failed_t)*S1AP_MAX_E_RAB); + return 0; } /*------------------------------------------------------------------------------*/ -int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance_t instance) -{ +int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance_t instance) { const unsigned int Ttab[4] = {32,64,128,256}; uint8_t Tc,Tue; /* DRX cycle of UE */ uint32_t pcch_nB; /* 4T, 2T, T, T/2, T/4, T/8, T/16, T/32 */ @@ -1846,132 +1782,150 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance uint32_t Ns = 0; /* Ns: max(1,nB/T) */ uint8_t i_s; /* i_s = floor(UE_ID/N) mod Ns */ uint32_t T; /* DRX cycle */ + for (uint16_t tai_size = 0; tai_size < S1AP_PAGING_IND(msg_p).tai_size; tai_size++) { - LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, - S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]); - for (uint8_t j = 0; j < RC.rrc[instance]->configuration.num_plmn; j++) { - if (RC.rrc[instance]->configuration.mcc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc - && RC.rrc[instance]->configuration.mnc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc - && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { - for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; - /* get nB from configuration */ - /* get default DRX cycle from configuration */ - Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id]; - if (Tc < PCCH_Config__defaultPagingCycle_rf32 || Tc > PCCH_Config__defaultPagingCycle_rf256) { - continue; - } - Tue = (uint8_t)S1AP_PAGING_IND(msg_p).paging_drx; - /* set T = min(Tc,Tue) */ - T = Tc < Tue ? Ttab[Tc] : Ttab[Tue]; - /* set pcch_nB = PCCH-Config->nB */ - pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id]; - switch (pcch_nB) { - case PCCH_Config__nB_fourT: - Ns = 4; - break; - case PCCH_Config__nB_twoT: - Ns = 2; - break; - default: - Ns = 1; - break; - } - /* set N = min(T,nB) */ - if (pcch_nB > PCCH_Config__nB_oneT) { - switch (pcch_nB) { - case PCCH_Config__nB_halfT: - N = T/2; - break; - case PCCH_Config__nB_quarterT: - N = T/4; - break; - case PCCH_Config__nB_oneEighthT: - N = T/8; - break; - case PCCH_Config__nB_oneSixteenthT: - N = T/16; - break; - case PCCH_Config__nB_oneThirtySecondT: - N = T/32; - break; - default: - /* pcch_nB error */ - LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", - instance, pcch_nB); - return (-1); - } - } else { - N = T; - } + LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, + S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]); - /* insert data to UE_PF_PO or update data in UE_PF_PO */ - pthread_mutex_lock(&ue_pf_po_mutex); - uint8_t i = 0; - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value)) - || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) { - /* set T = min(Tc,Tue) */ - UE_PF_PO[CC_id][i].T = T; - /* set UE_ID */ - UE_PF_PO[CC_id][i].ue_index_value = (uint16_t)S1AP_PAGING_IND(msg_p).ue_index_value; - /* calculate PF and PO */ - /* set PF_min : SFN mod T = (T div N)*(UE_ID mod N) */ - UE_PF_PO[CC_id][i].PF_min = (T / N) * (UE_PF_PO[CC_id][i].ue_index_value % N); - /* set PO */ - /* i_s = floor(UE_ID/N) mod Ns */ - i_s = (uint8_t)((UE_PF_PO[CC_id][i].ue_index_value / N) % Ns); - if (Ns == 1) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? 9 : 0; - } else if (Ns==2) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4+(5*i_s)) : (5*i_s); - } else if (Ns==4) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); - } - if (UE_PF_PO[CC_id][i].enable_flag == TRUE) { - //paging exist UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); - } else { - /* set enable_flag */ - UE_PF_PO[CC_id][i].enable_flag = TRUE; - //paging new UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); - } - break; - } - } - pthread_mutex_unlock(&ue_pf_po_mutex); + for (uint8_t j = 0; j < RC.rrc[instance]->configuration.num_plmn; j++) { + if (RC.rrc[instance]->configuration.mcc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc + && RC.rrc[instance]->configuration.mnc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc + && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { + for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; + /* get nB from configuration */ + /* get default DRX cycle from configuration */ + Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id]; - uint32_t length; - uint8_t buffer[RRC_BUF_SIZE]; - uint8_t *message_buffer; - /* Transfer data to PDCP */ - MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ); - /* Create message for PDCP (DLInformationTransfer_t) */ - length = do_Paging (instance, - buffer, - S1AP_PAGING_IND(msg_p).ue_paging_identity, - S1AP_PAGING_IND(msg_p).cn_domain); - if(length == -1) - { - LOG_I(RRC, "do_Paging error"); - return -1; - } - message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length); - /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */ - memcpy (message_buffer, buffer, length); - RRC_PCCH_DATA_REQ (message_p).sdu_size = length; - RRC_PCCH_DATA_REQ (message_p).sdu_p = message_buffer; - RRC_PCCH_DATA_REQ (message_p).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; /* not used */ - RRC_PCCH_DATA_REQ (message_p).rnti = P_RNTI; - RRC_PCCH_DATA_REQ (message_p).ue_index = i; - RRC_PCCH_DATA_REQ (message_p).CC_id = CC_id; - LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); - itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p); - } + if (Tc < LTE_PCCH_Config__defaultPagingCycle_rf32 || Tc > LTE_PCCH_Config__defaultPagingCycle_rf256) { + continue; } + + Tue = (uint8_t)S1AP_PAGING_IND(msg_p).paging_drx; + /* set T = min(Tc,Tue) */ + T = Tc < Tue ? Ttab[Tc] : Ttab[Tue]; + /* set pcch_nB = PCCH-Config->nB */ + pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id]; + + switch (pcch_nB) { + case LTE_PCCH_Config__nB_fourT: + Ns = 4; + break; + + case LTE_PCCH_Config__nB_twoT: + Ns = 2; + break; + + default: + Ns = 1; + break; + } + + /* set N = min(T,nB) */ + if (pcch_nB > LTE_PCCH_Config__nB_oneT) { + switch (pcch_nB) { + case LTE_PCCH_Config__nB_halfT: + N = T/2; + break; + + case LTE_PCCH_Config__nB_quarterT: + N = T/4; + break; + + case LTE_PCCH_Config__nB_oneEighthT: + N = T/8; + break; + + case LTE_PCCH_Config__nB_oneSixteenthT: + N = T/16; + break; + + case LTE_PCCH_Config__nB_oneThirtySecondT: + N = T/32; + break; + + default: + /* pcch_nB error */ + LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", + instance, pcch_nB); + return (-1); + } + } else { + N = T; + } + + /* insert data to UE_PF_PO or update data in UE_PF_PO */ + pthread_mutex_lock(&ue_pf_po_mutex); + uint8_t i = 0; + + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value)) + || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) { + /* set T = min(Tc,Tue) */ + UE_PF_PO[CC_id][i].T = T; + /* set UE_ID */ + UE_PF_PO[CC_id][i].ue_index_value = (uint16_t)S1AP_PAGING_IND(msg_p).ue_index_value; + /* calculate PF and PO */ + /* set PF_min : SFN mod T = (T div N)*(UE_ID mod N) */ + UE_PF_PO[CC_id][i].PF_min = (T / N) * (UE_PF_PO[CC_id][i].ue_index_value % N); + /* set PO */ + /* i_s = floor(UE_ID/N) mod Ns */ + i_s = (uint8_t)((UE_PF_PO[CC_id][i].ue_index_value / N) % Ns); + + if (Ns == 1) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? 9 : 0; + } else if (Ns==2) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4+(5*i_s)) : (5*i_s); + } else if (Ns==4) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); + } + + if (UE_PF_PO[CC_id][i].enable_flag == TRUE) { + //paging exist UE log + LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + } else { + /* set enable_flag */ + UE_PF_PO[CC_id][i].enable_flag = TRUE; + //paging new UE log + LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + } + + break; + } + } + + pthread_mutex_unlock(&ue_pf_po_mutex); + uint32_t length; + uint8_t buffer[RRC_BUF_SIZE]; + uint8_t *message_buffer; + /* Transfer data to PDCP */ + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ); + /* Create message for PDCP (DLInformationTransfer_t) */ + length = do_Paging (instance, + buffer, + S1AP_PAGING_IND(msg_p).ue_paging_identity, + S1AP_PAGING_IND(msg_p).cn_domain); + + if(length == -1) { + LOG_I(RRC, "do_Paging error"); + return -1; + } + + message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length); + /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */ + memcpy (message_buffer, buffer, length); + RRC_PCCH_DATA_REQ (message_p).sdu_size = length; + RRC_PCCH_DATA_REQ (message_p).sdu_p = message_buffer; + RRC_PCCH_DATA_REQ (message_p).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; /* not used */ + RRC_PCCH_DATA_REQ (message_p).rnti = P_RNTI; + RRC_PCCH_DATA_REQ (message_p).ue_index = i; + RRC_PCCH_DATA_REQ (message_p).CC_id = CC_id; + LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); + itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p); + } } + } } return (0); diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.h b/openair2/RRC/LTE/rrc_eNB_S1AP.h index a924caf254..eb427bc7bd 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.h +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.h @@ -33,7 +33,7 @@ # if defined(ENABLE_USE_MME) -#include "UL-DCCH-Message.h" +#include "LTE_UL-DCCH-Message.h" /* Up link procedures */ @@ -106,7 +106,7 @@ void rrc_eNB_send_S1AP_UPLINK_NAS( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* const ul_dcch_msg + LTE_UL_DCCH_Message_t* const ul_dcch_msg ); /*! \fn void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(const protocol_ctxt_t * const ctxt_pP, eNB_RRC_UE_t * const ue_context_pP, UL_DCCH_Message_t *ul_dcch_msg) @@ -118,7 +118,7 @@ rrc_eNB_send_S1AP_UPLINK_NAS( void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* ul_dcch_msg + LTE_UL_DCCH_Message_t* ul_dcch_msg ); /*! \fn rrc_eNB_send_S1AP_NAS_FIRST_REQ(const protocol_ctxt_t* const ctxt_pP,eNB_RRC_UE_t *const ue_context_pP, RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete) @@ -132,7 +132,7 @@ void rrc_eNB_send_S1AP_NAS_FIRST_REQ( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete + LTE_RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete ); diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h index 59200fb9cc..e3b9ecb00b 100644 --- a/openair2/RRC/LTE/rrc_extern.h +++ b/openair2/RRC/LTE/rrc_extern.h @@ -40,8 +40,8 @@ extern UE_RRC_INST *UE_rrc_inst; extern uint8_t DRB2LCHAN[8]; -extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue; -extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; +extern LTE_LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue; +extern LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; #ifndef PHY_EMUL @@ -51,9 +51,8 @@ extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; extern unsigned char NB_INST; #endif extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; extern unsigned short NODE_ID[1]; -extern void* bigphys_malloc(int); #endif diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index de16f45c2a..0aeb67dfba 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -106,7 +106,7 @@ rrc_ue_decode_dcch( const uint8_t eNB_indexP ); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int decode_SL_Discovery_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, @@ -130,7 +130,7 @@ rrc_ue_generate_RRCConnectionRequest( void rrc_ue_process_rrcConnectionReconfiguration( const protocol_ctxt_t* const ctxt_pP, - RRCConnectionReconfiguration_t* rrcConnectionReconfiguration, + LTE_RRCConnectionReconfiguration_t* rrcConnectionReconfiguration, uint8_t eNB_index ); @@ -140,7 +140,7 @@ rrc_ue_process_rrcConnectionReconfiguration( \param eNB_index Index of corresponding eNB/CH \param SRB_config Pointer to SRB_ToAddMod IE from configuration @returns 0 on success*/ -int32_t rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct SRB_ToAddMod *SRB_config); +int32_t rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config); /** \brief Establish SRB2 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly \param module_idP Instance ID of UE @@ -148,14 +148,14 @@ int32_t rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB \param eNB_index Index of corresponding eNB/CH \param SRB_config Pointer to SRB_ToAddMod IE from configuration @returns 0 on success*/ -int32_t rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct SRB_ToAddMod *SRB_config); +int32_t rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config); /** \brief Establish a DRB according to DRB_ToAddMod structure \param module_idP Instance ID of UE \param eNB_index Index of corresponding CH/eNB \param DRB_config Pointer to DRB_ToAddMod IE from configuration @returns 0 on success */ -int32_t rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct DRB_ToAddMod *DRB_config); +int32_t rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_DRB_ToAddMod *DRB_config); /** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC \param ctxt_pP Running context @@ -166,7 +166,7 @@ void rrc_ue_process_mobilityControlInfo( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, - struct MobilityControlInfo* const mobilityControlInfo + struct LTE_MobilityControlInfo* const mobilityControlInfo ); /** \brief Process a measConfig Message and configure PHY/MAC @@ -177,7 +177,7 @@ void rrc_ue_process_measConfig( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, - MeasConfig_t* const measConfig + LTE_MeasConfig_t* const measConfig ); /** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC @@ -187,7 +187,7 @@ rrc_ue_process_measConfig( void rrc_ue_process_radioResourceConfigDedicated( const protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index, - RadioResourceConfigDedicated_t *radioResourceConfigDedicated); + LTE_RadioResourceConfigDedicated_t *radioResourceConfigDedicated); /** \brief Process a RadioResourceConfig and configure PHY/MAC for SL communication/discovery @@ -200,10 +200,10 @@ void rrc_ue_process_radioResourceConfigDedicated( void rrc_ue_process_sidelink_radioResourceConfig( module_id_t Mod_idP, uint8_t eNB_index, - SystemInformationBlockType18_r12_t *sib18, - SystemInformationBlockType19_r12_t *sib19, - SL_CommConfig_r12_t* sl_CommConfig, - SL_DiscConfig_r12_t* sl_DiscConfig); + LTE_SystemInformationBlockType18_r12_t *sib18, + LTE_SystemInformationBlockType19_r12_t *sib19, + LTE_SL_CommConfig_r12_t* sl_CommConfig, + LTE_SL_DiscConfig_r12_t* sl_DiscConfig); /** \brief Init control socket to listen to incoming packets from ProSe App * @@ -269,7 +269,7 @@ void rrc_eNB_process_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete + LTE_RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete ); /**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE @@ -370,7 +370,7 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - SL_DestinationInfoList_r12_t *destinationInfoList, + LTE_SL_DestinationInfoList_r12_t *destinationInfoList, int n_discoveryMessages ); @@ -381,24 +381,24 @@ uint8_t rrc_eNB_process_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* ue_context_pP, - SidelinkUEInformation_r12_t* sidelinkUEInformation + LTE_SidelinkUEInformation_r12_t* sidelinkUEInformation ); /** \brief Get a Resource Pool to transmit SL communication \param ctxt_pP Running context \param ue_context_pP UE context \param destinationInfoList Pointer to the list of SL destinations*/ -SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( +LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - SL_DestinationInfoList_r12_t *destinationInfoList + LTE_SL_DestinationInfoList_r12_t *destinationInfoList ); /** \brief Get a Resource Pool for Discovery \param ctxt_pP Running context \param ue_context_pP UE context \param n_discoveryMessages Number of discovery messages*/ -SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool( +LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, int n_discoveryMessages @@ -572,14 +572,14 @@ void rrc_eNB_process_MeasurementReport( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* ue_context_pP, - const MeasResults_t* const measResults2 + const LTE_MeasResults_t* const measResults2 ); void rrc_eNB_generate_HandoverPreparationInformation( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, - PhysCellId_t targetPhyId + LTE_PhysCellId_t targetPhyId ); void diff --git a/openair2/RRC/LTE/rrc_vars.h b/openair2/RRC/LTE/rrc_vars.h index 028a59f7d9..512d421168 100644 --- a/openair2/RRC/LTE/rrc_vars.h +++ b/openair2/RRC/LTE/rrc_vars.h @@ -38,7 +38,7 @@ UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; pthread_mutex_t ue_pf_po_mutex; -UE_RRC_INST *UE_rrc_inst; +UE_RRC_INST *UE_rrc_inst = NULL; #include "LAYER2/MAC/mac_extern.h" #define MAX_U32 0xFFFFFFFF @@ -47,34 +47,34 @@ uint8_t DRB2LCHAN[8]; long logicalChannelGroup0 = 0; long logicalChannelSR_Mask_r9=0; -struct LogicalChannelConfig__ul_SpecificParameters LCSRB1 = {1, - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, +struct LTE_LogicalChannelConfig__ul_SpecificParameters LCSRB1 = {1, + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, 0, &logicalChannelGroup0 }; -struct LogicalChannelConfig__ul_SpecificParameters LCSRB2 = {3, - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, +struct LTE_LogicalChannelConfig__ul_SpecificParameters LCSRB2 = {3, + LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, 0, &logicalChannelGroup0 }; -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) -struct LogicalChannelConfig__ext1 logicalChannelSR_Mask_r9_ext1 = { +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +struct LTE_LogicalChannelConfig__ext1 logicalChannelSR_Mask_r9_ext1 = { logicalChannelSR_Mask_r9: &logicalChannelSR_Mask_r9 }; #endif // These are the default SRB configurations from 36.331 (Chapter 9, p. 176-179 in v8.6) -LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB1 -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +LTE_LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB1 +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , ext1: &logicalChannelSR_Mask_r9_ext1 #endif }; -LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB2 -#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0)) +LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB2 +#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0)) , ext1: &logicalChannelSR_Mask_r9_ext1 #endif diff --git a/openair2/RRC/NAS/Makefile.inc b/openair2/RRC/NAS/Makefile.inc deleted file mode 100644 index ea1a8a7a81..0000000000 --- a/openair2/RRC/NAS/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -#ifeq ($(NAS_FLAG),1) -NAS_OBJS = $(OPENAIR2_TOP)/RRC/NAS/nas_config.o -NAS_OBJS += $(OPENAIR2_TOP)/RRC/NAS/rb_config.o -#endif diff --git a/openair2/UTIL/BIGPHYS/bigphys.c b/openair2/UTIL/BIGPHYS/bigphys.c deleted file mode 100644 index 219a0c8d1b..0000000000 --- a/openair2/UTIL/BIGPHYS/bigphys.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "defs.h" -#include "linux/module.h" - -#ifdef BIGPHYSAREA -#ifdef ARCH_64 -char *bigphys_ptr,*bigphys_current; -#else //ARCH_64 -unsigned int bigphys_ptr,bigphys_current; -#endif //ARCH_64 - -// return pointer to memory in big physical area aligned to 16 bytes - -void* bigphys_malloc(int n) -{ - - - - int n2 = n + ((16-(n%16))%16); -#ifdef ARCH_64 - char *bigphys_old; -#else - unsigned int bigphys_old; -#endif - - printk("[BIGPHYSAREA] Calling bigphys_malloc for %d (%d) bytes\n",n,n2); - -#ifdef ARCH_64 - printk("[BIGPHYSAREA] Allocated Memory @ %p\n",bigphys_current); -#endif - bigphys_old = bigphys_current; - bigphys_current += n2; - -#ifdef ARCH_64 - printk("[BIGPHYSAREA] Allocated Memory top now @ %p\n",bigphys_current); - return ((void *)(bigphys_old)); -#else //ARCH_64 - //printk("[BIGPHYSAREA] Allocated Memory %d\n",bigphys_current-bigphys_ptr); - return ((void *)(bigphys_old)); -#endif //ARCH_64 -} - -EXPORT_SYMBOL(bigphys_malloc); -#endif - - - diff --git a/openair2/UTIL/BIGPHYS/defs.h b/openair2/UTIL/BIGPHYS/defs.h deleted file mode 100644 index 69368a6d72..0000000000 --- a/openair2/UTIL/BIGPHYS/defs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -void* bigphys_malloc(int); diff --git a/openair2/UTIL/Makefile.inc b/openair2/UTIL/Makefile.inc deleted file mode 100644 index fac8d7e9a1..0000000000 --- a/openair2/UTIL/Makefile.inc +++ /dev/null @@ -1,108 +0,0 @@ -MEM_DIR = $(OPENAIR2_TOP)/UTIL/MEM -LIST_DIR = $(OPENAIR2_TOP)/UTIL/LISTS -FIFO_DIR = $(OPENAIR2_TOP)/UTIL/FIFO -MATH_DIR = $(OPENAIR2_TOP)/UTIL/MATH -TIMER_DIR = $(OPENAIR2_TOP)/UTIL/TIMER -LOG_DIR=$(OPENAIR2_TOP)/UTIL/LOG -OCG_DIR=$(OPENAIR2_TOP)/UTIL/OCG -OPT_DIR=$(OPENAIR2_TOP)/UTIL/OPT -OMG_DIR=$(OPENAIR2_TOP)/UTIL/OMG -OTG_DIR=$(OPENAIR2_TOP)/UTIL/OTG -CLI_DIR=$(OPENAIR2_TOP)/UTIL/CLI -OMV_DIR=$(OPENAIR2_TOP)/UTIL/OMV -LFDS_DIR=$(OPENAIR2_TOP)/UTIL/LFDS/liblfds6.1.1/liblfds611 -OSA_DIR=$(OPENAIR2_TOP)/UTIL/OSA - -LIST_OBJ = $(LIST_DIR)/list.o - -FIFO_OBJ = $(FIFO_DIR)/pad_list.o - -LIST_OBJ += $(LIST_DIR)/list2.o - -TIMER_OBJ += $(TIMER_DIR)/umts_timer.o - -MEM_OBJ += $(MEM_DIR)/mem_block.o - -LOG_OBJS = $(LOG_DIR)/log.o -LOG_OBJS += $(LOG_DIR)/vcd_signal_dumper.o - -OCG_OBJS = $(OCG_DIR)/OCG.o -OCG_OBJS += $(OCG_DIR)/OCG_create_dir.o -OCG_OBJS += $(OCG_DIR)/OCG_detect_file.o -OCG_OBJS += $(OCG_DIR)/OCG_generate_report.o -OCG_OBJS += $(OCG_DIR)/OCG_parse_filename.o -OCG_OBJS += $(OCG_DIR)/OCG_parse_XML.o -OCG_OBJS += $(OCG_DIR)/OCG_save_XML.o - -ifdef SECU -OSA_OBJS = $(OSA_DIR)/osa_key_deriver.o -OSA_OBJS += $(OSA_DIR)/osa_stream_eia.o -OSA_OBJS += $(OSA_DIR)/osa_stream_eea.o -OSA_OBJS += $(OSA_DIR)/osa_snow3g.o -OSA_OBJS += $(OSA_DIR)/osa_rijndael.o -endif - -OPT_OBJS = $(OPT_DIR)/probe.o - -OMG_OBJS = $(OMG_DIR)/omg.o -OMG_OBJS += $(OMG_DIR)/common.o -OMG_OBJS += $(OMG_DIR)/job.o -OMG_OBJS += $(OMG_DIR)/static.o -OMG_OBJS += $(OMG_DIR)/rwp.o -OMG_OBJS += $(OMG_DIR)/rwalk.o -#OMG_OBJS += $(OMG_DIR)/omg_hashtable.o -OMG_OBJS += $(OMG_DIR)/mobility_parser.o -OMG_OBJS += $(OMG_DIR)/trace.o -OMG_OBJS += $(OMG_DIR)/sumo.o -OMG_OBJS += $(OMG_DIR)/id_manager.o -OMG_OBJS += $(OMG_DIR)/client_traci_OMG.o -OMG_OBJS += $(OMG_DIR)/storage_traci_OMG.o -OMG_OBJS += $(OMG_DIR)/socket_traci_OMG.o -OMG_OBJS += $(OMG_DIR)/steadystaterwp.o -OMG_OBJS += $(OMG_DIR)/grid.o -OMG_OBJS += $(OMG_DIR)/trace_hashtable.o - - -OTG_OBJS = $(OTG_DIR)/otg_tx.o -OTG_OBJS += $(OTG_DIR)/otg.o -OTG_OBJS += $(OTG_DIR)/otg_rx.o -OTG_OBJS += $(OTG_DIR)/otg_kpi.o -OTG_OBJS += $(OTG_DIR)/otg_form.o -OTG_OBJS += $(OTG_DIR)/otg_models.o - -MATH_OBJS = $(MATH_DIR)/oml.o - -CLI_OBJ = $(CLI_DIR)/cli_server.o -CLI_OBJ += $(CLI_DIR)/cli.o -CLI_OBJ += $(CLI_DIR)/cli_cmd.o - -UTIL_OBJ = \ - $(OSA_OBJS) \ - $(FIFO_OBJ) \ - $(LIST_OBJ) \ - $(TIMER_OBJ) \ - $(MEM_OBJ) \ - $(LOG_OBJS) \ - $(OCG_OBJS) \ - $(MATH_OBJS) \ - $(OTG_OBJS) \ - $(CLI_OBJ) \ - $(OMG_OBJS) \ - $(OPT_OBJS) - -UTIL_incl = \ - -I$(OPENAIR2_TOP)/UTIL \ - -I$(OSA_DIR) \ - -I$(LFDS_DIR)/inc \ - -I$(MEM_DIR) \ - -I$(LIST_DIR) \ - -I$(FIFO_DIR) \ - -I$(OCG_DIR) \ - -I$(LOG_DIR) \ - -I$(MATH_DIR) \ - -I$(TIMER_DIR) \ - -I$(OMG_DIR) \ - -I$(OTG_DIR) \ - -I$(CLI_DIR) \ - -I$(OPT_DIR) \ - -I$(OMV_DIR) diff --git a/openair2/UTIL/TIMER/umts_timer.c b/openair2/UTIL/TIMER/umts_timer.c deleted file mode 100644 index 1691fac363..0000000000 --- a/openair2/UTIL/TIMER/umts_timer.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - umts_timer.c - description - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - - - ***************************************************************************/ -//#include "rtos_header.h" -#include "platform_types.h" - -#include "list.h" -#include "umts_timer_struct.h" -#include "mem_block.h" -#include "openair_defs.h" -//----------------------------------------------------------------------------- -void -umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP) -{ - //----------------------------------------------------------------------------- - struct timer_unit *timer; - mem_block_t *mem_unit; - uint8_t time_out = 255; - mem_unit = atimer_listP->head; - - // do it simple now. - while ((mem_unit) && (time_out)) { - timer = (struct timer_unit *) (mem_unit->data); - - if ((current_frame_tick_millisecondsP - timer->frame_tick_start) >= timer->frame_time_out) { - - mem_unit = list2_remove_head (atimer_listP); - (*(timer->proc)) (timer->protocol, timer->timer_id); - free_mem_block (mem_unit, __func__); - - mem_unit = atimer_listP->head; - } else { - time_out = 0; - } - } -} - -//----------------------------------------------------------------------------- -void -umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP) -{ - //----------------------------------------------------------------------------- - mem_block_t *mem_unit; - mem_unit = atimer_listP->head; - - while ((mem_unit)) { - if (((struct timer_unit *) (mem_unit->data))->timer_id == timer_idP) { - list2_remove_element (mem_unit, atimer_listP); - free_mem_block (mem_unit, __func__); - return; - } - - mem_unit = mem_unit->next; - } -} - -//----------------------------------------------------------------------------- -mem_block_t * -umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP, uint32_t current_frame_tick_millisecondsP) -{ - //----------------------------------------------------------------------------- - struct mem_block_t *mb; - struct timer_unit *timer; - mem_block_t *mem_unit; - int32_t remaining_time; - uint8_t inserted = 0; - - mb = get_free_mem_block (sizeof (struct timer_unit), __func__); - if(mb==NULL) return NULL; - ((struct timer_unit *) (mb->data))->proc = procP; - ((struct timer_unit *) (mb->data))->protocol = protocolP; - ((struct timer_unit *) (mb->data))->timer_id = timer_idP; - ((struct timer_unit *) (mb->data))->frame_time_out = frame_time_outP; - ((struct timer_unit *) (mb->data))->frame_tick_start = current_frame_tick_millisecondsP; - - // insert the timer in list in ascending order - mem_unit = atimer_listP->head; - - while ((mem_unit) && (!inserted)) { - timer = (struct timer_unit *) (mem_unit->data); - - remaining_time = timer->frame_time_out - current_frame_tick_millisecondsP + timer->frame_tick_start; - - // not timed out - if ((remaining_time > 0) && (frame_time_outP < remaining_time)) { - inserted = 255; - - if (mem_unit == atimer_listP->head) { -#ifdef DEBUG_TIMER - msg ("[TIMER][CREATION] added timer_id %p at head time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP); -#endif - list2_add_head (mb, atimer_listP); - } else { -#ifdef DEBUG_TIMER - msg ("[TIMER][CREATION] inserted timer_id %p time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP); -#endif - mb->previous = mem_unit->previous; - mb->next = mem_unit; - mem_unit->previous->next = mb; - mem_unit->previous = mb; - } - } else { - mem_unit = mem_unit->next; - } - } - - if (!inserted) { -#ifdef DEBUG_TIMER - msg ("[TIMER][CREATION] added timer_id %p at tail time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP); -#endif - list2_add_tail (mb, atimer_listP); - } - - return mb; -} - -//----------------------------------------------------------------------------- -void -umts_stop_all_timers (list2_t * atimer_listP) -{ - //----------------------------------------------------------------------------- - list2_free (atimer_listP); -} - -//----------------------------------------------------------------------------- -void -umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void *)) -{ - //----------------------------------------------------------------------------- - struct timer_unit *timer; - mem_block_t *mem_unit; - mem_block_t *mem_unit_to_delete; - mem_unit = atimer_listP->head; - - while ((mem_unit)) { - timer = (struct timer_unit *) (mem_unit->data); - - if (timer->proc != procP) { - mem_unit_to_delete = mem_unit; - mem_unit = mem_unit->next; - list2_remove_element (mem_unit_to_delete, atimer_listP); - free_mem_block (mem_unit_to_delete, __func__); - } else { - mem_unit = mem_unit->next; - } - } -} diff --git a/openair2/UTIL/TIMER/umts_timer.h b/openair2/UTIL/TIMER/umts_timer.h deleted file mode 100644 index 077b55cf0c..0000000000 --- a/openair2/UTIL/TIMER/umts_timer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - umts_timer.h - description - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - - ***************************************************************************/ -#ifndef __UMTS_TIMER_H__ -# define __UMTS_TIMER_H__ - - -# include "platform_types.h" -# include "lists_proto_extern.h" -# include "mem_mngt_proto_extern.h" - -# define UMTS_TIMER_NOT_STARTED 0x00 -# define UMTS_TIMER_STARTED 0x01 -# define UMTS_TIMER_TIMED_OUT 0x02 - - -void umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP); -mem_block *umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP, uint32_t current_frame_tick_millisecondsP); - -struct timer_unit { - - void (*proc) (void *, void *); // proc executed when time_out - void *protocol; // arg should be a pointer on a allocated protocol entity private struct including its variables - void *timer_id; // arg should be a value or a pointer identifying the timer - // Example: rlc_am_sdu_discard_time_out(rlc_am, sdu) - uint32_t frame_time_out; - uint32_t frame_tick_start; -}; -#endif diff --git a/openair2/UTIL/TIMER/umts_timer_proto_extern.h b/openair2/UTIL/TIMER/umts_timer_proto_extern.h deleted file mode 100644 index b43b347e46..0000000000 --- a/openair2/UTIL/TIMER/umts_timer_proto_extern.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - umts_timer_proto_extern.h - description - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - - ***************************************************************************/ -#ifndef __UMTS_TIMER_PROTO_EXTERN_H__ -# define __UMTS_TIMER_PROTO_EXTERN_H__ - -# include "platform_types.h" -# include "list.h" -# include "mem_block.h" - -extern void umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP); -extern void umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP); -extern mem_block_t *umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP, - uint32_t current_frame_tick_millisecondsP); -extern void umts_stop_all_timers (list2_t * atimer_listP); -extern void umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void *)); -#endif diff --git a/openair2/UTIL/TIMER/umts_timer_struct.h b/openair2/UTIL/TIMER/umts_timer_struct.h deleted file mode 100644 index c4886c7f80..0000000000 --- a/openair2/UTIL/TIMER/umts_timer_struct.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - umts_timer_struct.h - description - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - - - ***************************************************************************/ -#ifndef __UMTS_TIMER_STRUCT_H__ -# define __UMTS_TIMER_STRUCT_H__ - -# include "platform_types.h" - -struct timer_unit { - - void (*proc) (void *, void *); // proc executed when time_out - void *protocol; // arg should be a pointer on a allocated protocol entity private struct including its variables - void *timer_id; // arg should be a value or a pointer identifying the timer - // Example: rlc_am_sdu_discard_time_out(rlc_am, sdu) - uint32_t frame_time_out; - uint32_t frame_tick_start; -}; -#endif diff --git a/openair2/X2AP/Makefile.inc b/openair2/X2AP/Makefile.inc deleted file mode 100755 index a301a9934e..0000000000 --- a/openair2/X2AP/Makefile.inc +++ /dev/null @@ -1,107 +0,0 @@ - -ASN1MESSAGESDIR=$(X2AP_DIR)/MESSAGES -ASN1DIR=$(ASN1MESSAGESDIR)/ASN1 - -#//ifeq ($(USE_MME), R10) -#// ASN1RELDIR=R10.7 -#//else -#//ASN1RELDIR=R11.2 -#//endif - -# TEMP -ASN1RELDIR=R11.2 - - -include $(ASN1DIR)/$(ASN1RELDIR)/Makefile.inc - -libx2ap_OBJECTS = \ - x2ap.o \ - x2ap_common.o \ - $(addprefix MESSAGES/ASN1/$(ASN1RELDIR)/, $(X2AP_ASN_MODULE_SOURCES)) - - - -# pull in dependency info for *existing* .o files --include $(OUTDIR)/*.d - -CFLAGS = \ - -Wall \ - -DENB_MODE \ - -DENABLE_USE_MME \ - -I. \ - -I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \ - -I$(ASN1MESSAGESDIR) \ - -I$(OUTDIR) \ - -I../UTILS \ - $(ADD_CFLAGS) \ - $(X2AP_CFLAGS) \ - -Wuninitialized \ - -Werror=implicit-function-declaration - -X2AP_GENERATED = \ - $(OUTDIR)/x2ap_encoder.o \ - $(OUTDIR)/x2ap_decoder.o \ - $(OUTDIR)/x2ap_xer_print.o - -$(OUTDIR)/%.o : %.c - @echo "Compiling $<" - @echo "Compiling $< with CFLAGS= $(CFLAGS)" - @if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi; - @$(CC) -c $(CFLAGS) -o $@ $< - @$(CC) -MM $(CFLAGS) $< > $(basename $@).d - @mv -f $(basename $@).d $(basename $@).d.tmp - @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d - @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \ - sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d - @rm -f $(basename $@).d.tmp - -$(X2AP_GENERATED): %.o : %.c - @echo "Compiling $<" - @echo "Compiling $< with CFLAGS= $(CFLAGS)" - @if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi; - @$(CC) -c $(CFLAGS) -o $@ $< - @$(CC) -MM $(CFLAGS) $< > $(basename $@).d - @mv -f $(basename $@).d $(basename $@).d.tmp - @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d - @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \ - sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d - @rm -f $(basename $@).d.tmp - - -$(OUTDIR)/x2ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py - @if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi; - @python $(ASN1DIR)/asn1tostruct.py -f$< -o$(OUTDIR) - @echo Timestamp > $@ - -#ProtocolExtensionContainer -#$(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn - -$(OUTDIR)/x2ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn - @echo "Timestamp DIR " $(ASN1DIR) " DIRREL " $(ASN1RELDIR) -# (cd $(ASN1DIR)/$(ASN1RELDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^) - (cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names -fskeletons-copy $^) - @echo "Timestamp X2AP_CFLAGS: " $(X2AP_CFLAGS) - @echo Timestamp > $@ - -$(OUTDIR)/libx2ap.a: $(OUTDIR)/x2ap_ieregen.stamp $(OUTDIR)/x2ap_asn1regen.stamp $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS)) - @echo Creating X2AP archive - @echo libx2ap_OBJECTS $(libx2ap_OBJECTS) - @$(AR) rcs $@ $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS)) - -clean: - @$(RM_F_V) $(OUTDIR)/*.o - @$(RM_F_V) $(OUTDIR)/*.d - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES)) - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.d)) - @$(RM_F_V) $(OUTDIR)/libx2ap.a - @$(RM_F_V) $(OUTDIR)/x2ap_asn1regen.stamp - @$(RM_F_V) $(OUTDIR)/x2ap_ieregen.stamp - @$(RM_F_V) $(OUTDIR)/x2ap_decoder.c $(OUTDIR)/x2ap_encoder.c - @$(RM_F_V) $(OUTDIR)/x2ap_xer_print.c $(OUTDIR)/x2ap_ies_defs.h - -cleanall: clean - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.c)) - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.h)) - -showcflags: - @echo x2ap cflags: $(CFLAGS) diff --git a/openair3/COMMON/as_message.h b/openair3/COMMON/as_message.h deleted file mode 100644 index 30810a325e..0000000000 --- a/openair3/COMMON/as_message.h +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ - - -/***************************************************************************** - -Source as_message.h - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the messages supported by the Access Stratum sublayer - protocol (usually RRC and S1AP for E-UTRAN) and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __AS_MESSAGE_H__ -#define __AS_MESSAGE_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Access Stratum message types - * -------------------------------------------------------------------------- - */ -#define AS_REQUEST 0x0100 -#define AS_RESPONSE 0x0200 -#define AS_INDICATION 0x0400 -#define AS_CONFIRM 0x0800 - -/* - * -------------------------------------------------------------------------- - * Access Stratum message identifiers - * -------------------------------------------------------------------------- - */ - -/* Broadcast information */ -#define AS_BROADCAST_INFO 0x01 -#define AS_BROADCAST_INFO_IND (AS_BROADCAST_INFO | AS_INDICATION) - -/* Cell information relevant for cell selection processing */ -#define AS_CELL_INFO 0x02 -#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST) -#define AS_CELL_INFO_CNF (AS_CELL_INFO | AS_CONFIRM) -#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION) - -/* Paging information */ -#define AS_PAGING 0x03 -#define AS_PAGING_REQ (AS_PAGING | AS_REQUEST) -#define AS_PAGING_IND (AS_PAGING | AS_INDICATION) - -/* NAS signalling connection establishment */ -#define AS_NAS_ESTABLISH 0x04 -#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST) -#define AS_NAS_ESTABLISH_IND (AS_NAS_ESTABLISH | AS_INDICATION) -#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE) -#define AS_NAS_ESTABLISH_CNF (AS_NAS_ESTABLISH | AS_CONFIRM) - -/* NAS signalling connection release */ -#define AS_NAS_RELEASE 0x05 -#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST) -#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION) - -/* Uplink information transfer */ -#define AS_UL_INFO_TRANSFER 0x06 -#define AS_UL_INFO_TRANSFER_REQ (AS_UL_INFO_TRANSFER | AS_REQUEST) -#define AS_UL_INFO_TRANSFER_CNF (AS_UL_INFO_TRANSFER | AS_CONFIRM) -#define AS_UL_INFO_TRANSFER_IND (AS_UL_INFO_TRANSFER | AS_INDICATION) - -/* Downlink information transfer */ -#define AS_DL_INFO_TRANSFER 0x07 -#define AS_DL_INFO_TRANSFER_REQ (AS_DL_INFO_TRANSFER | AS_REQUEST) -#define AS_DL_INFO_TRANSFER_CNF (AS_DL_INFO_TRANSFER | AS_CONFIRM) -#define AS_DL_INFO_TRANSFER_IND (AS_DL_INFO_TRANSFER | AS_INDICATION) - -/* Radio Access Bearer establishment */ -#define AS_RAB_ESTABLISH 0x08 -#define AS_RAB_ESTABLISH_REQ (AS_RAB_ESTABLISH | AS_REQUEST) -#define AS_RAB_ESTABLISH_IND (AS_RAB_ESTABLISH | AS_INDICATION) -#define AS_RAB_ESTABLISH_RSP (AS_RAB_ESTABLISH | AS_RESPONSE) -#define AS_RAB_ESTABLISH_CNF (AS_RAB_ESTABLISH | AS_CONFIRM) - -/* Radio Access Bearer release */ -#define AS_RAB_RELEASE 0x09 -#define AS_RAB_RELEASE_REQ (AS_RAB_RELEASE | AS_REQUEST) -#define AS_RAB_RELEASE_IND (AS_RAB_RELEASE | AS_INDICATION) - -/* NAS Cause */ -#define EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED (8) -#define EPS_SERVICES_NOT_ALLOWED (7) -#define PLMN_NOT_ALLOWED (11) -#define TRACKING_AREA_NOT_ALLOWED (12) -#define ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA (13) -#define EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN (14) -#define NO_SUITABLE_CELLS_IN_TRACKING_AREA (15) -#define NETWORK_FAILURE (17) -#define ESM_FAILURE (19) - -typedef enum nas_cause_s { - NAS_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, - NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_NOT_ALLOWED, - NAS_CAUSE_PLMN_NOT_ALLOWED = PLMN_NOT_ALLOWED, - NAS_CAUSE_TRACKING_AREA_NOT_ALLOWED = TRACKING_AREA_NOT_ALLOWED, - NAS_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA = ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA, - NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN, - NAS_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA = NO_SUITABLE_CELLS_IN_TRACKING_AREA, - NAS_CAUSE_NETWORK_FAILURE = NETWORK_FAILURE, - NAS_CAUSE_ESM_FAILURE = ESM_FAILURE -} nas_cause_t; - -/* - * -------------------------------------------------------------------------- - * Access Stratum message global parameters - * -------------------------------------------------------------------------- - */ - -/* Error code */ -typedef enum nas_error_code_s { - AS_SUCCESS = 1, /* Success code, transaction is going on */ - AS_TERMINATED_NAS, /* Transaction terminated by NAS */ - AS_TERMINATED_AS, /* Transaction terminated by AS */ - AS_FAILURE /* Failure code */ -} nas_error_code_t; - -/* Core network domain */ -typedef enum core_network_s { - AS_PS = 1, /* Packet-Switched */ - AS_CS /* Circuit-Switched */ -} core_network_t; - -/* SAE Temporary Mobile Subscriber Identity */ -typedef struct as_stmsi_s { - uint8_t MMEcode; /* MME code that allocated the GUTI */ - uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ -} as_stmsi_t; - -/* Dedicated NAS information */ -typedef struct as_nas_info_s { - uint32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ -} as_nas_info_t; - -/* Radio Access Bearer identity */ -typedef uint8_t as_rab_id_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Broadcast information - * -------------------------------------------------------------------------- - */ - -/* - * AS->NAS - Broadcast information indication - * AS may asynchronously report to NAS available PLMNs within specific - * location area - */ -typedef struct broadcast_info_ind_s { -#define PLMN_LIST_MAX_SIZE 6 - PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */ - ci_t cellID; /* Identity of the cell serving the listed PLMNs */ - tac_t tac; /* Code of the tracking area the cell belongs to */ -} broadcast_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Cell information relevant for cell selection processing - * -------------------------------------------------------------------------- - */ - -/* Radio access technologies supported by the network */ -#define AS_GSM (1 << NET_ACCESS_GSM) -#define AS_COMPACT (1 << NET_ACCESS_COMPACT) -#define AS_UTRAN (1 << NET_ACCESS_UTRAN) -#define AS_EGPRS (1 << NET_ACCESS_EGPRS) -#define AS_HSDPA (1 << NET_ACCESS_HSDPA) -#define AS_HSUPA (1 << NET_ACCESS_HSUPA) -#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) -#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) - -/* - * NAS->AS - Cell Information request - * NAS request AS to search for a suitable cell belonging to the selected - * PLMN to camp on. - */ -typedef struct cell_info_req_s { - plmn_t plmnID; /* Selected PLMN identity */ - Byte_t rat; /* Bitmap - set of radio access technologies */ -} cell_info_req_t; - -/* - * AS->NAS - Cell Information confirm - * AS search for a suitable cell and respond to NAS. If found, the cell - * is selected to camp on. - */ -typedef struct cell_info_cnf_s { - uint8_t errCode; /* Error code */ - ci_t cellID; /* Identity of the cell serving the selected PLMN */ - tac_t tac; /* Code of the tracking area the cell belongs to */ - AcT_t rat; /* Radio access technology supported by the cell */ - uint8_t rsrq; /* Reference signal received quality */ - uint8_t rsrp; /* Reference signal received power */ -} cell_info_cnf_t; - -/* - * AS->NAS - Cell Information indication - * AS may change cell selection if a more suitable cell is found. - */ -typedef struct cell_info_ind_s { - ci_t cellID; /* Identity of the new serving cell */ - tac_t tac; /* Code of the tracking area the cell belongs to */ -} cell_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Paging information - * -------------------------------------------------------------------------- - */ - -/* Paging cause */ -typedef enum paging_cause_s { - AS_CONNECTION_ESTABLISH, /* Establish NAS signalling connection */ - AS_EPS_ATTACH, /* Perform local detach and initiate EPS - * attach procedure */ - AS_CS_FALLBACK /* Inititate CS fallback procedure */ -} paging_cause_t; - -/* - * NAS->AS - Paging Information request - * NAS requests the AS that NAS signalling messages or user data is pending - * to be sent. - */ -typedef struct paging_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - uint8_t CN_domain; /* Core network domain */ -} paging_req_t; - -/* - * AS->NAS - Paging Information indication - * AS reports to the NAS that appropriate procedure has to be initiated. - */ -typedef struct paging_ind_s { - paging_cause_t cause; /* Paging cause */ -} paging_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection establishment - * -------------------------------------------------------------------------- - */ - -/* Cause of RRC connection establishment */ -typedef enum as_cause_s { - AS_CAUSE_UNKNOWN = 0, - AS_CAUSE_EMERGENCY = NET_ESTABLISH_CAUSE_EMERGENCY, - AS_CAUSE_HIGH_PRIO = NET_ESTABLISH_CAUSE_HIGH_PRIO, - AS_CAUSE_MT_ACCESS = NET_ESTABLISH_CAUSE_MT_ACCESS, - AS_CAUSE_MO_SIGNAL = NET_ESTABLISH_CAUSE_MO_SIGNAL, - AS_CAUSE_MO_DATA = NET_ESTABLISH_CAUSE_MO_DATA, - AS_CAUSE_V1020 = NET_ESTABLISH_CAUSE_V1020 -} as_cause_t; - -/* Type of the call associated to the RRC connection establishment */ -typedef enum as_call_type_s { - AS_TYPE_ORIGINATING_SIGNAL = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL, - AS_TYPE_EMERGENCY_CALLS = NET_ESTABLISH_TYPE_EMERGENCY_CALLS, - AS_TYPE_ORIGINATING_CALLS = NET_ESTABLISH_TYPE_ORIGINATING_CALLS, - AS_TYPE_TERMINATING_CALLS = NET_ESTABLISH_TYPE_TERMINATING_CALLS, - AS_TYPE_MO_CS_FALLBACK = NET_ESTABLISH_TYPE_MO_CS_FALLBACK -} as_call_type_t; - -/* - * NAS->AS - NAS signalling connection establishment request - * NAS requests the AS to perform the RRC connection establishment procedure - * to transfer initial NAS message to the network while UE is in IDLE mode. - */ -typedef struct nas_establish_req_s { - as_cause_t cause; /* RRC connection establishment cause */ - as_call_type_t type; /* RRC associated call type */ - as_stmsi_t s_tmsi; /* UE identity */ - plmn_t plmnID; /* Selected PLMN identity */ - as_nas_info_t initialNasMsg; /* Initial NAS message to transfer */ -} nas_establish_req_t; - -/* - * AS->NAS - NAS signalling connection establishment indication - * AS transfers the initial NAS message to the NAS. - */ -typedef struct nas_establish_ind_s { - uint32_t UEid; /* UE lower layer identifier */ - tac_t tac; /* Code of the tracking area the initiating - * UE belongs to */ - as_cause_t asCause; /* Establishment cause */ - as_nas_info_t initialNasMsg; /* Initial NAS message to transfer */ -} nas_establish_ind_t; - -/* - * NAS->AS - NAS signalling connection establishment response - * NAS responds to the AS that initial answer message has to be provided to - * the UE. - */ -typedef struct nas_establish_rsp_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - nas_error_code_t errCode; /* Transaction status */ - as_nas_info_t nasMsg; /* NAS message to transfer */ - uint32_t nas_ul_count; /* UL NAS COUNT */ - uint16_t selected_encryption_algorithm; - uint16_t selected_integrity_algorithm; -} nas_establish_rsp_t; - -/* - * AS->NAS - NAS signalling connection establishment confirm - * AS transfers the initial answer message to the NAS. - */ -typedef struct nas_establish_cnf_s { - uint32_t UEid; /* UE lower layer identifier */ - nas_error_code_t errCode; /* Transaction status */ - as_nas_info_t nasMsg; /* NAS message to transfer */ - uint32_t ul_nas_count; - uint16_t selected_encryption_algorithm; - uint16_t selected_integrity_algorithm; -} nas_establish_cnf_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection release - * -------------------------------------------------------------------------- - */ - -/* Release cause */ -typedef enum release_cause_s { - AS_AUTHENTICATION_FAILURE = 1, /* Authentication procedure failed */ - AS_DETACH /* Detach requested */ -} release_cause_t; - -/* - * NAS->AS - NAS signalling connection release request - * NAS requests the termination of the connection with the UE. - */ -typedef struct nas_release_req_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - release_cause_t cause; /* Release cause */ -} nas_release_req_t; - -/* - * AS->NAS - NAS signalling connection release indication - * AS reports that connection has been terminated by the network. - */ -typedef struct nas_release_ind_s { - release_cause_t cause; /* Release cause */ -} nas_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS information transfer - * -------------------------------------------------------------------------- - */ - -/* - * NAS->AS - Uplink data transfer request - * NAS requests the AS to transfer uplink information to the NAS that - * operates at the network side. - */ -typedef struct ul_info_transfer_req_s { - uint32_t UEid; /* UE lower layer identifier */ - as_stmsi_t s_tmsi; /* UE identity */ - as_nas_info_t nasMsg; /* Uplink NAS message */ -} ul_info_transfer_req_t; - -/* - * AS->NAS - Uplink data transfer confirm - * AS immediately notifies the NAS whether uplink information has been - * successfully sent to the network or not. - */ -typedef struct ul_info_transfer_cnf_s { - uint32_t UEid; /* UE lower layer identifier */ - nas_error_code_t errCode; /* Transaction status */ -} ul_info_transfer_cnf_t; - -/* - * AS->NAS - Uplink data transfer indication - * AS delivers the uplink information message to the NAS that operates - * at the network side. - */ -typedef struct ul_info_transfer_ind_s { - uint32_t UEid; /* UE lower layer identifier */ - as_nas_info_t nasMsg; /* Uplink NAS message */ -} ul_info_transfer_ind_t; - -/* - * NAS->AS - Downlink data transfer request - * NAS requests the AS to transfer downlink information to the NAS that - * operates at the UE side. - */ -typedef ul_info_transfer_req_t dl_info_transfer_req_t; - -/* - * AS->NAS - Downlink data transfer confirm - * AS immediately notifies the NAS whether downlink information has been - * successfully sent to the network or not. - */ -typedef ul_info_transfer_cnf_t dl_info_transfer_cnf_t; - -/* - * AS->NAS - Downlink data transfer indication - * AS delivers the downlink information message to the NAS that operates - * at the UE side. - */ -typedef ul_info_transfer_ind_t dl_info_transfer_ind_t; - -/* - * -------------------------------------------------------------------------- - * Radio Access Bearer establishment - * -------------------------------------------------------------------------- - */ - -/* TODO: Quality of Service parameters */ -typedef struct {} as_qos_t; - -/* - * NAS->AS - Radio access bearer establishment request - * NAS requests the AS to allocate transmission resources to radio access - * bearer initialized at the network side. - */ -typedef struct rab_establish_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ - as_qos_t QoS; /* Requested Quality of Service */ -} rab_establish_req_t; - -/* - * AS->NAS - Radio access bearer establishment indication - * AS notifies the NAS that specific radio access bearer has to be setup. - */ -typedef struct rab_establish_ind_s { - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_establish_ind_t; - -/* - * NAS->AS - Radio access bearer establishment response - * NAS responds to AS whether the specified radio access bearer has been - * successfully setup or not. - */ -typedef struct rab_establish_rsp_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ - nas_error_code_t errCode; /* Transaction status */ -} rab_establish_rsp_t; - -/* - * AS->NAS - Radio access bearer establishment confirm - * AS notifies NAS whether the specified radio access bearer has been - * successfully setup at the UE side or not. - */ -typedef struct rab_establish_cnf_s { - as_rab_id_t rabID; /* Radio access bearer identity */ - nas_error_code_t errCode; /* Transaction status */ -} rab_establish_cnf_t; - -/* - * -------------------------------------------------------------------------- - * Radio Access Bearer release - * -------------------------------------------------------------------------- - */ - -/* - * NAS->AS - Radio access bearer release request - * NAS requests the AS to release transmission resources previously allocated - * to specific radio access bearer at the network side. - */ -typedef struct rab_release_req_s { - as_stmsi_t s_tmsi; /* UE identity */ - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_release_req_t; - -/* - * AS->NAS - Radio access bearer release indication - * AS notifies NAS that specific radio access bearer has been released. - */ -typedef struct rab_release_ind_s { - as_rab_id_t rabID; /* Radio access bearer identity */ -} rab_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * Structure of the AS messages handled by the network sublayer - * -------------------------------------------------------------------------- - */ -typedef struct as_message_s { - uint16_t msgID; - union { - broadcast_info_ind_t broadcast_info_ind; - cell_info_req_t cell_info_req; - cell_info_cnf_t cell_info_cnf; - cell_info_ind_t cell_info_ind; - paging_req_t paging_req; - paging_ind_t paging_ind; - nas_establish_req_t nas_establish_req; - nas_establish_ind_t nas_establish_ind; - nas_establish_rsp_t nas_establish_rsp; - nas_establish_cnf_t nas_establish_cnf; - nas_release_req_t nas_release_req; - nas_release_ind_t nas_release_ind; - ul_info_transfer_req_t ul_info_transfer_req; - ul_info_transfer_cnf_t ul_info_transfer_cnf; - ul_info_transfer_ind_t ul_info_transfer_ind; - dl_info_transfer_req_t dl_info_transfer_req; - dl_info_transfer_cnf_t dl_info_transfer_cnf; - dl_info_transfer_ind_t dl_info_transfer_ind; - rab_establish_req_t rab_establish_req; - rab_establish_ind_t rab_establish_ind; - rab_establish_rsp_t rab_establish_rsp; - rab_establish_cnf_t rab_establish_cnf; - rab_release_req_t rab_release_req; - rab_release_ind_t rab_release_ind; - } __attribute__((__packed__)) msg; -} as_message_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int as_message_decode(const char* buffer, as_message_t* msg, int length); - -int as_message_encode(char* buffer, as_message_t* msg, int length); - -/* Implemented in the network_api.c body file */ -int as_message_send(as_message_t* as_msg); - -#endif /* __AS_MESSAGE_H__*/ diff --git a/openair3/COMMON/gtpv1_u_messages_def.h b/openair3/COMMON/gtpv1_u_messages_def.h deleted file mode 100644 index 4308853515..0000000000 --- a/openair3/COMMON/gtpv1_u_messages_def.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -MESSAGE_DEF(GTPV1U_CREATE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, Gtpv1uCreateTunnelReq, gtpv1uCreateTunnelReq) -MESSAGE_DEF(GTPV1U_CREATE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, Gtpv1uCreateTunnelResp, gtpv1uCreateTunnelResp) -MESSAGE_DEF(GTPV1U_UPDATE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, Gtpv1uUpdateTunnelReq, gtpv1uUpdateTunnelReq) -MESSAGE_DEF(GTPV1U_UPDATE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, Gtpv1uUpdateTunnelResp, gtpv1uUpdateTunnelResp) -MESSAGE_DEF(GTPV1U_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, Gtpv1uDeleteTunnelReq, gtpv1uDeleteTunnelReq) -MESSAGE_DEF(GTPV1U_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, Gtpv1uDeleteTunnelResp, gtpv1uDeleteTunnelResp) -MESSAGE_DEF(GTPV1U_TUNNEL_DATA_IND, MESSAGE_PRIORITY_MED, Gtpv1uTunnelDataInd, gtpv1uTunnelDataInd) -MESSAGE_DEF(GTPV1U_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, Gtpv1uTunnelDataReq, gtpv1uTunnelDataReq) diff --git a/openair3/COMMON/gtpv1_u_messages_types.h b/openair3/COMMON/gtpv1_u_messages_types.h deleted file mode 100644 index 594325647b..0000000000 --- a/openair3/COMMON/gtpv1_u_messages_types.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef GTPV1_U_MESSAGES_TYPES_H_ -#define GTPV1_U_MESSAGES_TYPES_H_ - -#include "../SGW-LITE/sgw_lite_ie_defs.h" - -typedef struct { - Teid_t context_teid; ///< Tunnel Endpoint Identifier - ebi_t eps_bearer_id; -} Gtpv1uCreateTunnelReq; - -typedef struct { - uint8_t status; ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0) - Teid_t context_teid; ///< local SGW S11 Tunnel Endpoint Identifier - Teid_t S1u_teid; ///< Tunnel Endpoint Identifier - ebi_t eps_bearer_id; -} Gtpv1uCreateTunnelResp; - -typedef struct { - Teid_t context_teid; ///< S11 Tunnel Endpoint Identifier - Teid_t sgw_S1u_teid; ///< SGW S1U local Tunnel Endpoint Identifier - Teid_t enb_S1u_teid; ///< eNB S1U Tunnel Endpoint Identifier - ip_address_t enb_ip_address_for_S1u; - ebi_t eps_bearer_id; -} Gtpv1uUpdateTunnelReq; - -typedef struct { - uint8_t status; ///< Status (Failed = 0xFF or Success = 0x0) - Teid_t context_teid; ///< S11 Tunnel Endpoint Identifier - Teid_t sgw_S1u_teid; ///< SGW S1U local Tunnel Endpoint Identifier - Teid_t enb_S1u_teid; ///< eNB S1U Tunnel Endpoint Identifier - ebi_t eps_bearer_id; -} Gtpv1uUpdateTunnelResp; - -typedef struct { - Teid_t context_teid; ///< local SGW S11 Tunnel Endpoint Identifier - Teid_t S1u_teid; ///< local S1U Tunnel Endpoint Identifier to be deleted -} Gtpv1uDeleteTunnelReq; - -typedef struct { - uint8_t status; ///< Status of S1U endpoint deleteion (Failed = 0xFF or Success = 0x0) - Teid_t context_teid; ///< local SGW S11 Tunnel Endpoint Identifier - Teid_t S1u_teid; ///< local S1U Tunnel Endpoint Identifier to be deleted -} Gtpv1uDeleteTunnelResp; - -typedef struct { - uint8_t *buffer; - uint32_t length; - uint32_t offset; ///< start of message offset in buffer - Teid_t local_S1u_teid; ///< Tunnel Endpoint Identifier -} Gtpv1uTunnelDataInd; - -typedef struct { - uint8_t *buffer; - uint32_t length; - uint32_t offset; ///< start of message offset in buffer - Teid_t local_S1u_teid; ///< Tunnel Endpoint Identifier - Teid_t S1u_enb_teid; ///< Tunnel Endpoint Identifier -} Gtpv1uTunnelDataReq; - -#endif /* GTPV1_U_MESSAGES_TYPES_H_ */ diff --git a/openair3/COMMON/messages_def.h b/openair3/COMMON/messages_def.h deleted file mode 100644 index 1c1cdbaf0f..0000000000 --- a/openair3/COMMON/messages_def.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -// These messages files are mandatory and must always be placed in first position -#include "intertask_messages_def.h" -#include "timer_messages_def.h" - -// Messages files used between tasks -#include "gtpv1_u_messages_def.h" -#include "ip_forward_messages_def.h" -#include "nas_messages_def.h" -#include "s11_messages_def.h" -#include "s1ap_messages_def.h" -#include "s6a_messages_def.h" -#include "sctp_messages_def.h" -#include "sgw_lite_def.h" -#include "udp_messages_def.h" -#include "mme_app_messages_def.h" diff --git a/openair3/COMMON/nas_messages_def.h b/openair3/COMMON/nas_messages_def.h deleted file mode 100644 index 9bdcde4fdf..0000000000 --- a/openair3/COMMON/nas_messages_def.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -//WARNING: Do not include this header directly. Use intertask_interface.h instead. - -// Messages for NAS logging -MESSAGE_DEF(NAS_DL_EMM_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_dl_emm_raw_msg) -MESSAGE_DEF(NAS_UL_EMM_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_ul_emm_raw_msg) - -MESSAGE_DEF(NAS_DL_EMM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_emm_plain_msg_t, nas_dl_emm_plain_msg) -MESSAGE_DEF(NAS_UL_EMM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_emm_plain_msg_t, nas_ul_emm_plain_msg) -MESSAGE_DEF(NAS_DL_EMM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_emm_protected_msg_t, nas_dl_emm_protected_msg) -MESSAGE_DEF(NAS_UL_EMM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_emm_protected_msg_t, nas_ul_emm_protected_msg) - -MESSAGE_DEF(NAS_DL_ESM_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_dl_esm_raw_msg) -MESSAGE_DEF(NAS_UL_ESM_RAW_MSG, MESSAGE_PRIORITY_MED, nas_raw_msg_t, nas_ul_esm_raw_msg) - -MESSAGE_DEF(NAS_DL_ESM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_esm_plain_msg_t, nas_dl_esm_plain_msg) -MESSAGE_DEF(NAS_UL_ESM_PLAIN_MSG, MESSAGE_PRIORITY_MED, nas_esm_plain_msg_t, nas_ul_esm_plain_msg) -MESSAGE_DEF(NAS_DL_ESM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_esm_protected_msg_t, nas_dl_esm_protected_msg) -MESSAGE_DEF(NAS_UL_ESM_PROTECTED_MSG, MESSAGE_PRIORITY_MED, nas_esm_protected_msg_t, nas_ul_esm_protected_msg) - -/* */ -MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, nas_paging_ind_t, nas_paging_ind) -MESSAGE_DEF(NAS_PDN_CONNECTIVITY_REQ, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_req_t, nas_pdn_connectivity_req) -MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_IND, MESSAGE_PRIORITY_MED, nas_conn_est_ind_t, nas_conn_est_ind) -MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_CNF, MESSAGE_PRIORITY_MED, nas_conn_est_cnf_t, nas_conn_est_cnf) -MESSAGE_DEF(NAS_CONNECTION_RELEASE_IND, MESSAGE_PRIORITY_MED, nas_conn_rel_ind_t, nas_conn_rel_ind) -MESSAGE_DEF(NAS_UPLINK_DATA_IND, MESSAGE_PRIORITY_MED, nas_ul_data_ind_t, nas_ul_data_ind) -MESSAGE_DEF(NAS_DOWNLINK_DATA_REQ, MESSAGE_PRIORITY_MED, nas_dl_data_req_t, nas_dl_data_req) -MESSAGE_DEF(NAS_DOWNLINK_DATA_CNF, MESSAGE_PRIORITY_MED, nas_dl_data_cnf_t, nas_dl_data_cnf) -MESSAGE_DEF(NAS_DOWNLINK_DATA_REJ, MESSAGE_PRIORITY_MED, nas_dl_data_rej_t, nas_dl_data_rej) -MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_REQ, MESSAGE_PRIORITY_MED, nas_rab_est_req_t, nas_rab_est_req) -MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_RESP, MESSAGE_PRIORITY_MED, nas_rab_est_rsp_t, nas_rab_est_rsp) -MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, nas_rab_rel_req_t, nas_rab_rel_req) - -/* NAS layer -> MME app messages */ -MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_REQ, MESSAGE_PRIORITY_MED, nas_auth_param_req_t, nas_auth_param_req) - -/* MME app -> NAS layer messages */ -MESSAGE_DEF(NAS_PDN_CONNECTIVITY_RSP, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_rsp_t, nas_pdn_connectivity_rsp) -MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_fail_t, nas_pdn_connectivity_fail) -MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp) -MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail) - diff --git a/openair3/COMMON/nas_messages_types.h b/openair3/COMMON/nas_messages_types.h deleted file mode 100644 index 81a44fa4f4..0000000000 --- a/openair3/COMMON/nas_messages_types.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "as_message.h" -#include "nas_message.h" - -#ifndef NAS_MESSAGES_TYPES_H_ -#define NAS_MESSAGES_TYPES_H_ - -#define NAS_DL_EMM_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_emm_raw_msg -#define NAS_UL_EMM_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_emm_raw_msg - -#define NAS_DL_EMM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_emm_protected_msg -#define NAS_UL_EMM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_emm_protected_msg -#define NAS_DL_EMM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_emm_plain_msg -#define NAS_UL_EMM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_emm_plain_msg - -#define NAS_DL_ESM_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_esm_raw_msg -#define NAS_UL_ESM_RAW_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_esm_raw_msg - -#define NAS_DL_ESM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_esm_protected_msg -#define NAS_UL_ESM_PROTECTED_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_esm_protected_msg -#define NAS_DL_ESM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_esm_plain_msg -#define NAS_UL_ESM_PLAIN_MSG(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_esm_plain_msg - -#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind -#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req -#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf -#define NAS_DL_DATA_REJ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_rej -#define NAS_PDN_CONNECTIVITY_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_req -#define NAS_PDN_CONNECTIVITY_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_rsp -#define NAS_PDN_CONNECTIVITY_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_fail -#define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind -#define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf -#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param -#define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req -#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_req -#define NAS_AUTHENTICATION_PARAM_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_rsp -#define NAS_AUTHENTICATION_PARAM_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_fail - -#define NAS_DATA_LENGHT_MAX 256 - - - -typedef enum { - EMM_MSG_HEADER = 1, - EMM_MSG_ATTACH_REQUEST, - EMM_MSG_ATTACH_ACCEPT, - EMM_MSG_ATTACH_COMPLETE, - EMM_MSG_ATTACH_REJECT, - EMM_MSG_DETACH_REQUEST, - EMM_MSG_DETACH_ACCEPT, - EMM_MSG_TRACKING_AREA_UPDATE_REQUEST, - EMM_MSG_TRACKING_AREA_UPDATE_ACCEPT, - EMM_MSG_TRACKING_AREA_UPDATE_COMPLETE, - EMM_MSG_TRACKING_AREA_UPDATE_REJECT, - EMM_MSG_EXTENDED_SERVICE_REQUEST, - EMM_MSG_SERVICE_REQUEST, - EMM_MSG_SERVICE_REJECT, - EMM_MSG_GUTI_REALLOCATION_COMMAND, - EMM_MSG_GUTI_REALLOCATION_COMPLETE, - EMM_MSG_AUTHENTICATION_REQUEST, - EMM_MSG_AUTHENTICATION_RESPONSE, - EMM_MSG_AUTHENTICATION_REJECT, - EMM_MSG_AUTHENTICATION_FAILURE, - EMM_MSG_IDENTITY_REQUEST, - EMM_MSG_IDENTITY_RESPONSE, - EMM_MSG_SECURITY_MODE_COMMAND, - EMM_MSG_SECURITY_MODE_COMPLETE, - EMM_MSG_SECURITY_MODE_REJECT, - EMM_MSG_EMM_STATUS, - EMM_MSG_EMM_INFORMATION, - EMM_MSG_DOWNLINK_NAS_TRANSPORT, - EMM_MSG_UPLINK_NAS_TRANSPORT, - EMM_MSG_CS_SERVICE_NOTIFICATION, -} emm_message_ids_t; - - - -typedef enum { - ESM_MSG_HEADER = 1, - ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST, - ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT, - ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT, - ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST, - ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT, - ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT, - ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_REQUEST, - ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_ACCEPT, - ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_REJECT, - ESM_MSG_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST, - ESM_MSG_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT, - ESM_MSG_PDN_CONNECTIVITY_REQUEST, - ESM_MSG_PDN_CONNECTIVITY_REJECT, - ESM_MSG_PDN_DISCONNECT_REQUEST, - ESM_MSG_PDN_DISCONNECT_REJECT, - ESM_MSG_BEARER_RESOURCE_ALLOCATION_REQUEST, - ESM_MSG_BEARER_RESOURCE_ALLOCATION_REJECT, - ESM_MSG_BEARER_RESOURCE_MODIFICATION_REQUEST, - ESM_MSG_BEARER_RESOURCE_MODIFICATION_REJECT, - ESM_MSG_ESM_INFORMATION_REQUEST, - ESM_MSG_ESM_INFORMATION_RESPONSE, - ESM_MSG_ESM_STATUS, -} esm_message_ids_t; - - - -typedef struct nas_raw_msg_s { - uint32_t lenght; - uint8_t data[NAS_DATA_LENGHT_MAX]; -} nas_raw_msg_t; - - - -typedef struct nas_emm_plain_msg_s { - emm_message_ids_t present; - EMM_msg choice; - -} nas_emm_plain_msg_t; - - - -typedef struct nas_emm_protected_msg_s { - nas_message_security_header_t header; - emm_message_ids_t present; - EMM_msg choice; -} nas_emm_protected_msg_t; - - -typedef struct nas_esm_plain_msg_s { - esm_message_ids_t present; - ESM_msg choice; - -} nas_esm_plain_msg_t; - - -typedef struct nas_esm_protected_msg_s { - nas_message_security_header_t header; - esm_message_ids_t present; - ESM_msg choice; -} nas_esm_protected_msg_t; - - -typedef struct nas_paging_ind_s { - -} nas_paging_ind_t; - - -typedef struct nas_pdn_connectivity_req_s { - int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry - unsigned ue_id; // nas ref - char imsi[16]; - uint8_t imsi_length; - network_qos_t qos; - pco_flat_t pco; - OctetString apn; - OctetString pdn_addr; - int pdn_type; - void *proc_data; - int request_type; -} nas_pdn_connectivity_req_t; - - -typedef struct nas_pdn_connectivity_rsp_s { - int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry - unsigned ue_id; // nas ref - network_qos_t qos; - pco_flat_t pco; - OctetString apn; - OctetString pdn_addr; - int pdn_type; - void *proc_data; - int request_type; - - unsigned eNB_ue_s1ap_id:24; - uint32_t mme_ue_s1ap_id; - - /* Key eNB */ - //uint8_t keNB[32]; - - ambr_t ambr; - ambr_t apn_ambr; - - /* EPS bearer ID */ - unsigned ebi:4; - - /* QoS */ - qci_t qci; - priority_level_t prio_level; - pre_emp_vulnerability_t pre_emp_vulnerability; - pre_emp_capability_t pre_emp_capability; - - /* S-GW TEID for user-plane */ - Teid_t sgw_s1u_teid; - /* S-GW IP address for User-Plane */ - ip_address_t sgw_s1u_address; -} nas_pdn_connectivity_rsp_t; - - -typedef struct nas_pdn_connectivity_fail_s { - unsigned ue_id; // nas ref -} nas_pdn_connectivity_fail_t; - - -typedef struct nas_conn_est_ind_s { - nas_establish_ind_t nas; - - /* Transparent message from s1ap to be forwarded to MME_APP or - * to S1AP if connection establishment is rejected by NAS. - */ - s1ap_initial_ue_message_t transparent; -} nas_conn_est_ind_t; - - -typedef nas_establish_rsp_t nas_conn_est_rej_t; - - -typedef nas_establish_cnf_t nas_conn_est_cnf_t; - - -typedef struct nas_conn_rel_ind_s { - -} nas_conn_rel_ind_t; - -typedef ul_info_transfer_ind_t nas_ul_data_ind_t; -typedef dl_info_transfer_req_t nas_dl_data_req_t; -typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t; - - -typedef struct nas_dl_data_rej_s { - uint32_t UEid; /* UE lower layer identifier */ - as_nas_info_t nasMsg; /* Uplink NAS message */ -} nas_dl_data_rej_t; - -typedef struct nas_rab_est_req_s { - -} nas_rab_est_req_t; - - -typedef struct nas_rab_est_rsp_s { - -} nas_rab_est_rsp_t; - - -typedef struct nas_rab_rel_req_s { - -} nas_rab_rel_req_t; - - -typedef struct nas_attach_req_s { - /* TODO: Set the correct size */ - char apn[100]; - char imsi[16]; -#define INITIAL_REQUEST (0x1) - unsigned initial:1; - s1ap_initial_ue_message_t transparent; -} nas_attach_req_t; - - -typedef struct nas_auth_req_s { - /* UE imsi */ - char imsi[16]; - -#define NAS_FAILURE_OK 0x0 -#define NAS_FAILURE_IND 0x1 - unsigned failure:1; - int cause; -} nas_auth_req_t; - - -typedef struct nas_auth_resp_s { - char imsi[16]; -} nas_auth_resp_t; - -typedef struct nas_auth_param_req_s { - /* UE identifier */ - uint32_t ue_id; - - /* Imsi of the UE (In case of initial request) */ - char imsi[16]; - uint8_t imsi_length; - - /* Indicates whether the procedure corresponds to a new connection or not */ - uint8_t initial_req:1; - - uint8_t re_synchronization:1; - uint8_t auts[14]; -} nas_auth_param_req_t; - - -typedef struct nas_auth_param_rsp_s { - /* UE identifier */ - uint32_t ue_id; - - /* For future use: nb of vectors provided */ - uint8_t nb_vectors; - - /* Consider only one E-UTRAN vector for the moment... */ - eutran_vector_t vector; -} nas_auth_param_rsp_t; - -typedef struct nas_auth_param_fail_s { - /* UE identifier */ - uint32_t ue_id; - - /* S6A mapped to NAS cause */ - nas_cause_t cause; -} nas_auth_param_fail_t; - - -#endif /* NAS_MESSAGES_TYPES_H_ */ diff --git a/openair3/COMMON/s1ap_messages_def.h b/openair3/COMMON/s1ap_messages_def.h deleted file mode 100644 index ffb9aa4236..0000000000 --- a/openair3/COMMON/s1ap_messages_def.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -//WARNING: Do not include this header directly. Use intertask_interface.h instead. - -/* Messages for S1AP logging */ -MESSAGE_DEF(S1AP_UPLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_uplink_nas_log) -MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_capability_ind_log) -MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_context_setup_log) -MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_nas_non_delivery_ind_log) -MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_downlink_nas_log) -MESSAGE_DEF(S1AP_S1_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_s1_setup_log) -MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_initial_ue_message_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_req_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_command_log) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_log) -MESSAGE_DEF(S1AP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log) - -MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t , s1ap_ue_cap_ind) -MESSAGE_DEF(S1AP_ENB_DEREGISTERED_IND , MESSAGE_PRIORITY_MED, s1ap_eNB_deregistered_ind_t , s1ap_eNB_deregistered_ind) -MESSAGE_DEF(S1AP_DEREGISTER_UE_REQ , MESSAGE_PRIORITY_MED, s1ap_deregister_ue_req_t , s1ap_deregister_ue_req) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_context_release_req_t , s1ap_ue_context_release_req) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_context_release_command_t, s1ap_ue_context_release_command) -MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, s1ap_ue_context_release_complete_t, s1ap_ue_context_release_complete) diff --git a/openair3/COMMON/s1ap_messages_types.h b/openair3/COMMON/s1ap_messages_types.h deleted file mode 100644 index e6c3bba504..0000000000 --- a/openair3/COMMON/s1ap_messages_types.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef S1AP_MESSAGES_TYPES_H_ -#define S1AP_MESSAGES_TYPES_H_ - -#define S1AP_ENB_DEREGISTERED_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_eNB_deregistered_ind -#define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req -#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_req -#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_command -#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_complete - -typedef struct s1ap_initial_ue_message_s { - unsigned eNB_ue_s1ap_id:24; - uint32_t mme_ue_s1ap_id; - cgi_t e_utran_cgi; -} s1ap_initial_ue_message_t; - -typedef struct s1ap_initial_ctxt_setup_req_s { - unsigned eNB_ue_s1ap_id:24; - uint32_t mme_ue_s1ap_id; - - /* Key eNB */ - uint8_t keNB[32]; - - ambr_t ambr; - ambr_t apn_ambr; - - /* EPS bearer ID */ - unsigned ebi:4; - - /* QoS */ - qci_t qci; - priority_level_t prio_level; - pre_emp_vulnerability_t pre_emp_vulnerability; - pre_emp_capability_t pre_emp_capability; - - /* S-GW TEID for user-plane */ - Teid_t teid; - /* S-GW IP address for User-Plane */ - ip_address_t s_gw_address; -} s1ap_initial_ctxt_setup_req_t; - -typedef struct s1ap_ue_cap_ind_s { - unsigned eNB_ue_s1ap_id:24; - uint32_t mme_ue_s1ap_id; - uint8_t radio_capabilities[100]; - uint32_t radio_capabilities_length; -} s1ap_ue_cap_ind_t; - -#define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20 -typedef struct s1ap_eNB_deregistered_ind_s { - uint8_t nb_ue_to_deregister; - uint32_t mme_ue_s1ap_id[S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE]; -} s1ap_eNB_deregistered_ind_t; - -typedef struct s1ap_deregister_ue_req_s { - uint32_t mme_ue_s1ap_id; -} s1ap_deregister_ue_req_t; - -typedef struct s1ap_ue_context_release_req_s { - uint32_t mme_ue_s1ap_id; -} s1ap_ue_context_release_req_t; - -typedef struct s1ap_ue_context_release_command_s { - uint32_t mme_ue_s1ap_id; -} s1ap_ue_context_release_command_t; - -typedef struct s1ap_ue_context_release_complete_s { - uint32_t mme_ue_s1ap_id; -} s1ap_ue_context_release_complete_t; - -#endif /* S1AP_MESSAGES_TYPES_H_ */ diff --git a/openair3/COMMON/sctp_messages_def.h b/openair3/COMMON/sctp_messages_def.h deleted file mode 100644 index c2d51c91eb..0000000000 --- a/openair3/COMMON/sctp_messages_def.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -//WARNING: Do not include this header directly. Use intertask_interface.h instead. - -MESSAGE_DEF(SCTP_INIT_MSG, MESSAGE_PRIORITY_MED, SctpInit, sctpInit) -MESSAGE_DEF(SCTP_DATA_REQ, MESSAGE_PRIORITY_MED, sctp_data_req_t, sctp_data_req) -MESSAGE_DEF(SCTP_DATA_IND, MESSAGE_PRIORITY_MED, sctp_data_ind_t, sctp_data_ind) -MESSAGE_DEF(SCTP_NEW_ASSOCIATION, MESSAGE_PRIORITY_MAX, sctp_new_peer_t, sctp_new_peer) -MESSAGE_DEF(SCTP_CLOSE_ASSOCIATION, MESSAGE_PRIORITY_MAX, sctp_close_association_t, sctp_close_association) diff --git a/openair3/COMMON/sctp_messages_types.h b/openair3/COMMON/sctp_messages_types.h deleted file mode 100644 index 98a92c66b6..0000000000 --- a/openair3/COMMON/sctp_messages_types.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef SCTP_MESSAGES_TYPES_H_ -#define SCTP_MESSAGES_TYPES_H_ - -#define SCTP_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.sctp_data_ind -#define SCTP_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.sctp_data_req -#define SCTP_INIT_MSG(mSGpTR) (mSGpTR)->ittiMsg.sctpInit -#define SCTP_CLOSE_ASSOCIATION(mSGpTR) (mSGpTR)->ittiMsg.sctp_close_association - -typedef struct sctp_data_req_s { - uint8_t *buffer; - uint32_t bufLen; - uint32_t assocId; - uint16_t stream; -} sctp_data_req_t; - -typedef struct sctp_data_ind_s { - uint8_t *buffer; ///< SCTP buffer - uint32_t buf_length; ///< SCTP buffer length - int32_t assoc_id; ///< SCTP physical association ID - uint8_t stream; ///< Stream number on which data had been received - uint16_t instreams; ///< Number of input streams for the SCTP connection between peers - uint16_t outstreams; ///< Number of output streams for the SCTP connection between peers -} sctp_data_ind_t; - -typedef struct sctp_init_s { - /* Request usage of ipv4 */ - unsigned ipv4:1; - /* Request usage of ipv6 */ - unsigned ipv6:1; - uint8_t nb_ipv4_addr; - uint32_t ipv4_address[10]; - uint8_t nb_ipv6_addr; - char *ipv6_address[10]; - uint16_t port; - uint32_t ppid; -} SctpInit; - -typedef struct sctp_close_association_s { - uint32_t assoc_id; -} sctp_close_association_t; - -typedef struct sctp_new_peer_s { - uint32_t instreams; - uint32_t outstreams; - uint32_t assoc_id; -} sctp_new_peer_t; - -#endif /* SCTP_MESSAGES_TYPES_H_ */ diff --git a/openair3/COMMON/tasks_def.h b/openair3/COMMON/tasks_def.h deleted file mode 100644 index d1b7b8d756..0000000000 --- a/openair3/COMMON/tasks_def.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -// This task is mandatory and must always be placed in first position -TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED, 10) - -// Other possible tasks in the process - -/// GTPV1-U task -TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 200) -/// FW_IP task -TASK_DEF(TASK_FW_IP, TASK_PRIORITY_MED, 200) -/// MME Applicative task -TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200) -/// NAS task -TASK_DEF(TASK_NAS_MME, TASK_PRIORITY_MED, 200) -/// S11 task -TASK_DEF(TASK_S11, TASK_PRIORITY_MED, 200) -/// S1AP task -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) -/// S6a task -TASK_DEF(TASK_S6A, TASK_PRIORITY_MED, 200) -/// SCTP task -TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) -/// Serving and Proxy Gateway Application task -TASK_DEF(TASK_SPGW_APP, TASK_PRIORITY_MED, 200) -/// UDP task -TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 200) -//MESSAGE GENERATOR TASK -TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200) diff --git a/openair3/COMMON/udp_messages_def.h b/openair3/COMMON/udp_messages_def.h deleted file mode 100644 index 35322f2450..0000000000 --- a/openair3/COMMON/udp_messages_def.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -MESSAGE_DEF(UDP_INIT, MESSAGE_PRIORITY_MED, udp_init_t, udp_init) -MESSAGE_DEF(UDP_DATA_REQ, MESSAGE_PRIORITY_MED, udp_data_req_t, udp_data_req) -MESSAGE_DEF(UDP_DATA_IND, MESSAGE_PRIORITY_MED, udp_data_ind_t, udp_data_ind) diff --git a/openair3/COMMON/udp_messages_types.h b/openair3/COMMON/udp_messages_types.h deleted file mode 100644 index 7825a924d1..0000000000 --- a/openair3/COMMON/udp_messages_types.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef UDP_MESSAGES_TYPES_H_ -#define UDP_MESSAGES_TYPES_H_ - -#define UDP_INIT(mSGpTR) (mSGpTR)->ittiMsg.udp_init - -typedef struct { - uint32_t port; - char *address; -} udp_init_t; - -typedef struct { - uint8_t *buffer; - uint32_t buffer_length; - uint32_t buffer_offset; - uint32_t peer_address; - uint32_t peer_port; -} udp_data_req_t; - -typedef struct { - uint8_t *buffer; - uint32_t buffer_length; - uint32_t peer_address; - uint32_t peer_port; -} udp_data_ind_t; - -#endif /* UDP_MESSAGES_TYPES_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 1e2cd85710..c8bfd1255c 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -263,7 +263,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( buffer_len, buffer, PDCP_TRANSMISSION_MODE_DATA -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,NULL, NULL #endif ); @@ -1052,7 +1052,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); } else { - if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_DRB_Identity)) { + if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_LTE_DRB_Identity)) { enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; sgw_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_sgw; stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; diff --git a/openair3/GTPV1-U/gtpv1u_eNB_defs.h b/openair3/GTPV1-U/gtpv1u_eNB_defs.h index db928c4438..978a3c58bc 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB_defs.h +++ b/openair3/GTPV1-U/gtpv1u_eNB_defs.h @@ -28,7 +28,7 @@ */ #include "hashtable.h" -#include "asn_constant.h" +#include "LTE_asn_constant.h" #ifndef GTPV1U_ENB_DEFS_H_ #define GTPV1U_ENB_DEFS_H_ @@ -38,7 +38,7 @@ #define GTPV1U_UDP_PORT (2152) #define GTPV1U_BEARER_OFFSET 3 -#define GTPV1U_MAX_BEARERS_ID (max_val_DRB_Identity - GTPV1U_BEARER_OFFSET) +#define GTPV1U_MAX_BEARERS_ID (max_val_LTE_DRB_Identity - GTPV1U_BEARER_OFFSET) typedef enum { BEARER_DOWN = 0, diff --git a/openair3/NAS/COMMON/API/NETWORK/l2_message.h b/openair3/NAS/COMMON/API/NETWORK/l2_message.h deleted file mode 100644 index 9cf65b7736..0000000000 --- a/openair3/NAS/COMMON/API/NETWORK/l2_message.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/***************************************************************************** - -Source as_message.h - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the messages supported by the Access Stratum sublayer - protocol (usually RRC and S1AP for E-UTRAN) and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __AS_MESSAGE_H__ -#define __AS_MESSAGE_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Access Stratum Message types */ -#define AS_REQUEST 0x0100 -#define AS_RESPONSE 0x0200 -#define AS_INDICATION 0x0400 -#define AS_CONFIRM 0x0800 - -/* - * Access Stratum Message identifiers - * ---------------------------------- - */ - -/* Cell information relevant for cell selection processing */ -#define AS_CELL_INFO 0x01 -#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST) -#define AS_CELL_INFO_RSP (AS_CELL_INFO | AS_RESPONSE) -#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION) - -/* Security mode control */ -#define AS_SECURITY 0x02 -#define AS_SECURITY_REQ (AS_SECURITY | AS_REQUEST) -#define AS_SECURITY_RSP (AS_SECURITY | AS_RESPONSE) - -/* Paging information */ -#define AS_PAGING 0x03 -#define AS_PAGING_IND (AS_PAGING | AS_INDICATION) - -/* NAS signalling connection establishment */ -#define AS_NAS_ESTABLISH 0x04 -#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST) -#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE) - -/* NAS signalling connection release */ -#define AS_NAS_RELEASE 0x05 -#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST) -#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION) - -/* NAS information transfer */ -#define AS_INFO_TRANSFER 0x10 -#define AS_UL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_REQUEST) -#define AS_DL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_INDICATION) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Available PLMNs and cell Information - * -------------------------------------------------------------------------- - */ - -/* Radio access technologies supported by the network */ -#define AS_GSM (1 << NET_ACCESS_GSM) -#define AS_COMPACT (1 << NET_ACCESS_COMPACT) -#define AS_UTRAN (1 << NET_ACCESS_UTRAN) -#define AS_EGPRS (1 << NET_ACCESS_EGPRS) -#define AS_HSDPA (1 << NET_ACCESS_HSDPA) -#define AS_HSUPA (1 << NET_ACCESS_HSUPA) -#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) -#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) - -/* - * NAS->AS -K_eNB refresh request - * NAS request AS to refresh its KeNB key - */ -typedef struct kenb_refresh_req_s { - Byte_t kenb[32]; -} kenb_refresh_req_t; - -/* - * NAS->AS - Cell Information request - * NAS request AS to search for a suitable cell belonging to the selected - * PLMN to camp on. - */ -typedef struct { - plmn_t plmnID; /* PLMN identifier */ - Byte_t rat; /* Bitmap - set of radio access technologies */ -} cell_info_req_t; - -/* - * AS->NAS - Cell Information response - * AS search for a suitable cell and respond to NAS. If found, the cell - * is selected to camp on. - */ -typedef struct { - plmn_t plmnID; /* PLMN identifier */ - TAC_t tac; /* identifies a tracking area the PLMN belongs to */ - CI_t cellID; /* identifies a cell within a PLMN */ - AcT_t rat; /* radio access technology supported by the cell */ -} cell_info_rsp_t; - -/* - * AS->NAS - Cell Information indication - * AS Reports available PLMNs with associated Radio Access Technologies - * to NAS on request from NAS or autonomously. - */ -typedef struct { -#define PLMN_LIST_MAX_SIZE 6 - PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */ - Byte_t rat[PLMN_LIST_MAX_SIZE]; /* Radio access technologies */ - TAC_t tac; /* identifies a tracking area within a scope of PLMNs */ - CI_t cellID; /* identifies a cell within a PLMN */ -} cell_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Security mode control - * -------------------------------------------------------------------------- - */ - -/* - * TODO: NAS->AS - Security command request - */ -typedef struct {} security_req_t; - - -/* - * TODO: AS->NAS - Security command response - */ -typedef struct {} security_rsp_t; - - -/* - * -------------------------------------------------------------------------- - * Paging information - * -------------------------------------------------------------------------- - */ - -/* - * TODO: AS->NAS - Paging Information indication - */ -typedef struct {} paging_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection establishment - * -------------------------------------------------------------------------- - */ - -/* Cause of RRC connection establishment */ -#define AS_CAUSE_EMERGENCY (NET_ESTABLISH_CAUSE_EMERGENCY) -#define AS_CAUSE_HIGH_PRIO (NET_ESTABLISH_CAUSE_HIGH_PRIO) -#define AS_CAUSE_MT_ACCESS (NET_ESTABLISH_CAUSE_MT_ACCESS) -#define AS_CAUSE_MO_SIGNAL (NET_ESTABLISH_CAUSE_MO_SIGNAL) -#define AS_CAUSE_MO_DATA (NET_ESTABLISH_CAUSE_MO_DATA) -#define AS_CAUSE_V1020 (NET_ESTABLISH_CAUSE_V1020) - -/* Type of the call associated to the RRC connection establishment */ -#define AS_TYPE_ORIGINATING_SIGNAL (NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL) -#define AS_TYPE_EMERGENCY_CALLS (NET_ESTABLISH_TYPE_EMERGENCY_CALLS) -#define AS_TYPE_ORIGINATING_CALLS (NET_ESTABLISH_TYPE_ORIGINATING_CALLS) -#define AS_TYPE_TERMINATING_CALLS (NET_ESTABLISH_TYPE_TERMINATING_CALLS) -#define AS_TYPE_MO_CS_FALLBACK (NET_ESTABLISH_TYPE_MO_CS_FALLBACK) - - -/* Structure of the SAE Temporary Mobile Subscriber Identity */ -typedef struct { - uint8_t MMEcode; /* MME code that allocated the GUTI */ - uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ -} as_stmsi_t; - -/* Structure of the dedicated NAS information */ -typedef struct { - uint32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ -} as_nas_info_t; - -/* - * NAS->AS - NAS signalling connection establishment request - * NAS request AS to perform the RRC connection establishment procedure - * to transfer initial NAS message to the network while UE is in IDLE mode. - */ -typedef struct { - uint8_t cause; /* Connection establishment cause */ - uint8_t type; /* Associated call type */ - plmn_t plmnID; /* Identifier of the selected PLMN */ - as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */ - as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */ -} nas_establish_req_t; - -/* - * TODO: AS->NAS - NAS signalling connection establishment response - */ -typedef struct {} nas_establish_rsp_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection release - * -------------------------------------------------------------------------- - */ - -/* - * TODO: NAS->AS - NAS signalling connection release request - */ -typedef struct {} nas_release_req_t; - -/* - * TODO: AS->NAS - NAS signalling connection release indication - */ -typedef struct {} nas_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS information transfer - * -------------------------------------------------------------------------- - */ - -/* - * AS->NAS - Downlink data transfer - * AS notifies upper layer that NAS or non-3GPP dedicated downlink information - * has to be transfered to NAS. -*/ -typedef as_nas_info_t dl_info_transfer_t; - -/* - * NAS->AS - Uplink data transfer request - * NAS requests under layer to transfer NAS or non-3GPP dedicated uplink - * information to AS. - */ -typedef as_nas_info_t ul_info_transfer_t; - -/* - * -------------------------------------------------------------------------- - * Structure of the AS messages handled by the network sublayer - * -------------------------------------------------------------------------- - */ -typedef struct { - uint16_t msgID; - union { - cell_info_req_t cell_info_req; - cell_info_rsp_t cell_info_rsp; - cell_info_ind_t cell_info_ind; - security_req_t security_req; - security_rsp_t security_rsp; - paging_ind_t paging_ind; - nas_establish_req_t nas_establish_req; - nas_establish_rsp_t nas_establish_rsp; - nas_release_req_t nas_release_req; - nas_release_ind_t nas_release_ind; - ul_info_transfer_t ul_info_transfer; - dl_info_transfer_t dl_info_transfer; - } __attribute__((__packed__)) msg; -} as_message_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int as_message_decode(const char* buffer, int length, as_message_t* msg); - -int as_message_encode(char* buffer, int length, const as_message_t* msg); - -/* Implemented in the network_api.c body file */ -int as_message_send(as_message_t* as_msg, const void* nas_msg); - -#endif /* __AS_MESSAGE_H__*/ diff --git a/openair3/NAS/TOOLS/network.h b/openair3/NAS/TOOLS/network.h deleted file mode 100644 index cde82f4560..0000000000 --- a/openair3/NAS/TOOLS/network.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/***************************************************************************** -Source network.h - -Version 0.1 - -Date 2013/03/26 - -Product USIM data generator - -Subsystem PLMN network operators - -Author Frederic Maurel - -Description Defines a list of PLMN network operators - -*****************************************************************************/ -#ifndef __NETWORK_H__ -#define __NETWORK_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ -/* - * PLMN network operator record index - */ -#define TEST1 0 -#define SFR1 1 -#define SFR2 2 -#define SFR3 3 -#define OAI_LTEBOX 4 -#define TM1 5 -#define FCT1 6 -#define VDF1 7 -#define VDF2 8 -#define VDF3 9 -#define VDF4 10 -#define VDF5 11 - - -#define SELECTED_PLMN TEST1 //SFR1 - -#define TEST_PLMN {0,0,0x0f,1,1,0} // 00101 -#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810 -#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811 -#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813 -#define OAI_LTEBOX_PLMN {0,2,0x0f,8,3,9} //20893 -#define TM_PLMN_1 {1,3,0,0,8,2} // 310280 -#define FCT_PLMN_1 {1,3,8,0,2,0} // 310028 -#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210 -#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141 -#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146 -#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622 -#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624 - - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * PLMN network operator record - */ -typedef struct { - unsigned int num; - plmn_t plmn; - char fullname[NET_FORMAT_LONG_SIZE + 1]; - char shortname[NET_FORMAT_SHORT_SIZE + 1]; - tac_t tac_start; - tac_t tac_end; -} network_record_t; - - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/* - * The list of PLMN network operator records - */ -network_record_t network_records[] = { - {00101, TEST_PLMN, "Test network", "OAI4G", 0x0001, 0xfffd}, - {20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd}, - {20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd}, - {20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd}, - {20893, OAI_LTEBOX_PLMN, "OAI LTEBOX", "OAIALU", 0x0001, 0xfffd}, - {310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd}, - {310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd}, - {22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd}, - {2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd}, - {2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd}, - {2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd}, - {2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd}, -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __NETWORK_H__*/ diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 5b10e60893..850f97150a 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -68,14 +68,9 @@ Description Defines the authentication EMM procedure executed by the #include "usim_api.h" #include "secu_defs.h" #include "Authentication.h" +#include "targets/RT/USER/lte-softmodem.h" -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -extern uint8_t usim_test; - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -211,7 +206,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, * of the core network by means of the received AUTN parameter and * request the USIM to compute RES, CK and IK for given RAND */ - if(usim_test == 0) + if(get_softmodem_params()->usim_test == 0) { rc = usim_api_authenticate(&user->usim_data, rand, autn, &auts, &res, &ck, &ik); } diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c index fe18a98d38..f77c2921a3 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c @@ -47,7 +47,7 @@ Description Implements the EPS Mobility Management procedures executed #include "commonDef.h" #include "networkDef.h" #include "nas_log.h" - +#include "targets/RT/USER/lte-softmodem.h" #include "emm_proc.h" #include @@ -55,7 +55,7 @@ Description Implements the EPS Mobility Management procedures executed /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ -extern uint8_t usim_test; + /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ @@ -110,7 +110,7 @@ int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt) /* * Initiate the attach procedure for EPS services */ - if(usim_test == 0) + if(get_softmodem_params()->usim_test == 0) { rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EPS); } diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index e2a327f488..7404cd8b8a 100644 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -57,7 +57,13 @@ Description Defines functions used to handle EPS bearer contexts. #include #include #include - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + #include "openairinterface5g_limits.h" + extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif +#endif +extern uint8_t nfapi_mode; /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -208,7 +214,7 @@ int esm_ebr_context_create( char broadcast[INET_ADDRSTRLEN]; struct in_addr in_addr; char command_line[500]; - int res; + int res = -1; switch (pdn->type) { case NET_PDN_TYPE_IPV4V6: @@ -272,7 +278,38 @@ int esm_ebr_context_create( strcpy(broadcast, ipv4_addr); } - res = sprintf(command_line, + if(nfapi_mode ==3){ + // this is for L2 FAPI simulator. + // change for multiple UE's like 256UEs. + // if it's made too many tables , OS may crush so we use one table. +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2; + res = sprintf(command_line, + "ifconfig oip%d %s netmask %s broadcast %s up && " + "ip rule add from %s/24 table %d && " + "ip rule add to %s/24 table %d && " + "ip route add default dev oip%d table %d", + inst_nic + 1, ipv4_addr, netmask, broadcast, + ipv4_addr, 201, + ipv4_addr, 201, + inst_nic + 1, 201); + + inst_pdcp_list[inst_nic] = ueid; +#else + res = sprintf(command_line, + "ifconfig oip%d %s netmask %s broadcast %s up && " + "ip rule add from %s/32 table %d && " + "ip rule add to %s/32 table %d && " + "ip route add default dev oip%d table %d", + ueid + 1, ipv4_addr, netmask, broadcast, + ipv4_addr, ueid + 201, + ipv4_addr, ueid + 201, + ueid + 1, ueid + 201); +#endif +#endif + } else { + res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/32 table %d && " "ip rule add to %s/32 table %d && " @@ -281,6 +318,7 @@ int esm_ebr_context_create( ipv4_addr, ueid + 201, ipv4_addr, ueid + 201, ueid + 1, ueid + 201); + } if ( res<0 ) { LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string"); } diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 529ac5e602..6df6666638 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -40,7 +40,7 @@ // FIXME review these externs extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; char *make_port_str_from_ueid(const char *base_port_str, int ueid); diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 3edc5be0d5..9eab896d83 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -61,7 +61,7 @@ #include "assertions.h" #include "conversions.h" #if defined(TEST_S1C_MME) -#include "oaisim_mme_test_s1c.h" + #include "oaisim_mme_test_s1c.h" #endif s1ap_eNB_config_t s1ap_config; @@ -74,22 +74,17 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -uint32_t s1ap_generate_eNB_id(void) -{ +uint32_t s1ap_generate_eNB_id(void) { char *out; char hostname[50]; int ret; uint32_t eNB_id; - /* Retrieve the host name */ ret = gethostname(hostname, sizeof(hostname)); DevAssert(ret == 0); - out = crypt(hostname, "eurecom"); DevAssert(out != NULL); - eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]); - return eNB_id; } @@ -99,55 +94,42 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, uint16_t in_streams, uint16_t out_streams, uint8_t broadcast_plmn_num, - uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) -{ + uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) { MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; struct s1ap_eNB_mme_data_s *mme = NULL; - DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->out_streams = out_streams; - memcpy(&sctp_new_association_req_p->remote_address, mme_ip_address, sizeof(*mme_ip_address)); - memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance); - mme = NULL; if ( mme == NULL ) { - /* Create new MME descriptor */ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; + for (int i = 0; i < broadcast_plmn_num; ++i) s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; + s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME * but not yet associated. */ @@ -158,12 +140,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, } else if (mme->state == S1AP_ENB_STATE_WAITING) { instance_p->s1ap_mme_pending_nb ++; sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", instance_p->instance, mme->state, mme->cnx_id, instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); - /*s1ap_mme_data_p->cnx_id = mme->cnx_id; sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; @@ -181,13 +161,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, } -void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) -{ +void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) { s1ap_eNB_instance_t *new_instance; uint8_t index; - DevAssert(s1ap_register_eNB != NULL); - /* Look if the provided instance already exists */ new_instance = s1ap_eNB_get_instance(instance); @@ -197,38 +174,36 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0); DevCheck(new_instance->num_plmn == s1ap_register_eNB->num_plmn, new_instance->num_plmn, s1ap_register_eNB->num_plmn, 0); DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0); - for (int i = 0; i < new_instance->num_plmn; i++) - { + + for (int i = 0; i < new_instance->num_plmn; i++) { DevCheck(new_instance->mcc[i] == s1ap_register_eNB->mcc[i], new_instance->mcc[i], s1ap_register_eNB->mcc[i], 0); DevCheck(new_instance->mnc[i] == s1ap_register_eNB->mnc[i], new_instance->mnc[i], s1ap_register_eNB->mnc[i], 0); DevCheck(new_instance->mnc_digit_length[i] == s1ap_register_eNB->mnc_digit_length[i], new_instance->mnc_digit_length[i], s1ap_register_eNB->mnc_digit_length[i], 0); } + DevCheck(new_instance->default_drx == s1ap_register_eNB->default_drx, new_instance->default_drx, s1ap_register_eNB->default_drx, 0); } else { new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); DevAssert(new_instance != NULL); - RB_INIT(&new_instance->s1ap_ue_head); RB_INIT(&new_instance->s1ap_mme_head); - /* Copy usefull parameters */ new_instance->instance = instance; new_instance->eNB_name = s1ap_register_eNB->eNB_name; new_instance->eNB_id = s1ap_register_eNB->eNB_id; new_instance->cell_type = s1ap_register_eNB->cell_type; new_instance->tac = s1ap_register_eNB->tac; - for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) - { + + for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) { new_instance->mcc[i] = s1ap_register_eNB->mcc[i]; new_instance->mnc[i] = s1ap_register_eNB->mnc[i]; new_instance->mnc_digit_length[i] = s1ap_register_eNB->mnc_digit_length[i]; } + new_instance->num_plmn = s1ap_register_eNB->num_plmn; new_instance->default_drx = s1ap_register_eNB->default_drx; - /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ s1ap_eNB_insert_new_instance(new_instance); - S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n", instance, s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", @@ -250,16 +225,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * } } -void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) -{ +void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { s1ap_eNB_instance_t *instance_p; s1ap_eNB_mme_data_t *s1ap_mme_data_p; - DevAssert(sctp_new_association_resp != NULL); - instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1, sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); @@ -269,9 +240,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; } @@ -279,20 +248,17 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p); } static -void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) -{ +void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { int result; - DevAssert(sctp_data_ind != NULL); #if defined(TEST_S1C_MME) mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); + sctp_data_ind->buffer, sctp_data_ind->buffer_length); #else s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); @@ -301,23 +267,19 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -void s1ap_eNB_init(void) -{ +void s1ap_eNB_init(void) { S1AP_DEBUG("Starting S1AP layer\n"); - s1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_S1AP); MSC_START_USE(); } -void *s1ap_eNB_process_itti_msg(void* notUsed) -{ +void *s1ap_eNB_process_itti_msg(void *notUsed) { MessageDef *received_msg = NULL; int result; - itti_receive_msg(TASK_S1AP, &received_msg); + itti_receive_msg(TASK_S1AP, &received_msg); - switch (ITTI_MSG_ID(received_msg)) { + switch (ITTI_MSG_ID(received_msg)) { case TERMINATE_MESSAGE: S1AP_WARN(" *** Exiting S1AP thread\n"); itti_exit_task(); @@ -371,16 +333,16 @@ void *s1ap_eNB_process_itti_msg(void* notUsed) case S1AP_E_RAB_SETUP_RESP: { s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_E_RAB_SETUP_RESP(received_msg)); + &S1AP_E_RAB_SETUP_RESP(received_msg)); } break; case S1AP_E_RAB_MODIFY_RESP: { s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_E_RAB_MODIFY_RESP(received_msg)); + &S1AP_E_RAB_MODIFY_RESP(received_msg)); } break; - + case S1AP_NAS_NON_DELIVERY_IND: { s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &S1AP_NAS_NON_DELIVERY_IND(received_msg)); @@ -396,11 +358,8 @@ void *s1ap_eNB_process_itti_msg(void* notUsed) case S1AP_UE_CONTEXT_RELEASE_REQ: { s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test - s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &S1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); - - s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test DevAssert(s1ap_eNB_instance_p != NULL); // test @@ -413,9 +372,9 @@ void *s1ap_eNB_process_itti_msg(void* notUsed) } break; - case S1AP_E_RAB_RELEASE_RESPONSE: { - s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_E_RAB_RELEASE_RESPONSE(received_msg)); + case S1AP_E_RAB_RELEASE_RESPONSE: { + s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_E_RAB_RELEASE_RESPONSE(received_msg)); } break; @@ -423,20 +382,18 @@ void *s1ap_eNB_process_itti_msg(void* notUsed) S1AP_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; - } + } - result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - - received_msg = NULL; - return NULL; + result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + received_msg = NULL; + return NULL; } -void *s1ap_eNB_task(void *arg) -{ +void *s1ap_eNB_task(void *arg) { s1ap_eNB_init(); - + while (1) { (void) s1ap_eNB_process_itti_msg(NULL); } @@ -444,23 +401,26 @@ void *s1ap_eNB_task(void *arg) return NULL; } +//----------------------------------------------------------------------------- +/* +* eNB generate a S1 setup request towards MME +*/ static int s1ap_eNB_generate_s1_setup_request( - s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p) + s1ap_eNB_instance_t *instance_p, + s1ap_eNB_mme_data_t *s1ap_mme_data_p) +//----------------------------------------------------------------------------- { - S1AP_S1AP_PDU_t pdu; - S1AP_S1SetupRequest_t *out; - S1AP_S1SetupRequestIEs_t *ie; - S1AP_SupportedTAs_Item_t *ta; - S1AP_PLMNidentity_t *plmn; - uint8_t *buffer; - uint32_t len; + S1AP_S1AP_PDU_t pdu; + S1AP_S1SetupRequest_t *out = NULL; + S1AP_S1SetupRequestIEs_t *ie = NULL; + S1AP_SupportedTAs_Item_t *ta = NULL; + S1AP_PLMNidentity_t *plmn = NULL; + uint8_t *buffer = NULL; + uint32_t len = 0; int ret = 0; - DevAssert(instance_p != NULL); DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - /* Prepare the S1AP message to encode */ memset(&pdu, 0, sizeof(pdu)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; @@ -468,7 +428,6 @@ static int s1ap_eNB_generate_s1_setup_request( pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest; out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest; - /* mandatory */ ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID; @@ -519,7 +478,6 @@ static int s1ap_eNB_generate_s1_setup_request( ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX; @@ -540,6 +498,7 @@ static int s1ap_eNB_generate_s1_setup_request( /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0)) + if (0) { ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation; @@ -558,6 +517,7 @@ static int s1ap_eNB_generate_s1_setup_request( // ie->value.choice.NB_IoT_DefaultPagingDRX = ; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + #endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -567,6 +527,5 @@ static int s1ap_eNB_generate_s1_setup_request( /* Non UE-Associated signalling -> stream = 0 */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0); - return ret; } diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 5c6b208b87..0f7afb68f7 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -66,13 +66,13 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, static int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, @@ -86,13 +86,13 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, static int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); /* Handlers matrix. Only eNB related procedure present here */ s1ap_message_decoded_callback messages_callback[][3] = { @@ -148,16 +148,15 @@ s1ap_message_decoded_callback messages_callback[][3] = { #endif /* #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) */ }; char *s1ap_direction2String(int s1ap_dir) { -static char *s1ap_direction_String[] = { - "", /* Nothing */ - "Originating message", /* originating message */ - "Successfull outcome", /* successfull outcome */ - "UnSuccessfull outcome", /* successfull outcome */ -}; -return(s1ap_direction_String[s1ap_dir]); + static char *s1ap_direction_String[] = { + "", /* Nothing */ + "Originating message", /* originating message */ + "Successfull outcome", /* successfull outcome */ + "UnSuccessfull outcome", /* successfull outcome */ + }; + return(s1ap_direction_String[s1ap_dir]); } -void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown) -{ +void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown) { if (sctp_shutdown) { /* A previously connected MME has been shutdown */ @@ -173,7 +172,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more associated MME, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -192,7 +190,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more pending messages, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -201,13 +198,10 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut } int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length) -{ + const uint8_t *const data, const uint32_t data_length) { S1AP_S1AP_PDU_t pdu; int ret; - DevAssert(data != NULL); - memset(&pdu, 0, sizeof(pdu)); if (s1ap_eNB_decode_pdu(&pdu, data, data_length) < 0) { @@ -246,14 +240,11 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, static int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { S1AP_S1SetupFailure_t *container; S1AP_S1SetupFailureIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; - DevAssert(pdu != NULL); - container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; /* S1 Setup Failure == Non UE-related procedure -> stream 0 */ @@ -280,22 +271,18 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, mme_desc_p->state = S1AP_ENB_STATE_WAITING; s1ap_handle_s1_setup_message(mme_desc_p, 0); - return 0; } static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { S1AP_S1SetupResponse_t *container; S1AP_S1SetupResponseIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; int i; - DevAssert(pdu != NULL); - container = &pdu->choice.successfulOutcome.value.choice.S1SetupResponse; /* S1 Setup Response == Non UE-related procedure -> stream 0 */ @@ -324,20 +311,16 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, S1AP_ServedGUMMEIsItem_t *gummei_item_p; struct served_gummei_s *new_gummei_p; int j; - gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); - STAILQ_INIT(&new_gummei_p->served_plmns); STAILQ_INIT(&new_gummei_p->served_group_ids); STAILQ_INIT(&new_gummei_p->mme_codes); - S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { S1AP_PLMNidentity_t *plmn_identity_p; struct plmn_identity_s *new_plmn_identity_p; - plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, @@ -349,7 +332,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { S1AP_MME_Group_ID_t *mme_group_id_p; struct served_group_id_s *new_group_id_p; - mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); @@ -360,10 +342,8 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { S1AP_MME_Code_t *mme_code_p; struct mme_code_s *new_mme_code_p; - mme_code_p = gummei_item_p->servedMMECs.list.array[j]; new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); - OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); new_gummei_p->nb_mme_code++; @@ -376,10 +356,10 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true); mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; - /* Optionaly set the mme name */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MMEname, false); + if (ie) { mme_desc_p->mme_name = calloc(ie->value.choice.MMEname.size + 1, sizeof(char)); memcpy(mme_desc_p->mme_name, ie->value.choice.MMEname.buf, @@ -394,7 +374,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, mme_desc_p->state = S1AP_ENB_STATE_CONNECTED; mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb ++; s1ap_handle_s1_setup_message(mme_desc_p, 0); - return 0; } @@ -402,14 +381,11 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, static int s1ap_eNB_handle_error_indication(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { S1AP_ErrorIndication_t *container; S1AP_ErrorIndicationIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication; /* S1 Setup Failure == Non UE-related procedure -> stream 0 */ @@ -455,118 +431,156 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, case S1AP_CauseRadioNetwork_unspecified: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unspecified\n"); break; + case S1AP_CauseRadioNetwork_tx2relocoverall_expiry: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tx2relocoverall_expiry\n"); break; + case S1AP_CauseRadioNetwork_successful_handover: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_successful_handover\n"); break; + case S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason\n"); break; + case S1AP_CauseRadioNetwork_handover_cancelled: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_cancelled\n"); break; + case S1AP_CauseRadioNetwork_partial_handover: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_partial_handover\n"); break; + case S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n"); break; + case S1AP_CauseRadioNetwork_ho_target_not_allowed: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_target_not_allowed\n"); break; + case S1AP_CauseRadioNetwork_tS1relocoverall_expiry: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocoverall_expiry\n"); break; + case S1AP_CauseRadioNetwork_tS1relocprep_expiry: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocprep_expiry\n"); break; + case S1AP_CauseRadioNetwork_cell_not_available: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cell_not_available\n"); break; + case S1AP_CauseRadioNetwork_unknown_targetID: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_targetID\n"); break; + case S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); break; + case S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n"); break; + case S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n"); break; + case S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n"); break; + case S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason\n"); break; + case S1AP_CauseRadioNetwork_time_critical_handover: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_time_critical_handover\n"); break; + case S1AP_CauseRadioNetwork_resource_optimisation_handover: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_resource_optimisation_handover\n"); break; + case S1AP_CauseRadioNetwork_reduce_load_in_serving_cell: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_reduce_load_in_serving_cell\n"); break; + case S1AP_CauseRadioNetwork_user_inactivity: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_user_inactivity\n"); break; + case S1AP_CauseRadioNetwork_radio_connection_with_ue_lost: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_connection_with_ue_lost\n"); break; + case S1AP_CauseRadioNetwork_load_balancing_tau_required: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_load_balancing_tau_required\n"); break; + case S1AP_CauseRadioNetwork_cs_fallback_triggered: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cs_fallback_triggered\n"); break; + case S1AP_CauseRadioNetwork_ue_not_available_for_ps_service: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ue_not_available_for_ps_service\n"); break; + case S1AP_CauseRadioNetwork_radio_resources_not_available: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_resources_not_available\n"); break; + case S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure\n"); break; + case S1AP_CauseRadioNetwork_invalid_qos_combination: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_qos_combination\n"); break; + case S1AP_CauseRadioNetwork_interrat_redirection: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interrat_redirection\n"); break; + case S1AP_CauseRadioNetwork_interaction_with_other_procedure: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interaction_with_other_procedure\n"); break; + case S1AP_CauseRadioNetwork_unknown_E_RAB_ID: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_E_RAB_ID\n"); break; + case S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); break; + case S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); break; + case S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered\n"); break; + case S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered\n"); break; + case S1AP_CauseRadioNetwork_x2_handover_triggered: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_x2_handover_triggered\n"); break; + case S1AP_CauseRadioNetwork_redirection_towards_1xRTT: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_redirection_towards_1xRTT\n"); break; + case S1AP_CauseRadioNetwork_not_supported_QCI_value: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_not_supported_QCI_value\n"); break; #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) + case S1AP_CauseRadioNetwork_invalid_CSG_Id: S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_CSG_Id\n"); break; @@ -575,6 +589,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, default: S1AP_WARN("Received S1 Error indication cause radio network case not handled\n"); } + break; case S1AP_Cause_PR_transport: @@ -582,12 +597,15 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, case S1AP_CauseTransport_transport_resource_unavailable: S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_transport_resource_unavailable\n"); break; + case S1AP_CauseTransport_unspecified: S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_unspecified\n"); break; + default: S1AP_WARN("Received S1 Error indication cause transport case not handled\n"); } + break; case S1AP_Cause_PR_nas: @@ -595,20 +613,25 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, case S1AP_CauseNas_normal_release: S1AP_WARN("Received S1 Error indication S1AP_CauseNas_normal_release\n"); break; + case S1AP_CauseNas_authentication_failure: S1AP_WARN("Received S1 Error indication S1AP_CauseNas_authentication_failure\n"); break; + case S1AP_CauseNas_detach: S1AP_WARN("Received S1 Error indication S1AP_CauseNas_detach\n"); break; + case S1AP_CauseNas_unspecified: S1AP_WARN("Received S1 Error indication S1AP_CauseNas_unspecified\n"); break; #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) + case S1AP_CauseNas_csg_subscription_expiry: S1AP_WARN("Received S1 Error indication S1AP_CauseNas_csg_subscription_expiry\n"); break; #endif /* #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) */ + default: S1AP_WARN("Received S1 Error indication cause nas case not handled\n"); } @@ -620,27 +643,35 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, case S1AP_CauseProtocol_transfer_syntax_error: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_transfer_syntax_error\n"); break; + case S1AP_CauseProtocol_abstract_syntax_error_reject: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_reject\n"); break; + case S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify\n"); break; + case S1AP_CauseProtocol_message_not_compatible_with_receiver_state: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_message_not_compatible_with_receiver_state\n"); break; + case S1AP_CauseProtocol_semantic_error: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_semantic_error\n"); break; + case S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n"); break; + case S1AP_CauseProtocol_unspecified: S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_unspecified\n"); break; + default: S1AP_WARN("Received S1 Error indication cause protocol case not handled\n"); } + break; case S1AP_Cause_PR_misc: @@ -648,24 +679,31 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, case S1AP_CauseMisc_control_processing_overload: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_control_processing_overload\n"); break; + case S1AP_CauseMisc_not_enough_user_plane_processing_resources: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_not_enough_user_plane_processing_resources\n"); break; + case S1AP_CauseMisc_hardware_failure: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_hardware_failure\n"); break; + case S1AP_CauseMisc_om_intervention: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_om_intervention\n"); break; + case S1AP_CauseMisc_unspecified: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unspecified\n"); break; + case S1AP_CauseMisc_unknown_PLMN: S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unknown_PLMN\n"); break; + default: S1AP_WARN("Received S1 Error indication cause misc case not handled\n"); } + break; } } @@ -676,8 +714,8 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, if (ie) { // TODO continue } - // TODO continue + // TODO continue return 0; } @@ -685,8 +723,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, static int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -695,9 +732,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, S1AP_InitialContextSetupRequestIEs_t *ie; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -710,14 +745,13 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - /* id-eNB-UE-S1AP-ID */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, enb_ue_s1ap_id); @@ -732,16 +766,11 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; - ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ); - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id; - /* id-uEaggregateMaximumBitrate */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, true); @@ -749,11 +778,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul)); asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL), &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); - /* id-E-RABToBeSetupListCtxtSUReq */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true); - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; @@ -765,10 +792,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, if (item_p->nAS_PDU != NULL) { /* Only copy NAS pdu if present */ S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); - memcpy(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, item_p->nAS_PDU->buf, item_p->nAS_PDU->size); S1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); @@ -782,13 +807,10 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length = item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - /* GTP tunnel endpoint ID */ OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid); - /* Set the QOS informations */ S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = @@ -804,15 +826,12 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); - /* id-SecurityKey : Copy the security key */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_SecurityKey, true); memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size); - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } @@ -820,8 +839,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, static int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -829,9 +847,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; S1AP_UEContextReleaseCommand_t *container; S1AP_UEContextReleaseCommand_IEs_t *ie; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -847,7 +863,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, case S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: enb_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - MSC_LOG_RX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -858,16 +873,11 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, mme_ue_s1ap_id); if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received UE context release command for non " "existing UE context 0x%06lx\n", assoc_id, enb_ue_s1ap_id); - /*MessageDef *msg_complete_p; - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ue_desc_p->eNB_instance->instance <=> 0, msg_complete_p); - */ return -1; } else { MSC_LOG_TX_MESSAGE( @@ -877,6 +887,11 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, "0 S1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_s1ap_id "S1AP_UE_ID_FMT" ", enb_ue_s1ap_id); message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + + if (ue_desc_p->mme_ue_s1ap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode + ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id; + } + S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); return 0; @@ -905,8 +920,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, static int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { int i; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; @@ -915,9 +929,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, MessageDef *message_p = NULL; S1AP_E_RABSetupRequest_t *container; S1AP_E_RABSetupRequestIEs_t *ie; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -930,14 +942,13 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - /* id-eNB-UE-S1AP-ID */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, enb_ue_s1ap_id); @@ -959,11 +970,9 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, } message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ); - S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq, true); S1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = @@ -971,24 +980,19 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, for (i = 0; i < ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; i++) { S1AP_E_RABToBeSetupItemBearerSUReq_t *item_p; - item_p = &(((S1AP_E_RABToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListBearerSUReq.list.array[i])->value.choice.E_RABToBeSetupItemBearerSUReq); - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, item_p->nAS_PDU.buf, item_p->nAS_PDU.size); // S1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); } else { S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; - S1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); // return -1; } @@ -998,7 +1002,6 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - /* S1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n", S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, @@ -1006,10 +1009,8 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, */ /* GTP tunnel endpoint ID */ OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); - /* Set the QOS informations */ S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = @@ -1019,32 +1020,27 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } static int s1ap_eNB_handle_paging(uint32_t assoc_id, uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + S1AP_S1AP_PDU_t *pdu) { s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; MessageDef *message_p = NULL; S1AP_Paging_t *container; S1AP_PagingIEs_t *ie; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.Paging; - // received Paging Message from MME S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); /* Paging procedure -> stream != 0 */ if (stream == 0) { LOG_W(S1AP,"[SCTP %d] Received Paging procedure on stream (%d)\n", - assoc_id, stream); + assoc_id, stream); return -1; } @@ -1055,6 +1051,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, } s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance; + if (s1ap_eNB_instance == NULL) { S1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : s1ap_eNB_instance is NULL\n", assoc_id); @@ -1062,7 +1059,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, } message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PAGING_IND); - /* convert S1AP_PagingIEs_t to s1ap_paging_ind_t */ /* id-UEIdentityIndexValue : convert UE Identity Index value */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, @@ -1070,13 +1066,12 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, S1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue); S1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", assoc_id,(uint32_t)S1AP_PAGING_IND(message_p).ue_index_value); - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; - /* id-UEPagingID */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, S1AP_ProtocolIE_ID_id_UEPagingID, true); + /* convert UE Paging Identity */ if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_s_TMSI) { S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; @@ -1115,7 +1110,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, } S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; - /* id-pagingDRX */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, S1AP_ProtocolIE_ID_id_pagingDRX, false); @@ -1145,7 +1139,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, memset (&S1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256); memset (&S1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256); S1AP_PAGING_IND(message_p).tai_size = 0; - /* id-TAIList */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, S1AP_ProtocolIE_ID_id_TAIList, true); @@ -1165,7 +1158,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, S1AP_PAGING_IND(message_p).tac[i]); } - //paging parameter values S1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, S1AP_PAGING_IND(message_p).ue_index_value, S1AP_PAGING_IND(message_p).cn_domain, @@ -1176,18 +1168,15 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); - /* send message to RRC */ itti_send_msg_to_task(TASK_RRC_ENB, s1ap_eNB_instance->instance, message_p); - return 0; } static int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { int i, nb_of_e_rabs_failed; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1196,9 +1185,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, S1AP_E_RABModifyRequestIEs_t *ie; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABModifyRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -1211,14 +1198,13 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - /* id-eNB-UE-S1AP-ID */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " "existing UE context 0x%06lx\n", assoc_id, enb_ue_s1ap_id); @@ -1238,9 +1224,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", ue_desc_p->mme_ue_s1ap_id, mme_ue_s1ap_id); message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); - S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); @@ -1252,22 +1236,18 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_Cause_PR_radioNetwork; S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id; } - S1AP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; + S1AP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; s1ap_eNB_e_rab_modify_resp(mme_desc_p->s1ap_eNB_instance->instance, &S1AP_E_RAB_MODIFY_RESP(message_p)); - message_p = NULL; return -1; } message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_MODIFY_REQ); - S1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - /* id-E-RABToBeModifiedListBearerModReq */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); @@ -1282,9 +1262,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; - S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, item_p->nAS_PDU.buf, item_p->nAS_PDU.size); } else { @@ -1295,26 +1273,22 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, /* Set the QOS informations */ S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; - S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; - } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } // handle e-rab release command and send it to rrc_end static int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) -{ + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1323,9 +1297,7 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, S1AP_E_RABReleaseCommandIEs_t *ie; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABReleaseCommand; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { @@ -1337,14 +1309,13 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - /* id-eNB-UE-S1AP-ID */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, ie->value.choice.ENB_UE_S1AP_ID); return -1; @@ -1366,14 +1337,13 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, S1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_S1AP_ID %ld mme_ue_s1ap_id %ld\n", assoc_id, enb_ue_s1ap_id, mme_ue_s1ap_id); - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND); S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; - /* id-NAS-PDU */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, false); + if(ie && ie->value.choice.NAS_PDU.size > 0) { S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size; S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = @@ -1399,6 +1369,5 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index 80266a4d9c..2189140dad 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -61,13 +61,10 @@ int s1ap_eNB_handle_nas_first_req( S1AP_InitialUEMessage_IEs_t *ie; uint8_t *buffer = NULL; uint32_t length = 0; - DevAssert(s1ap_nas_first_req_p != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - memset(&pdu, 0, sizeof(pdu)); pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_initialUEMessage; @@ -81,6 +78,7 @@ int s1ap_eNB_handle_nas_first_req( instance_p, s1ap_nas_first_req_p->establishment_cause, s1ap_nas_first_req_p->ue_identity.gummei); + if (mme_desc_p) { S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through GUMMEI MCC %d MNC %d MMEGI %d MMEC %d\n", instance, @@ -101,6 +99,7 @@ int s1ap_eNB_handle_nas_first_req( s1ap_nas_first_req_p->establishment_cause, s1ap_nas_first_req_p->selected_plmn_identity, s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code); + if (mme_desc_p) { S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through S-TMSI MMEC %d and selected PLMN Identity index %d MCC %d MNC %d\n", instance, @@ -121,6 +120,7 @@ int s1ap_eNB_handle_nas_first_req( instance_p, s1ap_nas_first_req_p->establishment_cause, s1ap_nas_first_req_p->selected_plmn_identity); + if (mme_desc_p) { S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", instance, @@ -140,6 +140,7 @@ int s1ap_eNB_handle_nas_first_req( mme_desc_p = s1ap_eNB_nnsf_select_mme( instance_p, s1ap_nas_first_req_p->establishment_cause); + if (mme_desc_p) { S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", instance, @@ -153,7 +154,6 @@ int s1ap_eNB_handle_nas_first_req( * In case eNB has no MME associated, the eNB should inform RRC and discard * this request. */ - S1AP_WARN("No MME is associated to the eNB\n"); // TODO: Inform RRC return -1; @@ -164,7 +164,6 @@ int s1ap_eNB_handle_nas_first_req( */ ue_desc_p = s1ap_eNB_allocate_new_UE_context(); DevAssert(ue_desc_p != NULL); - /* Keep a reference to the selected MME */ ue_desc_p->mme_ref = mme_desc_p; ue_desc_p->ue_initial_id = s1ap_nas_first_req_p->ue_initial_id; @@ -173,7 +172,6 @@ int s1ap_eNB_handle_nas_first_req( do { struct s1ap_eNB_ue_context_s *collision_p; - /* Peek a random value for the eNB_ue_s1ap_id */ ue_desc_p->eNB_ue_s1ap_id = (random() + random()) & 0x00ffffff; @@ -194,7 +192,6 @@ int s1ap_eNB_handle_nas_first_req( ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_ENB_UE_S1AP_ID; ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; @@ -210,7 +207,6 @@ int s1ap_eNB_handle_nas_first_req( #endif ie->value.choice.NAS_PDU.size = s1ap_nas_first_req_p->nas_pdu.length; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_TAI; @@ -223,7 +219,6 @@ int s1ap_eNB_handle_nas_first_req( instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity], &ie->value.choice.TAI.pLMNidentity); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; @@ -242,11 +237,9 @@ int s1ap_eNB_handle_nas_first_req( instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity], &ie->value.choice.EUTRAN_CGI.pLMNidentity); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* Set the establishment cause according to those provided by RRC */ DevCheck(s1ap_nas_first_req_p->establishment_cause < RRC_CAUSE_LAST, s1ap_nas_first_req_p->establishment_cause, RRC_CAUSE_LAST, 0); - /* mandatory */ ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_RRC_Establishment_Cause; @@ -300,6 +293,7 @@ int s1ap_eNB_handle_nas_first_req( /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) + if (0) { ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_CellAccessMode; @@ -311,6 +305,7 @@ int s1ap_eNB_handle_nas_first_req( /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0)) + if (0) { ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress; @@ -331,6 +326,7 @@ int s1ap_eNB_handle_nas_first_req( } #if (S1AP_VERSION >= MAKE_VERSION(11, 0, 0)) + /* optional */ if (0) { ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); @@ -372,6 +368,7 @@ int s1ap_eNB_handle_nas_first_req( } #if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0)) + /* optional */ if (0) { ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); @@ -403,6 +400,7 @@ int s1ap_eNB_handle_nas_first_req( } #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) + /* optional */ if (0) { ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); @@ -422,6 +420,7 @@ int s1ap_eNB_handle_nas_first_req( // ie->value.choice.Coverage_Level = ue_release_req_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + #endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ #endif /* #if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0)) */ #endif /* #if (S1AP_VERSION >= MAKE_VERSION(11, 0, 0)) */ @@ -435,7 +434,6 @@ int s1ap_eNB_handle_nas_first_req( /* Update the current S1AP UE state */ ue_desc_p->ue_state = S1AP_UE_WAITING_CSR; - /* Assign a stream for this UE : * From 3GPP 36.412 7)Transport layers: * Within the SCTP association established between one MME and eNB pair: @@ -455,7 +453,6 @@ int s1ap_eNB_handle_nas_first_req( } ue_desc_p->tx_stream = mme_desc_p->nextstream; - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -464,11 +461,9 @@ int s1ap_eNB_handle_nas_first_req( MSC_AS_TIME_FMT" initialUEMessage initiatingMessage eNB_ue_s1ap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_desc_p->eNB_ue_s1ap_id); - /* Send encoded message over sctp */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); - return 0; } @@ -502,20 +497,17 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, } s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance; - /* Prepare the S1AP message to encode */ container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport; - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true); mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { + enb_ue_s1ap_id)) == NULL) { MSC_LOG_RX_DISCARDED_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -563,7 +555,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", assoc_id, mme_ue_s1ap_id); - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, true); /* Forward the NAS PDU to RRC */ @@ -572,10 +563,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, ue_desc_p->eNB_ue_s1ap_id, ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size); - - // LG: Why set to 0 ?? - //ue_desc_p->ue_initial_id = 0; - return 0; } @@ -590,9 +577,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ S1AP_UplinkNASTransport_IEs_t *ie; uint8_t *buffer; uint32_t length; - DevAssert(s1ap_uplink_nas_p != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(s1ap_eNB_instance_p != NULL); @@ -622,7 +607,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UplinkNASTransport; out = &pdu.choice.initiatingMessage.value.choice.UplinkNASTransport; - /* mandatory */ ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -630,7 +614,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -638,7 +621,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID; ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; @@ -647,7 +629,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ ie->value.choice.NAS_PDU.buf = s1ap_uplink_nas_p->nas_pdu.buffer; ie->value.choice.NAS_PDU.size = s1ap_uplink_nas_p->nas_pdu.length; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; @@ -663,7 +644,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ 0, &ie->value.choice.EUTRAN_CGI.cell_ID); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_TAI; @@ -676,9 +656,9 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ &ie->value.choice.TAI.pLMNidentity); TAC_TO_ASN1(s1ap_eNB_instance_p->tac, &ie->value.choice.TAI.tAC); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0)) + if (0) { ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress; @@ -690,6 +670,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) + if (0) { ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_SIPTO_L_GW_TransportLayerAddress; @@ -708,6 +689,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ // ie->value.choice.LHN_ID =; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + #endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ #endif /* #if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0)) */ @@ -726,12 +708,10 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } @@ -748,9 +728,7 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, S1AP_NASNonDeliveryIndication_IEs_t *ie; uint8_t *buffer; uint32_t length; - DevAssert(s1ap_nas_non_delivery_ind != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(s1ap_eNB_instance_p != NULL); @@ -773,7 +751,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_NASNonDeliveryIndication; out = &pdu.choice.initiatingMessage.value.choice.NASNonDeliveryIndication; - /* mandatory */ ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -781,7 +758,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -789,7 +765,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_ENB_UE_S1AP_ID; ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; @@ -797,9 +772,7 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_NAS_PDU; ie->value.choice.NAS_PDU.buf = s1ap_nas_non_delivery_ind->nas_pdu.buffer; ie->value.choice.NAS_PDU.size = s1ap_nas_non_delivery_ind->nas_pdu.length; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); ie->id = S1AP_ProtocolIE_ID_id_Cause; @@ -828,7 +801,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -849,10 +821,8 @@ int s1ap_eNB_initial_ctxt_resp( uint8_t *buffer = NULL; uint32_t length; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(initial_ctxt_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); @@ -882,7 +852,6 @@ int s1ap_eNB_initial_ctxt_resp( pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_InitialContextSetupResponse; out = &pdu.choice.successfulOutcome.value.choice.InitialContextSetupResponse; - /* mandatory */ ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -890,7 +859,6 @@ int s1ap_eNB_initial_ctxt_resp( ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -898,7 +866,6 @@ int s1ap_eNB_initial_ctxt_resp( ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_ENB_UE_S1AP_ID; ie->value.choice.ENB_UE_S1AP_ID = initial_ctxt_resp_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes; @@ -915,7 +882,7 @@ int s1ap_eNB_initial_ctxt_resp( item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID = initial_ctxt_resp_p->e_rabs[i].e_rab_id; GTP_TEID_TO_ASN1(initial_ctxt_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemCtxtSURes.gTP_TEID); item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf = malloc(initial_ctxt_resp_p->e_rabs[i].eNB_addr.length); - memcpy(item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf, + memcpy(item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf, initial_ctxt_resp_p->e_rabs[i].eNB_addr.buffer, initial_ctxt_resp_p->e_rabs[i].eNB_addr.length); item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].eNB_addr.length; @@ -949,23 +916,27 @@ int s1ap_eNB_initial_ctxt_resp( item->value.choice.E_RABItem.e_RAB_ID = initial_ctxt_resp_p->e_rabs_failed[i].e_rab_id; item->value.choice.E_RABItem.cause.present = initial_ctxt_resp_p->e_rabs_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) - { + switch(item->value.choice.E_RABItem.cause.present) { case S1AP_Cause_PR_radioNetwork: item->value.choice.E_RABItem.cause.choice.radioNetwork = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_transport: item->value.choice.E_RABItem.cause.choice.transport = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_nas: item->value.choice.E_RABItem.cause.choice.nas = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_protocol: item->value.choice.E_RABItem.cause.choice.protocol = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_misc: item->value.choice.E_RABItem.cause.choice.misc = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_NOTHING: default: break; @@ -1003,12 +974,10 @@ int s1ap_eNB_initial_ctxt_resp( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ctxt_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } @@ -1024,10 +993,8 @@ int s1ap_eNB_ue_capabilities(instance_t instance, S1AP_UECapabilityInfoIndicationIEs_t *ie; uint8_t *buffer; uint32_t length; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(ue_cap_info_ind_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); @@ -1057,7 +1024,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance, pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UECapabilityInfoIndication; out = &pdu.choice.initiatingMessage.value.choice.UECapabilityInfoIndication; - /* mandatory */ ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1065,7 +1031,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance, ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1073,7 +1038,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance, ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_ENB_UE_S1AP_ID; ie->value.choice.ENB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_UERadioCapability; @@ -1082,9 +1046,9 @@ int s1ap_eNB_ue_capabilities(instance_t instance, ie->value.choice.UERadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer; ie->value.choice.UERadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(12, 0, 0)) + if (0) { ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_UERadioCapabilityForPaging; @@ -1093,6 +1057,7 @@ int s1ap_eNB_ue_capabilities(instance_t instance, // ie->value.choice.UERadioCapabilityForPaging = ; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + #endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { @@ -1110,12 +1075,10 @@ int s1ap_eNB_ue_capabilities(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_cap_info_ind_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } @@ -1132,15 +1095,13 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, uint8_t *buffer = NULL; uint32_t length; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(e_rab_setup_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n", e_rab_setup_resp_p->eNB_ue_s1ap_id); @@ -1165,7 +1126,6 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABSetupResponse; out = &pdu.choice.successfulOutcome.value.choice.E_RABSetupResponse; - /* mandatory */ ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1173,7 +1133,6 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1234,23 +1193,27 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, item->value.choice.E_RABItem.e_RAB_ID = e_rab_setup_resp_p->e_rabs_failed[i].e_rab_id; item->value.choice.E_RABItem.cause.present = e_rab_setup_resp_p->e_rabs_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) - { + switch(item->value.choice.E_RABItem.cause.present) { case S1AP_Cause_PR_radioNetwork: item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_transport: item->value.choice.E_RABItem.cause.choice.transport = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_nas: item->value.choice.E_RABItem.cause.choice.nas = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_protocol: item->value.choice.E_RABItem.cause.choice.protocol = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_misc: item->value.choice.E_RABItem.cause.choice.misc = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_NOTHING: default: break; @@ -1280,6 +1243,7 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes); */ fprintf(stderr, "start encode\n"); + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink transport\n"); /* Encode procedure has failed... */ @@ -1295,12 +1259,10 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), e_rab_setup_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } @@ -1314,19 +1276,16 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, S1AP_S1AP_PDU_t pdu; S1AP_E_RABModifyResponse_t *out; S1AP_E_RABModifyResponseIEs_t *ie; - uint8_t *buffer = NULL; uint32_t length; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(e_rab_modify_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n", e_rab_modify_resp_p->eNB_ue_s1ap_id); @@ -1351,7 +1310,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABModifyResponse; out = &pdu.choice.successfulOutcome.value.choice.E_RABModifyResponse; - /* mandatory */ ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1359,7 +1317,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1405,23 +1362,27 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, item->value.choice.E_RABItem.e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id; item->value.choice.E_RABItem.cause.present = e_rab_modify_resp_p->e_rabs_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) - { + switch(item->value.choice.E_RABItem.cause.present) { case S1AP_Cause_PR_radioNetwork: item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_transport: item->value.choice.E_RABItem.cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_nas: item->value.choice.E_RABItem.cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_protocol: item->value.choice.E_RABItem.cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_misc: item->value.choice.E_RABItem.cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_NOTHING: default: break; @@ -1445,6 +1406,7 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, } fprintf(stderr, "start encode\n"); + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink transport\n"); /* Encode procedure has failed... */ @@ -1460,7 +1422,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), e_rab_modify_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -1480,14 +1441,13 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, uint8_t *buffer = NULL; uint32_t length; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(e_rab_release_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %u\n", e_rab_release_resp_p->eNB_ue_s1ap_id); @@ -1501,7 +1461,6 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABReleaseResponse; out = &pdu.choice.successfulOutcome.value.choice.E_RABReleaseResponse; - /* mandatory */ ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; @@ -1509,7 +1468,6 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_MME_UE_S1AP_ID; ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; @@ -1555,23 +1513,27 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, item->value.choice.E_RABItem.e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id; item->value.choice.E_RABItem.cause.present = e_rab_release_resp_p->e_rabs_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) - { + switch(item->value.choice.E_RABItem.cause.present) { case S1AP_Cause_PR_radioNetwork: item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_transport: item->value.choice.E_RABItem.cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_nas: item->value.choice.E_RABItem.cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_protocol: item->value.choice.E_RABItem.cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_misc: item->value.choice.E_RABItem.cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value; break; + case S1AP_Cause_PR_NOTHING: default: break; @@ -1595,6 +1557,7 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, /* optional */ #if (S1AP_VERSION >= MAKE_VERSION(12, 0, 0)) + if(0) { ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation; @@ -1603,9 +1566,10 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, // ie->value.choice.UserLocationInformation = ; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } -#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ +#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */ fprintf(stderr, "start encode\n"); + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode release response\n"); /* Encode procedure has failed... */ @@ -1621,14 +1585,11 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - S1AP_INFO("e_rab_release_response sended eNB_UE_S1AP_ID %d mme_ue_s1ap_id %d nb_of_e_rabs_released %d nb_of_e_rabs_failed %d\n", e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed); - return 0; } diff --git a/openair3/SECU/key_nas_encryption.c b/openair3/SECU/key_nas_encryption.c deleted file mode 100644 index aa641137ef..0000000000 --- a/openair3/SECU/key_nas_encryption.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include -#include "secu_defs.h" - -/*! - * Derive the kNASenc from kasme and perform truncate on the generated key to - * reduce his size to 128 bits. Definition of the derivation function can - * be found in 3GPP TS.33401 #A.7 - * @param[in] nas_alg_type NAS algorithm distinguisher - * @param[in] nas_enc_alg_id NAS encryption/integrity algorithm identifier. - * Possible values are: - * - 0 for EIA0 algorithm (Null Integrity Protection algorithm) - * - 1 for 128-EIA1 SNOW 3G - * - 2 for 128-EIA2 AES - * @param[in] kasme Key for MME as provided by AUC - * @param[out] knas Truncated ouput key as derived by KDF - */ - -/*int derive_key_nas(algorithm_type_dist_t nas_alg_type, uint8_t nas_enc_alg_id, - const uint8_t kasme[32], uint8_t** knas) -{ - uint8_t s[7]; - uint8_t knas_temp[32]; - - // FC - s[0] = 0x15; - - // P0 = algorithm type distinguisher - s[1] = nas_alg_type & 0xFF; - - // L0 = length(P0) = 1 - s[2] = 0x00; - s[3] = 0x01; - - // P1 - s[4] = nas_enc_alg_id; - - // L1 = length(P1) = 1 - s[5] = 0x00; - s[6] = 0x01; - - kdf((uint8_t*)kasme, 32, s, 7, (uint8_t**)&knas_temp, 32); - - // Truncate the generate key to 128 bits - memcpy(knas, knas_temp, 16); - - return 0; -} -*/ diff --git a/openair3/TEST/EPC_TEST/generate_scenario.h b/openair3/TEST/EPC_TEST/generate_scenario.h index 0f240f483d..b2042a894c 100644 --- a/openair3/TEST/EPC_TEST/generate_scenario.h +++ b/openair3/TEST/EPC_TEST/generate_scenario.h @@ -38,11 +38,7 @@ #include "platform_constants.h" #include "PHY/impl_defs_lte.h" #include "s1ap_messages_types.h" -#ifdef CMAKER #include "SystemInformationBlockType2.h" -#else -#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h" -#endif #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ struct in_addr inp;\ diff --git a/openair3/UTILS/mme_config.c b/openair3/UTILS/mme_config.c deleted file mode 100644 index d2c25af10a..0000000000 --- a/openair3/UTILS/mme_config.c +++ /dev/null @@ -1,716 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include /* To provide inet_addr */ - -#include "intertask_interface.h" -#include "assertions.h" -#include "msc.h" -#include "mme_config.h" -#include "spgw_config.h" -#include "intertask_interface_conf.h" - -mme_config_t mme_config; - -int mme_config_find_mnc_length(const char mcc_digit1P, - const char mcc_digit2P, - const char mcc_digit3P, - const char mnc_digit1P, - const char mnc_digit2P, - const char mnc_digit3P) -{ - - uint16_t mcc = 100*mcc_digit1P + 10*mcc_digit2P + mcc_digit3P; - uint16_t mnc3= 100*mnc_digit1P + 10*mnc_digit2P + mnc_digit3P; - uint16_t mnc2= 10*mnc_digit1P + mnc_digit2P; - int plmn_index = 0; - - AssertFatal((mcc_digit1P >= 0) && (mcc_digit1P <= 9) - && (mcc_digit2P >= 0) && (mcc_digit2P <= 9) - && (mcc_digit3P >= 0) && (mcc_digit3P <= 9) , - "BAD MCC PARAMETER (%d%d%d)!\n", - mcc_digit1P, mcc_digit2P, mcc_digit3P); - - AssertFatal((mnc_digit2P >= 0) && (mnc_digit2P <= 9) - && (mnc_digit1P >= 0) && (mnc_digit1P <= 9) , - "BAD MNC PARAMETER (%d.%d.%d)!\n", - mnc_digit1P, mnc_digit2P, mnc_digit3P); - - - while (plmn_index < mme_config.gummei.nb_plmns) { - if (mme_config.gummei.plmn_mcc[plmn_index] == mcc) { - if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc2) && - (mme_config.gummei.plmn_mnc_len[plmn_index] == 2)) { - return 2; - } else if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc3) && - (mme_config.gummei.plmn_mnc_len[plmn_index] == 3)) { - return 3; - } - } - - plmn_index += 1; - } - - return 0; -} - - -static -void mme_config_init(mme_config_t *mme_config_p) -{ - memset(mme_config_p, 0, sizeof(mme_config_t)); - - pthread_rwlock_init(&mme_config_p->rw_lock, NULL); - - mme_config_p->verbosity_level = 0; - mme_config_p->config_file = NULL; - mme_config_p->max_eNBs = MAX_NUMBER_OF_ENB; - mme_config_p->max_ues = MAX_NUMBER_OF_UE; - - mme_config_p->emergency_attach_supported = 0; - mme_config_p->unauthenticated_imsi_supported = 0; - - /* Timer configuration */ - mme_config_p->gtpv1u_config.port_number = GTPV1_U_PORT_NUMBER; - mme_config_p->s1ap_config.port_number = S1AP_PORT_NUMBER; - /* IP configuration */ - mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP); - - mme_config_p->ipv4.mme_interface_name_for_S1_MME = DEFAULT_MME_INTERFACE_NAME_FOR_S1_MME; - mme_config_p->ipv4.mme_ip_address_for_S1_MME = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S1_MME); - - mme_config_p->ipv4.mme_interface_name_for_S11 = DEFAULT_MME_INTERFACE_NAME_FOR_S11; - mme_config_p->ipv4.mme_ip_address_for_S11 = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S11); - - mme_config_p->ipv4.sgw_ip_address_for_S11 = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S11); - - mme_config_p->s6a_config.conf_file = S6A_CONF_FILE; - - mme_config_p->itti_config.queue_size = ITTI_QUEUE_MAX_ELEMENTS; - mme_config_p->itti_config.log_file = NULL; - - mme_config_p->sctp_config.in_streams = SCTP_IN_STREAMS; - mme_config_p->sctp_config.out_streams = SCTP_OUT_STREAMS; - - mme_config_p->relative_capacity = RELATIVE_CAPACITY; - - mme_config_p->mme_statistic_timer = MME_STATISTIC_TIMER_S; - - mme_config_p->gummei.nb_mme_gid = 1; - mme_config_p->gummei.mme_gid = calloc(1, sizeof(*mme_config_p->gummei.mme_gid)); - mme_config_p->gummei.mme_gid[0] = MMEGID; - mme_config_p->gummei.nb_mmec = 1; - mme_config_p->gummei.mmec = calloc(1, sizeof(*mme_config_p->gummei.mmec)); - mme_config_p->gummei.mmec[0] = MMEC; - - /* Set the TAI */ - mme_config_p->gummei.nb_plmns = 1; - mme_config_p->gummei.plmn_mcc = calloc(1, sizeof(*mme_config_p->gummei.plmn_mcc)); - mme_config_p->gummei.plmn_mnc = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc)); - mme_config_p->gummei.plmn_mnc_len = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc_len)); - mme_config_p->gummei.plmn_tac = calloc(1, sizeof(*mme_config_p->gummei.plmn_tac)); - - - mme_config_p->gummei.plmn_mcc[0] = PLMN_MCC; - mme_config_p->gummei.plmn_mnc[0] = PLMN_MNC; - mme_config_p->gummei.plmn_mnc_len[0] = PLMN_MNC_LEN; - mme_config_p->gummei.plmn_tac[0] = PLMN_TAC; - - mme_config_p->s1ap_config.outcome_drop_timer_sec = S1AP_OUTCOME_TIMER_DEFAULT; -} - -int mme_system(char *command_pP, int abort_on_errorP) -{ - int ret = -1; - - if (command_pP) { - fprintf(stdout, "system command: %s\n",command_pP); - ret = system(command_pP); - - if (ret < 0) { - fprintf(stderr, "ERROR in system command %s: %d\n", - command_pP,ret); - - if (abort_on_errorP) { - exit(-1); // may be not exit - } - } - } - - return ret; -} - - -static int config_parse_file(mme_config_t *mme_config_p) -{ - config_t cfg; - config_setting_t *setting_mme = NULL; - config_setting_t *setting = NULL; - config_setting_t *subsetting = NULL; - config_setting_t *sub2setting = NULL; - - long int alongint; - int i, num; - char *astring = NULL; - char *address = NULL; - char *cidr = NULL; - - const char* tac = NULL; - const char* mcc = NULL; - const char* mnc = NULL; - - char *sgw_ip_address_for_S1u_S12_S4_up = NULL; - char *mme_interface_name_for_S1_MME = NULL; - char *mme_ip_address_for_S1_MME = NULL; - char *mme_interface_name_for_S11 = NULL; - char *mme_ip_address_for_S11 = NULL; - char *sgw_ip_address_for_S11 = NULL; - char system_cmd[256]; - - config_init(&cfg); - - if(mme_config_p->config_file != NULL) { - /* Read the file. If there is an error, report it and exit. */ - if(! config_read_file(&cfg, mme_config_p->config_file)) { - fprintf(stdout, "ERROR: %s:%d - %s\n", mme_config_p->config_file, config_error_line(&cfg), config_error_text(&cfg)); - config_destroy(&cfg); - AssertFatal (1 == 0, "Failed to parse MME configuration file %s!\n", mme_config_p->config_file); - } - } else { - fprintf(stdout, "ERROR No MME configuration file provided!\n"); - config_destroy(&cfg); - AssertFatal (0, "No MME configuration file provided!\n"); - } - - setting_mme = config_lookup(&cfg, MME_CONFIG_STRING_MME_CONFIG); - - if(setting_mme != NULL) { - // GENERAL MME SETTINGS - if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_REALM, (const char **)&astring) )) { - mme_config_p->realm = strdup(astring); - mme_config_p->realm_length = strlen(mme_config_p->realm); - } - - if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXENB, &alongint) )) { - mme_config_p->max_eNBs = (uint32_t)alongint; - } - - if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXUE, &alongint) )) { - mme_config_p->max_ues = (uint32_t)alongint; - } - - if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_RELATIVE_CAPACITY, &alongint) )) { - mme_config_p->relative_capacity = (uint8_t)alongint; - } - - if( (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_STATISTIC_TIMER, &alongint) )) { - mme_config_p->mme_statistic_timer = (uint32_t)alongint; - } - - if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_EMERGENCY_ATTACH_SUPPORTED, (const char **)&astring) )) { - if (strcasecmp(astring , "yes") == 0) - mme_config_p->emergency_attach_supported = 1; - else - mme_config_p->emergency_attach_supported = 0; - } - - if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_UNAUTHENTICATED_IMSI_SUPPORTED, (const char **)&astring) )) { - if (strcasecmp(astring , "yes") == 0) - mme_config_p->unauthenticated_imsi_supported = 1; - else - mme_config_p->unauthenticated_imsi_supported = 0; - } - - if( (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) { - if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) - mme_config_p->verbosity_level = 0; - else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) - mme_config_p->verbosity_level = 2; - else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) - mme_config_p->verbosity_level = 1; - else - mme_config_p->verbosity_level = 0; - } - - // ITTI SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_INTERTASK_INTERFACE_CONFIG); - - if (setting != NULL) { - if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_INTERTASK_INTERFACE_QUEUE_SIZE, &alongint) )) { - mme_config_p->itti_config.queue_size = (uint32_t)alongint; - } - } - - // S6A SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S6A_CONFIG); - - if (setting != NULL) { - if( (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_CONF_FILE_PATH, (const char **)&astring) )) { - if (astring != NULL) - mme_config_p->s6a_config.conf_file = strdup(astring); - } - - if( (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_HSS_HOSTNAME, (const char **)&astring) )) { - if (astring != NULL) - mme_config_p->s6a_config.hss_host_name = strdup(astring); - else - AssertFatal (1 == 0, - "You have to provide a valid HSS hostname %s=...\n", - MME_CONFIG_STRING_S6A_HSS_HOSTNAME); - } - } - - // SCTP SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_SCTP_CONFIG); - - if (setting != NULL) { - if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_INSTREAMS, &alongint) )) { - mme_config_p->sctp_config.in_streams = (uint16_t)alongint; - } - - if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_OUTSTREAMS, &alongint) )) { - mme_config_p->sctp_config.out_streams = (uint16_t)alongint; - } - } - - // S1AP SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S1AP_CONFIG); - - if (setting != NULL) { - if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_OUTCOME_TIMER, &alongint) )) { - mme_config_p->s1ap_config.outcome_drop_timer_sec = (uint8_t)alongint; - } - - if( (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_PORT, &alongint) )) { - mme_config_p->s1ap_config.port_number = (uint16_t)alongint; - } - } - - // GUMMEI SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_GUMMEI_CONFIG); - - if (setting != NULL) { - subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_CODE); - - if (subsetting != NULL) { - num = config_setting_length(subsetting); - - if (mme_config_p->gummei.nb_mmec != num) { - if (mme_config_p->gummei.mmec != NULL) { - free(mme_config_p->gummei.mmec); - } - - mme_config_p->gummei.mmec = calloc(num, sizeof(*mme_config_p->gummei.mmec)); - } - - mme_config_p->gummei.nb_mmec = num; - - for (i = 0; i < num; i++) { - mme_config_p->gummei.mmec[i] = config_setting_get_int_elem(subsetting, i); - } - } - - subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_GID); - - if (subsetting != NULL) { - num = config_setting_length(subsetting); - - if (mme_config_p->gummei.nb_mme_gid != num) { - if (mme_config_p->gummei.mme_gid != NULL) { - free(mme_config_p->gummei.mme_gid); - } - - mme_config_p->gummei.mme_gid = calloc(num, sizeof(*mme_config_p->gummei.mme_gid)); - } - - mme_config_p->gummei.nb_mme_gid = num; - - for (i = 0; i < num; i++) { - mme_config_p->gummei.mme_gid[i] = config_setting_get_int_elem(subsetting, i); - } - } - - subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_TAI_LIST); - - if (subsetting != NULL) { - num = config_setting_length(subsetting); - - if (mme_config_p->gummei.nb_plmns != num) { - if (mme_config_p->gummei.plmn_mcc != NULL) free(mme_config_p->gummei.plmn_mcc); - - if (mme_config_p->gummei.plmn_mnc != NULL) free(mme_config_p->gummei.plmn_mnc); - - if (mme_config_p->gummei.plmn_mnc_len != NULL) free(mme_config_p->gummei.plmn_mnc_len); - - if (mme_config_p->gummei.plmn_tac != NULL) free(mme_config_p->gummei.plmn_tac); - - mme_config_p->gummei.plmn_mcc = calloc(num, sizeof(*mme_config_p->gummei.plmn_mcc)); - mme_config_p->gummei.plmn_mnc = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc)); - mme_config_p->gummei.plmn_mnc_len = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc_len)); - mme_config_p->gummei.plmn_tac = calloc(num, sizeof(*mme_config_p->gummei.plmn_tac)); - } - - mme_config_p->gummei.nb_plmns = num; - - for (i = 0; i < num; i++) { - sub2setting = config_setting_get_elem(subsetting, i); - - if (sub2setting != NULL) { - if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MCC, &mcc) )) { - mme_config_p->gummei.plmn_mcc[i] = (uint16_t)atoi(mcc); - } - - if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MNC, &mnc) )) { - mme_config_p->gummei.plmn_mnc[i] = (uint16_t)atoi(mnc); - mme_config_p->gummei.plmn_mnc_len[i] = strlen(mnc); - AssertFatal((mme_config_p->gummei.plmn_mnc_len[i] == 2) || (mme_config_p->gummei.plmn_mnc_len[i] == 3), - "Bad MNC length %u, must be 2 or 3", mme_config_p->gummei.plmn_mnc_len[i]); - } - - if( (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_TAC, &tac) )) { - mme_config_p->gummei.plmn_tac[i] = (uint16_t)atoi(tac); - AssertFatal(mme_config_p->gummei.plmn_tac[i] != 0, - "TAC must not be 0"); - } - } - } - } - } - - // NETWORK INTERFACE SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); - - if(setting != NULL) { - if( ( - config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S1_MME, - (const char **)&mme_interface_name_for_S1_MME) - && config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S1_MME, - (const char **)&mme_ip_address_for_S1_MME) - && config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S11_MME, - (const char **)&mme_interface_name_for_S11) - && config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S11_MME, - (const char **)&mme_ip_address_for_S11) - ) - ) { - mme_config_p->ipv4.mme_interface_name_for_S1_MME = strdup(mme_interface_name_for_S1_MME); - cidr = strdup(mme_ip_address_for_S1_MME); - address = strtok(cidr, "/"); - IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR MME S1_MME !\n" ) - free(cidr); - - mme_config_p->ipv4.mme_interface_name_for_S11 = strdup(mme_interface_name_for_S11); - cidr = strdup(mme_ip_address_for_S11); - address = strtok(cidr, "/"); - IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR MME S11 !\n" ) - free(cidr); - - if (strncasecmp("tun",mme_config_p->ipv4.mme_interface_name_for_S1_MME, strlen("tun")) == 0) { - if (snprintf(system_cmd, 256, - "ip link set %s down ;openvpn --rmtun --dev %s", - mme_config_p->ipv4.mme_interface_name_for_S1_MME, - mme_config_p->ipv4.mme_interface_name_for_S1_MME - ) > 0) { - mme_system(system_cmd, 1); - } else { - fprintf(stderr, "Del %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME); - } - - if (snprintf(system_cmd, 256, - "openvpn --mktun --dev %s;sync;ifconfig %s up;sync", - mme_config_p->ipv4.mme_interface_name_for_S1_MME, - mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) { - mme_system(system_cmd, 1); - } else { - fprintf(stderr, "Create %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME); - } - - if (snprintf(system_cmd, 256, - "ip -4 addr add %s dev %s", - mme_ip_address_for_S1_MME, - mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) { - mme_system(system_cmd, 1); - } else { - fprintf(stderr, "Set IPv4 address on %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME); - } - } - - } - } - - // NAS SETTING - setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NAS_CONFIG); - - if (setting != NULL) { - subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_INTEGRITY_ALGORITHM_LIST); - - if (subsetting != NULL) { - num = config_setting_length(subsetting); - - if (num <= 8) { - for (i = 0; i < num; i++) { - astring = config_setting_get_string_elem(subsetting, i); - - if (strcmp("EIA0", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - else if (strcmp("EIA1", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA1; - else if (strcmp("EIA2", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA2; - else if (strcmp("EIA3", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - else if (strcmp("EIA4", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - else if (strcmp("EIA5", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - else if (strcmp("EIA6", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - else if (strcmp("EIA7", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - } - - for (i = num; i < 8; i++) { - mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0; - } - } - } - - subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST); - - if (subsetting != NULL) { - num = config_setting_length(subsetting); - - if (num <= 8) { - for (i = 0; i < num; i++) { - astring = config_setting_get_string_elem(subsetting, i); - - if (strcmp("EEA0", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - else if (strcmp("EEA1", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA1; - else if (strcmp("EEA2", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA2; - else if (strcmp("EEA3", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - else if (strcmp("EEA4", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - else if (strcmp("EEA5", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - else if (strcmp("EEA6", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - else if (strcmp("EEA7", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - } - - for (i = num; i < 8; i++) { - mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0; - } - } - } - - } - } - - setting = config_lookup(&cfg, SGW_CONFIG_STRING_SGW_CONFIG); - - if(setting != NULL) { - subsetting = config_setting_get_member (setting, SGW_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); - - if(subsetting != NULL) { - if( ( - config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP, - (const char **)&sgw_ip_address_for_S1u_S12_S4_up) - && config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11, - (const char **)&sgw_ip_address_for_S11) - && config_setting_lookup_int( subsetting, SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP, &alongint) - ) - ) { - cidr = strdup(sgw_ip_address_for_S1u_S12_S4_up); - address = strtok(cidr, "/"); - IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR SGW S1u_S12_S4 !\n" ) - free(cidr); - - cidr = strdup(sgw_ip_address_for_S11); - address = strtok(cidr, "/"); - IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR SGW S11 !\n" ) - free(cidr); - - mme_config_p->gtpv1u_config.port_number = (uint16_t) alongint; - } - } - } - - return 0; -} - -#define DISPLAY_ARRAY(size, format, args...) \ -do { \ - int i; \ - for (i = 0; i < size; i++) { \ - fprintf(stdout, format, args); \ - if ((i != (size - 1)) && ((i + 1) % 10 == 0)) \ - { \ - fprintf(stdout, "\n "); \ - } \ - } \ - if (i > 0) \ - fprintf(stdout, "\n"); \ -} while(0) - -static void config_display(mme_config_t *mme_config_p) -{ - int j; - - fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION); - fprintf(stdout, "Configuration:\n"); - fprintf(stdout, "- File ...............: %s\n", mme_config_p->config_file); - fprintf(stdout, "- Verbosity level ....: %d\n", mme_config_p->verbosity_level); - fprintf(stdout, "- Realm ..............: %s\n", mme_config_p->realm); - fprintf(stdout, "- Max eNBs ...........: %u\n", mme_config_p->max_eNBs); - fprintf(stdout, "- Max UEs ............: %u\n", mme_config_p->max_ues); - fprintf(stdout, "- Emergency support ..: %s\n", mme_config_p->emergency_attach_supported == 0 ? "FALSE" : "TRUE"); - fprintf(stdout, "- Unauth IMSI support : %s\n", mme_config_p->unauthenticated_imsi_supported == 0 ? "FALSE" : "TRUE"); - fprintf(stdout, "- Relative capa ......: %u\n\n", mme_config_p->relative_capacity); - fprintf(stdout, "- Statistics timer ...: %u (seconds)\n\n", mme_config_p->mme_statistic_timer); - fprintf(stdout, "- S1-U:\n"); - fprintf(stdout, " port number ......: %d\n", mme_config_p->gtpv1u_config.port_number); - fprintf(stdout, "- S1-MME:\n"); - fprintf(stdout, " port number ......: %d\n", mme_config_p->s1ap_config.port_number); - fprintf(stdout, "- IP:\n"); - //fprintf(stdout, " s1-u iface .......: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up); - fprintf(stdout, " s1-u ip ..........: %s\n", - inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up))); - //fprintf(stdout, " sgi iface ........: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI); - //fprintf(stdout, " sgi ip ...........: %s/%d\n", - // inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.pgw_ip_addr_for_SGI)), - // mme_config_p->ipv4.pgw_ip_netmask_for_SGI); - fprintf(stdout, " s1-MME iface .....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME); - fprintf(stdout, " s1-MME ip ........: %s\n", - inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S1_MME))); - //fprintf(stdout, " s11 S-GW iface ...: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S11); - //fprintf(stdout, " s11 S-GW ip ......: %s/%d\n", - // inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S11)), - // mme_config_p->ipv4.sgw_ip_netmask_for_S11); - fprintf(stdout, " s11 MME iface ....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S11); - fprintf(stdout, " s11 S-GW ip ......: %s\n", - inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S11))); - fprintf(stdout, "- ITTI:\n"); - fprintf(stdout, " queue size .......: %u (bytes)\n", mme_config_p->itti_config.queue_size); - fprintf(stdout, " log file .........: %s\n", mme_config_p->itti_config.log_file); - fprintf(stdout, "- SCTP:\n"); - fprintf(stdout, " in streams .......: %u\n", mme_config_p->sctp_config.in_streams); - fprintf(stdout, " out streams ......: %u\n", mme_config_p->sctp_config.out_streams); - fprintf(stdout, "- GUMMEI:\n"); - fprintf(stdout, " mme group ids ....:\n "); - DISPLAY_ARRAY(mme_config_p->gummei.nb_mme_gid, "| %u ", mme_config_p->gummei.mme_gid[i]); - fprintf(stdout, " mme codes ........:\n "); - DISPLAY_ARRAY(mme_config_p->gummei.nb_mmec, "| %u ", mme_config_p->gummei.mmec[i]); - fprintf(stdout, " plmns ............: (mcc.mnc:tac)\n"); - - for (j= 0; j < mme_config_p->gummei.nb_plmns; j++) { - if (mme_config_p->gummei.plmn_mnc_len[j] ==2 ) { - fprintf(stdout, " %3u.%3u:%u\n", - mme_config_p->gummei.plmn_mcc[j], - mme_config_p->gummei.plmn_mnc[j], - mme_config_p->gummei.plmn_tac[j]); - } else { - fprintf(stdout, " %3u.%03u:%u\n", - mme_config_p->gummei.plmn_mcc[j], - mme_config_p->gummei.plmn_mnc[j], - mme_config_p->gummei.plmn_tac[j]); - } - } - - fprintf(stdout, "- S6A:\n"); - fprintf(stdout, " conf file ........: %s\n", mme_config_p->s6a_config.conf_file); -} - -static void usage(void) -{ - fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION); - fprintf(stdout, "Please report any bug to: %s\n\n", PACKAGE_BUGREPORT); - fprintf(stdout, "Usage: oaisim_mme [options]\n\n"); - fprintf(stdout, "Available options:\n"); - fprintf(stdout, "-h Print this help and return\n"); - fprintf(stdout, "-c\n"); - fprintf(stdout, " Set the configuration file for mme\n"); - fprintf(stdout, " See template in UTILS/CONF\n"); - fprintf(stdout, "-K\n"); - fprintf(stdout, " Output intertask messages to provided file\n"); - fprintf(stdout, "-V Print %s version and return\n", PACKAGE_NAME); - fprintf(stdout, "-v[1-2] Debug level:\n"); - fprintf(stdout, " 1 -> ASN1 XER printf on and ASN1 debug off\n"); - fprintf(stdout, " 2 -> ASN1 XER printf on and ASN1 debug on\n"); -} - -extern void -nwGtpv1uDisplayBanner(void); - -int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p) -{ - int c; - mme_config_init(mme_config_p); - - /* Parsing command line */ - while ((c = getopt (argc, argv, "O:c:hi:K:v:V")) != -1) { - switch (c) { - case 'O': - case 'c': { - /* Store the given configuration file. If no file is given, - * then the default values will be used. - */ - int config_file_len = 0; - config_file_len = strlen(optarg); - mme_config_p->config_file = malloc(sizeof(char) * (config_file_len + 1)); - memcpy(mme_config_p->config_file, optarg, config_file_len); - mme_config_p->config_file[config_file_len] = '\0'; - } - break; - - case 'v': { - mme_config_p->verbosity_level = atoi(optarg); - } - break; - - case 'V': { - fprintf(stdout, "==== EURECOM %s v%s ====\n" - "Please report any bug to: %s\n", PACKAGE_NAME, PACKAGE_VERSION, - PACKAGE_BUGREPORT); - exit(0); - nwGtpv1uDisplayBanner(); - } - break; - - case 'K': - mme_config_p->itti_config.log_file = strdup(optarg); - break; - - case 'h': /* Fall through */ - default: - usage(); - exit(0); - } - } - - /* Parse the configuration file using libconfig */ - if (config_parse_file(mme_config_p) != 0) { - return -1; - } - - /* Display the configuration */ - config_display(mme_config_p); - return 0; -} diff --git a/targets/ARCH/BLADERF/README b/targets/ARCH/BLADERF/README new file mode 100644 index 0000000000..c93c938baf --- /dev/null +++ b/targets/ARCH/BLADERF/README @@ -0,0 +1,138 @@ +BladeRF documentation +===================== + +As of 2018-11-06, the bladeRF support is not fully automatic and requires +some manual settings before use. This documentation is the ultimate source +of information. If something described in this file does not work or does +not correspond to the reality, then contact us so we can fix the problems +and update this documentation. + +1. Install bladeRF 2.0 libraries. + + As of now, it's better to install from source. + So, do not run: ./build_oai -I -w BLADERF + (That is: do not include '-w BLADERF'.) + + Instead, follow the instructions at: https://github.com/Nuand/bladeRF + + If you already had some bladeRF software installed using automatic + methods, first remove it by hand ('apt-get purge bladeRF' or something + similar, you can get the list of installed bladeRF packages by running + 'dpkg -l|grep -i blade', remove them all). + +2. Update the device. + + Download the latest FX3 firmware and FPGA images from Nuand's website. + As of writing, this is: + + https://github.com/Nuand/bladeRF/wiki + + That points to the following pages. + For FX3: + + http://www.nuand.com/fx3_images/ + + For FPGA: + + http://www.nuand.com/fpga_images/ + + Install FX3 firmware: + + sudo bladeRF-cli -f bladeRF_fw_latest.img + + Install FPGA image (this is for BladeRF x40): + + sudo bladeRF-cli -L hostedx40-latest.rbf + + Retrieve calibration information: + + sudo bladeRF-cli -i + info + + That outputs the serial number of your device. + + Go to: + + https://www.nuand.com/calibration + + And enter your serial number. + The website tells you to run something like: + + sudo bladeRF-cli -i + flash_init_cal 40 0x9271 + + Actual values depend on your device and serial number. + +3. Calibrate the bladeRF device. + + We will work with band 7 on 2.68GHz with a bandwidth of 5 MHz (25 RBs). + + Plug the bladeRF device, then run: + + sudo bladeRF-cli -i + set frequency tx 2680000000 + set frequency rx 2560000000 + set gain rx 60 + set gain tx 60 + set bandwidth 5000000 + set samplerate 7680000 + cal lms + cal lms + cal lms + cal dc rxtx + cal dc rxtx + cal dc rxtx + +4. Tune the RX gain using the enb tracer. + + Run the softmodem and the 'enb' tracer. For instructions, see: + + https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/T/basic + + In the enb window, check the 'input signal'. You should see some blue + signal as seen at: + + https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/T/enb + + (the 'Time signal power' plot). + + The level should be around 30. + + If it's not around 30 then edit your configuration file and modify + the value 'max_rxgain' in the section 'RUs'. + + The configuration file to use is: + + configuration/bladeRF/enb-band7-5mhz.conf + + In the configuration file, you also need to set the correct values for: + + - tracking_area_code + - plmn_list: mcc, mnc, mnc_length + - mme_ip_address: this is the IP address used by the computer running + the softmodem to connect to the EPC + - NETWORK_INTERFACES: all the ENB*ADDRESS* variables have to point + to the IP address of the EPC machine + +5. You're good to go. + + You can now connect a UE and pass some traffic. If everything is well + configured you can expect more than 16 Mb/s of throughput in the downlink + using iperf and more than 8 Mb/s in the uplink. Looking at the logs, you + should find lines containing 'PHR 40' and 'CQI 15'. If your values are + lower then your setup may need some adjustments. + +6. In case of problems. + + If the performance of the softmodem is very bad, you can stop it and + run the calibration again, without setting the parameters (frequencies, + gains, etc.). Just run: + + sudo bladeRF-cli -i + cal lms + cal dc rxtx + + That may help. + + Be sure to use proper radio equipment (duplexer, antennas, clean + environment without interferences). diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c index 75a7825669..e5966af267 100644 --- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c +++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c @@ -116,15 +116,6 @@ int trx_brf_start(openair0_device *device) { abort(); } - if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_TX)) != 0) { - fprintf(stderr,"Failed to calibrate TX DC: %s\n", bladerf_strerror(status)); - abort(); - } - if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_RX)) != 0) { - fprintf(stderr,"Failed to calibrate RX DC: %s\n", bladerf_strerror(status)); - abort(); - } - return 0; } @@ -235,8 +226,6 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp, * \param device the hardware to use */ void trx_brf_end(openair0_device *device) { -abort(); - int status; brf_state_t *brf = (brf_state_t*)device->priv; // Disable RX module, shutting down our underlying RX stream @@ -247,6 +236,7 @@ abort(); fprintf(stderr, "Failed to disable TX module: %s\n", bladerf_strerror(status)); } bladerf_close(brf->dev); + exit(1); } /*! \brief print the BladeRF statistics @@ -362,6 +352,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { */ void calibrate_rf(openair0_device *device) { + /* TODO: this function does not seem to work. Disabled until fixed. */ + return; brf_state_t *brf = (brf_state_t *)device->priv; openair0_timestamp ptimestamp; @@ -1005,6 +997,12 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // RX // Example of CLI output: RX Frequency: 2539999999Hz + + if ((status=bladerf_set_gain_mode(brf->dev, BLADERF_MODULE_RX, BLADERF_GAIN_MGC))) { + fprintf(stderr, "[BRF] Failed to disable AGC\n"); + brf_error(status); + } + if ((status=bladerf_set_frequency(brf->dev, BLADERF_MODULE_RX, (unsigned int) openair0_cfg->rx_freq[0])) != 0){ fprintf(stderr,"Failed to set RX frequency: %s\n",bladerf_strerror(status)); brf_error(status); @@ -1096,17 +1094,14 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // calibrate - if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_TX)) != 0) { - fprintf(stderr,"Failed to calibrate TX DC: %s\n", bladerf_strerror(status)); + if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_DC_CAL_LPF_TUNING)) != 0 || + (status=bladerf_calibrate_dc(brf->dev, BLADERF_DC_CAL_TX_LPF)) != 0 || + (status=bladerf_calibrate_dc(brf->dev, BLADERF_DC_CAL_RX_LPF)) != 0 || + (status=bladerf_calibrate_dc(brf->dev, BLADERF_DC_CAL_RXVGA2)) != 0) { + fprintf(stderr, "[BRF] error calibrating\n"); brf_error(status); - } else - printf("[BRF] TX module calibrated DC \n"); - - if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_RX)) != 0) { - fprintf(stderr,"Failed to calibrate RX DC: %s\n", bladerf_strerror(status)); - brf_error(status); - }else - printf("[BRF] RX module calibrated DC \n"); + } else + printf("[BRF] calibration OK\n"); bladerf_log_set_verbosity(get_brf_log_level(openair0_cfg->log_level)); @@ -1146,8 +1141,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { * \returns 0 on success */ int brf_error(int status) { - - //exit(-1); + fprintf(stderr, "[BRF] brf_error: %s\n", bladerf_strerror(status)); + exit(-1); return status; // or status error code } @@ -1190,7 +1185,7 @@ struct bladerf * open_bladerf_from_serial(const char *serial) { int get_brf_log_level(int log_level){ int level=BLADERF_LOG_LEVEL_INFO; - return BLADERF_LOG_LEVEL_DEBUG; // BLADERF_LOG_LEVEL_VERBOSE;// BLADERF_LOG_LEVEL_DEBUG; // + return BLADERF_LOG_LEVEL_INFO; switch(log_level) { case LOG_DEBUG: level=BLADERF_LOG_LEVEL_DEBUG; diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index c876603203..1457d15171 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -48,7 +48,7 @@ int set_device(openair0_device *device) { case USRP_B200_DEV: printf("[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); break; -case USRP_X300_DEV: + case USRP_X300_DEV: printf("[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); break; case BLADERF_DEV: @@ -57,6 +57,9 @@ case USRP_X300_DEV: case LMSSDR_DEV: printf("[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); break; + case IRIS_DEV: + printf("[%s] has loaded Iris device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); + break; case NONE_DEV: printf("[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU")); break; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 042a726c82..74f8dd6803 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -95,6 +95,8 @@ typedef enum { BLADERF_DEV, /*!\brief device is LMSSDR (SoDeRa)*/ LMSSDR_DEV, + /*!\brief device is Iris */ + IRIS_DEV, /*!\brief device is NONE*/ NONE_DEV, MAX_RF_DEV_TYPE diff --git a/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc b/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc new file mode 100644 index 0000000000..79d0a5b7a8 --- /dev/null +++ b/targets/ARCH/IRIS/USERSPACE/LIB/Makefile.inc @@ -0,0 +1,4 @@ +IRIS_OBJ += $(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/iris_lib.o +IRIS_FILE_OBJ += $(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp +IRIS_CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/COMMON -I$(OPENAIR_TARGETS)/ARCH/IRIS/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/COMMON + diff --git a/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp new file mode 100644 index 0000000000..7abdf65498 --- /dev/null +++ b/targets/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp @@ -0,0 +1,852 @@ + +/** iris_lib.cpp + * + * \authors: Rahman Doost-Mohammady : doost@rice.edu + * Clay Shepard : cws@rice.edu + */ + +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include "common/utils/LOG/log_extern.h" +#include "common_lib.h" +#include + +#ifdef __SSE4_1__ +# include +#endif + +#ifdef __AVX2__ +# include +#endif + +#define MOVE_DC +#define SAMPLE_RATE_DOWN 1 + +/*! \brief Iris Configuration */ +typedef struct { + + // -------------------------------- + // variables for Iris configuration + // -------------------------------- + //! Iris device pointer + std::vector iris; + int device_num; + int rx_num_channels; + int tx_num_channels; + //create a send streamer and a receive streamer + //! Iris TX Stream + std::vector txStream; + //! Iris RX Stream + std::vector rxStream; + + //! Sampling rate + double sample_rate; + + //! time offset between transmiter timestamp and receiver timestamp; + double tdiff; + + //! TX forward samples. + int tx_forward_nsamps; //166 for 20Mhz + + + // -------------------------------- + // Debug and output control + // -------------------------------- + //! Number of underflows + int num_underflows; + //! Number of overflows + int num_overflows; + + //! Number of sequential errors + int num_seq_errors; + //! tx count + int64_t tx_count; + //! rx count + int64_t rx_count; + //! timestamp of RX packet + openair0_timestamp rx_timestamp; + +} iris_state_t; + +/*! \brief Called to start the Iris lime transceiver. Return 0 if OK, < 0 if error + @param device pointer to the device structure specific to the RF hardware target +*/ +static int trx_iris_start(openair0_device *device) { + iris_state_t *s = (iris_state_t *) device->priv; + + long long timeNs = s->iris[0]->getHardwareTime("") + 500000; + int flags = 0; + //flags |= SOAPY_SDR_HAS_TIME; + int r; + for (r = 0; r < s->device_num; r++) { + int ret = s->iris[r]->activateStream(s->rxStream[r], flags, timeNs, 0); + int ret2 = s->iris[r]->activateStream(s->txStream[r]); + if (ret < 0 | ret2 < 0) + return -1; + } + return 0; +} + +/*! \brief Stop Iris + * \param card refers to the hardware index to use + */ +int trx_iris_stop(openair0_device *device) { + iris_state_t *s = (iris_state_t *) device->priv; + int r; + for (r = 0; r < s->device_num; r++) { + s->iris[r]->deactivateStream(s->txStream[r]); + s->iris[r]->deactivateStream(s->rxStream[r]); + } + return (0); +} + +/*! \brief Terminate operation of the Iris lime transceiver -- free all associated resources + * \param device the hardware to use + */ +static void trx_iris_end(openair0_device *device) { + LOG_I(HW, "Closing Iris device.\n"); + trx_iris_stop(device); + iris_state_t *s = (iris_state_t *) device->priv; + int r; + for (r = 0; r < s->device_num; r++) { + s->iris[r]->closeStream(s->txStream[r]); + s->iris[r]->closeStream(s->rxStream[r]); + SoapySDR::Device::unmake(s->iris[r]); + } +} + +/*! \brief Called to send samples to the Iris RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple anteannas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied +*/ + + +static int +trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { + using namespace std::chrono; + static long long int loop = 0; + static long time_min = 0, time_max = 0, time_avg = 0; + struct timespec tp_start, tp_end; + long time_diff; + + int ret = 0, ret_i = 0; + int flag = 0; + + iris_state_t *s = (iris_state_t *) device->priv; + int nsamps2; // aligned to upper 32 or 16 byte boundary +#if defined(__x86_64) || defined(__i386__) +#ifdef __AVX2__ + nsamps2 = (nsamps+7)>>3; + __m256i buff_tx[2][nsamps2]; +#else + nsamps2 = (nsamps+3)>>2; + __m128i buff_tx[2][nsamps2]; +#endif +#endif + + // bring RX data into 12 LSBs for softmodem RX + for (int i=0; iiris[0]->getHardwareTime(""); + return nsamps; + } + + if (flags == 2 || flags == 1) { // start of burst + + } else if (flags == 3 | flags == 4) { + flag |= SOAPY_SDR_END_BURST; + } + + + long long timeNs = SoapySDR::ticksToTimeNs(timestamp, s->sample_rate / SAMPLE_RATE_DOWN); + uint32_t *samps[2]; //= (uint32_t **)buff; + int r; + int m = s->tx_num_channels; + for (r = 0; r < s->device_num; r++) { + int samples_sent = 0; + samps[0] = (uint32_t *) buff_tx[m * r]; + + if (cc % 2 == 0) + samps[1] = (uint32_t *) buff_tx[m * r + 1]; //cws: it seems another thread can clobber these, so we need to save them locally. +#ifdef IRIS_DEBUG + int i; + for (i = 200; i < 216; i++) + printf("%d, ",((int16_t)(samps[0][i]>>16))>>4); + printf("\n"); + //printf("\nHardware time before write: %lld, tx_time_stamp: %lld\n", s->iris[0]->getHardwareTime(""), timeNs); +#endif + ret = s->iris[r]->writeStream(s->txStream[r], (void **) samps, (size_t)(nsamps), flag, timeNs, 1000000); + + if (ret < 0) + printf("Unable to write stream!\n"); + else + samples_sent = ret; + + + if (samples_sent != nsamps) + printf("[xmit] tx samples %d != %d\n", samples_sent, nsamps); + + } + + return nsamps; +} + +/*! \brief Receive samples from hardware. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param antenna_id Index of antenna for which to receive samples + * \returns the number of sample read +*/ +static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { + int ret = 0; + static long long nextTime; + static bool nextTimeValid = false; + iris_state_t *s = (iris_state_t *) device->priv; + bool time_set = false; + long long timeNs = 0; + int flags; + int samples_received; + uint32_t *samps[2]; //= (uint32_t **)buff; + + int r; + int m = s->rx_num_channels; + int nsamps2; // aligned to upper 32 or 16 byte boundary +#if defined(__x86_64) || defined(__i386__) +#ifdef __AVX2__ + nsamps2 = (nsamps+7)>>3; + __m256i buff_tmp[2][nsamps2]; +#else + nsamps2 = (nsamps+3)>>2; + __m128i buff_tmp[2][nsamps2]; +#endif +#endif + + for (r = 0; r < s->device_num; r++) { + flags = 0; + samples_received = 0; + samps[0] = (uint32_t *) buff_tmp[m * r]; + if (cc % 2 == 0) + samps[1] = (uint32_t *) buff_tmp[m * r + 1]; + + flags = 0; + ret = s->iris[r]->readStream(s->rxStream[r], (void **) samps, (size_t)(nsamps), flags, + timeNs, 1000000); + if (ret < 0) { + if (ret == SOAPY_SDR_TIME_ERROR) + printf("[recv] Time Error in tx stream!\n"); + else if (ret == SOAPY_SDR_OVERFLOW | (flags & SOAPY_SDR_END_ABRUPT)) + printf("[recv] Overflow occured!\n"); + else if (ret == SOAPY_SDR_TIMEOUT) + printf("[recv] Timeout occured!\n"); + else if (ret == SOAPY_SDR_STREAM_ERROR) + printf("[recv] Stream (tx) error occured!\n"); + else if (ret == SOAPY_SDR_CORRUPTION) + printf("[recv] Bad packet occured!\n"); + break; + } else + samples_received = ret; + + + if (r == 0) { + if (samples_received == ret) // first batch + { + if (flags & SOAPY_SDR_HAS_TIME) { + s->rx_timestamp = SoapySDR::timeNsToTicks(timeNs, s->sample_rate / SAMPLE_RATE_DOWN); + *ptimestamp = s->rx_timestamp; + nextTime = timeNs; + nextTimeValid = true; + time_set = true; + //printf("1) time set %llu \n", *ptimestamp); + } + } + } + + if (r == 0) { + if (samples_received == nsamps) { + + if (flags & SOAPY_SDR_HAS_TIME) { + s->rx_timestamp = SoapySDR::timeNsToTicks(nextTime, s->sample_rate / SAMPLE_RATE_DOWN); + *ptimestamp = s->rx_timestamp; + nextTime = timeNs; + nextTimeValid = true; + time_set = true; + } + } else if (samples_received < nsamps) + printf("[recv] received %d samples out of %d\n", samples_received, nsamps); + + s->rx_count += samples_received; + + if (s->sample_rate != 0 && nextTimeValid) { + if (!time_set) { + s->rx_timestamp = SoapySDR::timeNsToTicks(nextTime, s->sample_rate / SAMPLE_RATE_DOWN); + *ptimestamp = s->rx_timestamp; + //printf("2) time set %llu, nextTime will be %llu \n", *ptimestamp, nextTime); + } + nextTime += SoapySDR::ticksToTimeNs(samples_received, s->sample_rate / SAMPLE_RATE_DOWN); + } + } + + // bring RX data into 12 LSBs for softmodem RX + for (int i=0; ipriv; + return SoapySDR::timeNsToTicks(s->iris[0]->getHardwareTime(""), s->sample_rate); +} + +/*! \brief Compares two variables within precision + * \param a first variable + * \param b second variable +*/ +static bool is_equal(double a, double b) { + return std::fabs(a - b) < std::numeric_limits::epsilon(); +} + +void *set_freq_thread(void *arg) { + + openair0_device *device = (openair0_device *) arg; + iris_state_t *s = (iris_state_t *) device->priv; + int r, i; + printf("Setting Iris TX Freq %f, RX Freq %f\n", device->openair0_cfg[0].tx_freq[0], + device->openair0_cfg[0].rx_freq[0]); + // add check for the number of channels in the cfg + for (r = 0; r < s->device_num; r++) { + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_RX); i++) { + if (i < s->rx_num_channels) + s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", device->openair0_cfg[0].rx_freq[i]); + } + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_TX); i++) { + if (i < s->tx_num_channels) + s->iris[r]->setFrequency(SOAPY_SDR_TX, i, "RF", device->openair0_cfg[0].tx_freq[i]); + } + } +} + +/*! \brief Set frequencies (TX/RX) + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param dummy dummy variable not used + * \returns 0 in success + */ +int trx_iris_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dont_block) { + iris_state_t *s = (iris_state_t *) device->priv; + pthread_t f_thread; + if (dont_block) + pthread_create(&f_thread, NULL, set_freq_thread, (void *) device); + else { + int r, i; + for (r = 0; r < s->device_num; r++) { + printf("Setting Iris TX Freq %f, RX Freq %f\n", openair0_cfg[0].tx_freq[0], openair0_cfg[0].rx_freq[0]); + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_RX); i++) { + if (i < s->rx_num_channels) { + s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", openair0_cfg[0].rx_freq[i]); + } + } + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_TX); i++) { + if (i < s->tx_num_channels) { + s->iris[r]->setFrequency(SOAPY_SDR_TX, i, "RF", openair0_cfg[0].tx_freq[i]); + } + } + } + } + return (0); +} + + +/*! \brief Set Gains (TX/RX) + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ +int trx_iris_set_gains(openair0_device *device, + openair0_config_t *openair0_cfg) { + iris_state_t *s = (iris_state_t *) device->priv; + int r; + for (r = 0; r < s->device_num; r++) { + s->iris[r]->setGain(SOAPY_SDR_RX, 0, openair0_cfg[0].rx_gain[0]); + s->iris[r]->setGain(SOAPY_SDR_TX, 0, openair0_cfg[0].tx_gain[0]); + s->iris[r]->setGain(SOAPY_SDR_RX, 1, openair0_cfg[0].rx_gain[1]); + s->iris[r]->setGain(SOAPY_SDR_TX, 1, openair0_cfg[0].tx_gain[1]); + } + return (0); +} + +/*! \brief Iris RX calibration table */ +rx_gain_calib_table_t calib_table_iris[] = { + {3500000000.0, 83}, + {2660000000.0, 83}, + {2580000000.0, 83}, + {2300000000.0, 83}, + {1880000000.0, 83}, + {816000000.0, 83}, + {-1, 0}}; + + +/*! \brief Set RX gain offset + * \param openair0_cfg RF frontend parameters set by application + * \param chain_index RF chain to apply settings to + * \returns 0 in success + */ +void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index, int bw_gain_adjust) { + + int i = 0; + // loop through calibration table to find best adjustment factor for RX frequency + double min_diff = 6e9, diff, gain_adj = 0.0; + if (bw_gain_adjust == 1) { + switch ((int) openair0_cfg[0].sample_rate) { + case 30720000: + break; + case 23040000: + gain_adj = 1.25; + break; + case 15360000: + gain_adj = 3.0; + break; + case 7680000: + gain_adj = 6.0; + break; + case 3840000: + gain_adj = 9.0; + break; + case 1920000: + gain_adj = 12.0; + break; + default: + printf("unknown sampling rate %d\n", (int) openair0_cfg[0].sample_rate); + exit(-1); + break; + } + } + + while (openair0_cfg->rx_gain_calib_table[i].freq > 0) { + diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq); + printf("cal %d: freq %f, offset %f, diff %f\n", + i, + openair0_cfg->rx_gain_calib_table[i].freq, + openair0_cfg->rx_gain_calib_table[i].offset, diff); + if (min_diff > diff) { + min_diff = diff; + openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset + gain_adj; + } + i++; + } + +} + +/*! \brief print the Iris statistics +* \param device the hardware to use +* \returns 0 on success +*/ +int trx_iris_get_stats(openair0_device *device) { + + return (0); + +} + +/*! \brief Reset the Iris statistics +* \param device the hardware to use +* \returns 0 on success +*/ +int trx_iris_reset_stats(openair0_device *device) { + + return (0); + +} + + +extern "C" { +/*! \brief Initialize Openair Iris target. It returns 0 if OK +* \param device the hardware to use +* \param openair0_cfg RF frontend parameters set by application +*/ +int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { + + size_t i, r, card; + int bw_gain_adjust = 0; + openair0_cfg[0].rx_gain_calib_table = calib_table_iris; + iris_state_t *s = (iris_state_t *) malloc(sizeof(iris_state_t)); + memset(s, 0, sizeof(iris_state_t)); + + std::string devFE("DEV"); + std::string cbrsFE("CBRS"); + std::string wireFormat("WIRE"); + + // Initialize Iris device + device->openair0_cfg = openair0_cfg; + SoapySDR::Kwargs args; + args["driver"] = "iris"; + char *iris_addrs = device->openair0_cfg[0].sdr_addrs; + if (iris_addrs == NULL) + { + s->iris.push_back(SoapySDR::Device::make(args)); + } + else + { + char *serial = strtok(iris_addrs, ","); + while (serial != NULL) { + LOG_I(HW, "Attempting to open Iris device %s\n", serial); + args["serial"] = serial; + s->iris.push_back(SoapySDR::Device::make(args)); + serial = strtok(NULL, ","); + } + } + + s->device_num = s->iris.size(); + device->type = IRIS_DEV; + + + switch ((int) openair0_cfg[0].sample_rate) { + case 30720000: + //openair0_cfg[0].samples_per_packet = 1024; + openair0_cfg[0].tx_sample_advance = 115; + openair0_cfg[0].tx_bw = 20e6; + openair0_cfg[0].rx_bw = 20e6; + break; + case 23040000: + //openair0_cfg[0].samples_per_packet = 1024; + openair0_cfg[0].tx_sample_advance = 113; + openair0_cfg[0].tx_bw = 15e6; + openair0_cfg[0].rx_bw = 15e6; + break; + case 15360000: + //openair0_cfg[0].samples_per_packet = 1024; + openair0_cfg[0].tx_sample_advance = 60; + openair0_cfg[0].tx_bw = 10e6; + openair0_cfg[0].rx_bw = 10e6; + break; + case 7680000: + //openair0_cfg[0].samples_per_packet = 1024; + openair0_cfg[0].tx_sample_advance = 30; + openair0_cfg[0].tx_bw = 5e6; + openair0_cfg[0].rx_bw = 5e6; + break; + case 1920000: + //openair0_cfg[0].samples_per_packet = 1024; + openair0_cfg[0].tx_sample_advance = 20; + openair0_cfg[0].tx_bw = 1.4e6; + openair0_cfg[0].rx_bw = 1.4e6; + break; + default: + printf("Error: unknown sampling rate %f\n", openair0_cfg[0].sample_rate); + exit(-1); + break; + } + + printf("tx_sample_advance %d\n", openair0_cfg[0].tx_sample_advance); + s->rx_num_channels = openair0_cfg[0].rx_num_channels; + s->tx_num_channels = openair0_cfg[0].tx_num_channels; + if ((s->rx_num_channels == 1 || s->rx_num_channels == 2) && (s->tx_num_channels == 1 || s->tx_num_channels == 2)) + printf("Enabling %d rx and %d tx channel(s) on each device...\n", s->rx_num_channels, s->tx_num_channels); + else { + printf("Invalid rx or tx number of channels (%d, %d)\n", s->rx_num_channels, s->tx_num_channels); + exit(-1); + } + + for (r = 0; r < s->device_num; r++) { + //this is unnecessary -- it will set the correct master clock based on sample rate + /*switch ((int) openair0_cfg[0].sample_rate) { + case 1920000: + s->iris[r]->setMasterClockRate(256 * openair0_cfg[0].sample_rate); + break; + case 3840000: + s->iris[r]->setMasterClockRate(128 * openair0_cfg[0].sample_rate); + break; + case 7680000: + s->iris[r]->setMasterClockRate(64 * openair0_cfg[0].sample_rate); + break; + case 15360000: + s->iris[r]->setMasterClockRate(32 * openair0_cfg[0].sample_rate); + break; + case 30720000: + s->iris[r]->setMasterClockRate(16 * openair0_cfg[0].sample_rate); + break; + default: + printf("Error: unknown sampling rate %f\n", openair0_cfg[0].sample_rate); + exit(-1); + break; + }*/ + + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_RX); i++) { + if (i < s->rx_num_channels) { + s->iris[r]->setSampleRate(SOAPY_SDR_RX, i, openair0_cfg[0].sample_rate / SAMPLE_RATE_DOWN); +#ifdef MOVE_DC + printf("Moving DC out of main carrier for rx...\n"); + s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", openair0_cfg[0].rx_freq[i]-.75*openair0_cfg[0].sample_rate); + s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "BB", .75*openair0_cfg[0].sample_rate); +#else + s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", openair0_cfg[0].rx_freq[i]); +#endif + + set_rx_gain_offset(&openair0_cfg[0], i, bw_gain_adjust); + //s->iris[r]->setGain(SOAPY_SDR_RX, i, openair0_cfg[0].rx_gain[i] - openair0_cfg[0].rx_gain_offset[i]); + printf("rx gain offset: %f, rx_gain: %f, tx_tgain: %f\n", openair0_cfg[0].rx_gain_offset[i], openair0_cfg[0].rx_gain[i], openair0_cfg[0].tx_gain[i]); + if (s->iris[r]->getHardwareInfo()["frontend"].compare(devFE) != 0) { + s->iris[r]->setGain(SOAPY_SDR_RX, i, "LNA", openair0_cfg[0].rx_gain[i] - openair0_cfg[0].rx_gain_offset[i]); + //s->iris[r]->setGain(SOAPY_SDR_RX, i, "LNA", 0); + s->iris[r]->setGain(SOAPY_SDR_RX, i, "LNA1", 30); + s->iris[r]->setGain(SOAPY_SDR_RX, i, "LNA2", 17); + s->iris[r]->setGain(SOAPY_SDR_RX, i, "TIA", 7); + s->iris[r]->setGain(SOAPY_SDR_RX, i, "PGA", 18); + s->iris[r]->setGain(SOAPY_SDR_RX, i, "ATTN", 0); + } else { + s->iris[r]->setGain(SOAPY_SDR_RX, i, "LNA", openair0_cfg[0].rx_gain[i] - openair0_cfg[0].rx_gain_offset[i]); // [0,30] + s->iris[r]->setGain(SOAPY_SDR_RX, i, "TIA", 7); // [0,12,6] + s->iris[r]->setGain(SOAPY_SDR_RX, i, "PGA", 18); // [-12,19,1] + //s->iris[r]->setGain(SOAPY_SDR_RX, i, 50); // [-12,19,1] + + } + + s->iris[r]->setDCOffsetMode(SOAPY_SDR_RX, i, true); // move somewhere else + } + } + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_TX); i++) { + if (i < s->tx_num_channels) { + s->iris[r]->setSampleRate(SOAPY_SDR_TX, i, openair0_cfg[0].sample_rate / SAMPLE_RATE_DOWN); +#ifdef MOVE_DC + printf("Moving DC out of main carrier for tx...\n"); + s->iris[r]->setFrequency(SOAPY_SDR_TX, i, "RF", openair0_cfg[0].tx_freq[i]-.75*openair0_cfg[0].sample_rate); + s->iris[r]->setFrequency(SOAPY_SDR_TX, i, "BB", .75*openair0_cfg[0].sample_rate); +#else + s->iris[r]->setFrequency(SOAPY_SDR_TX, i, "RF", openair0_cfg[0].tx_freq[i]); +#endif + + if (s->iris[r]->getHardwareInfo()["frontend"].compare(devFE) == 0) { + s->iris[r]->setGain(SOAPY_SDR_TX, i, "PAD", openair0_cfg[0].tx_gain[i]); + //s->iris[r]->setGain(SOAPY_SDR_TX, i, "PAD", 50); + s->iris[r]->setGain(SOAPY_SDR_TX, i, "IAMP", 12); + //s->iris[r]->writeSetting("TX_ENABLE_DELAY", "0"); + //s->iris[r]->writeSetting("TX_DISABLE_DELAY", "100"); + } else { + s->iris[r]->setGain(SOAPY_SDR_TX, i, "PAD", openair0_cfg[0].tx_gain[i]); + s->iris[r]->setGain(SOAPY_SDR_TX, i, "ATTN", 0); // [-18, 0, 6] dB + s->iris[r]->setGain(SOAPY_SDR_TX, i, "IAMP", 6); // [-12, 12, 1] dB + //s->iris[r]->setGain(SOAPY_SDR_TX, i, "PAD", 44); //openair0_cfg[0].tx_gain[i]); + //s->iris[r]->setGain(SOAPY_SDR_TX, i, "PAD", 35); // [0, 52, 1] dB + //s->iris[r]->setGain(SOAPY_SDR_TX, i, "PA1", 17); // 17 ??? dB + s->iris[r]->setGain(SOAPY_SDR_TX, i, "PA2", 0); // [0, 17, 17] dB + //s->iris[r]->setGain(SOAPY_SDR_TX, i, "PA3", 20); // 33 ??? dB + s->iris[r]->writeSetting("TX_ENABLE_DELAY", "0"); + s->iris[r]->writeSetting("TX_DISABLE_DELAY", "100"); + } + +// if (openair0_cfg[0].duplex_mode == 0) { +// printf("\nFDD: Enable TX antenna override\n"); +// s->iris[r]->writeSetting(SOAPY_SDR_TX, i, "TX_ENB_OVERRIDE", +// "true"); // From Josh: forces tx switching to be on always transmit regardless of bursts +// } + } + } + + + + printf("Actual master clock: %fMHz...\n", (s->iris[r]->getMasterClockRate() / 1e6)); + + int tx_filt_bw = openair0_cfg[0].tx_bw; + int rx_filt_bw = openair0_cfg[0].rx_bw; +#ifdef MOVE_DC //the filter is centered around the carrier, so we have to expand it if we have moved the DC tone. + tx_filt_bw *= 3; + rx_filt_bw *= 3; +#endif + /* Setting TX/RX BW */ + for (i = 0; i < s->tx_num_channels; i++) { + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_TX)) { + s->iris[r]->setBandwidth(SOAPY_SDR_TX, i, tx_filt_bw); + printf("Setting tx bandwidth on channel %lu/%lu: BW %f (readback %f)\n", i, + s->iris[r]->getNumChannels(SOAPY_SDR_TX), tx_filt_bw / 1e6, + s->iris[r]->getBandwidth(SOAPY_SDR_TX, i) / 1e6); + } + } + for (i = 0; i < s->rx_num_channels; i++) { + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_RX)) { + s->iris[r]->setBandwidth(SOAPY_SDR_RX, i, rx_filt_bw); + printf("Setting rx bandwidth on channel %lu/%lu : BW %f (readback %f)\n", i, + s->iris[r]->getNumChannels(SOAPY_SDR_RX), rx_filt_bw / 1e6, + s->iris[r]->getBandwidth(SOAPY_SDR_RX, i) / 1e6); + } + } + + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_TX); i++) { + if (i < s->tx_num_channels) { + printf("\nUsing SKLK calibration...\n"); + s->iris[r]->writeSetting(SOAPY_SDR_TX, i, "CALIBRATE", "SKLK"); + + } + + } + + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_RX); i++) { + if (i < s->rx_num_channels) { + printf("\nUsing SKLK calibration...\n"); + s->iris[r]->writeSetting(SOAPY_SDR_RX, i, "CALIBRATE", "SKLK"); + + } + + } + + if (s->iris[r]->getHardwareInfo()["frontend"].compare(devFE) == 0) { + for (i = 0; i < s->iris[r]->getNumChannels(SOAPY_SDR_RX); i++) { + if (openair0_cfg[0].duplex_mode == 0) { + printf("\nFDD: Setting receive antenna to %s\n", s->iris[r]->listAntennas(SOAPY_SDR_RX, i)[1].c_str()); + if (i < s->rx_num_channels) + s->iris[r]->setAntenna(SOAPY_SDR_RX, i, "RX"); + } else { + printf("\nTDD: Setting receive antenna to %s\n", s->iris[r]->listAntennas(SOAPY_SDR_RX, i)[0].c_str()); + if (i < s->rx_num_channels) + s->iris[r]->setAntenna(SOAPY_SDR_RX, i, "TRX"); + } + } + } + + + //s->iris[r]->writeSetting("TX_SW_DELAY", std::to_string( + // -openair0_cfg[0].tx_sample_advance)); //should offset switching to compensate for RF path (Lime) delay -- this will eventually be automated + + // create tx & rx streamer + //const SoapySDR::Kwargs &arg = SoapySDR::Kwargs(); + std::map rxStreamArgs; + rxStreamArgs["WIRE"] = SOAPY_SDR_CS16; + + std::vector channels; + for (i = 0; i < s->rx_num_channels; i++) + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_RX)) + channels.push_back(i); + s->rxStream.push_back(s->iris[r]->setupStream(SOAPY_SDR_RX, SOAPY_SDR_CS16, channels));//, rxStreamArgs)); + + std::vector tx_channels = {}; + for (i = 0; i < s->tx_num_channels; i++) + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_TX)) + tx_channels.push_back(i); + s->txStream.push_back(s->iris[r]->setupStream(SOAPY_SDR_TX, SOAPY_SDR_CS16, tx_channels)); //, arg)); + //s->iris[r]->setHardwareTime(0, ""); + + std::cout << "Front end detected: " << s->iris[r]->getHardwareInfo()["frontend"] << "\n"; + for (i = 0; i < s->rx_num_channels; i++) { + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_RX)) { + printf("RX Channel %lu\n", i); + printf("Actual RX sample rate: %fMSps...\n", (s->iris[r]->getSampleRate(SOAPY_SDR_RX, i) / 1e6)); + printf("Actual RX frequency: %fGHz...\n", (s->iris[r]->getFrequency(SOAPY_SDR_RX, i) / 1e9)); + printf("Actual RX gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i))); + printf("Actual RX LNA gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i, "LNA"))); + printf("Actual RX PGA gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i, "PGA"))); + printf("Actual RX TIA gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i, "TIA"))); + if (s->iris[r]->getHardwareInfo()["frontend"].compare(devFE) != 0) { + printf("Actual RX LNA1 gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i, "LNA1"))); + printf("Actual RX LNA2 gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_RX, i, "LNA2"))); + } + printf("Actual RX bandwidth: %fM...\n", (s->iris[r]->getBandwidth(SOAPY_SDR_RX, i) / 1e6)); + printf("Actual RX antenna: %s...\n", (s->iris[r]->getAntenna(SOAPY_SDR_RX, i).c_str())); + } + } + + for (i = 0; i < s->tx_num_channels; i++) { + if (i < s->iris[r]->getNumChannels(SOAPY_SDR_TX)) { + printf("TX Channel %lu\n", i); + printf("Actual TX sample rate: %fMSps...\n", (s->iris[r]->getSampleRate(SOAPY_SDR_TX, i) / 1e6)); + printf("Actual TX frequency: %fGHz...\n", (s->iris[r]->getFrequency(SOAPY_SDR_TX, i) / 1e9)); + printf("Actual TX gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i))); + printf("Actual TX PAD gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i, "PAD"))); + printf("Actual TX IAMP gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i, "IAMP"))); + if (s->iris[r]->getHardwareInfo()["frontend"].compare(devFE) != 0) { + printf("Actual TX PA1 gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i, "PA1"))); + printf("Actual TX PA2 gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i, "PA2"))); + printf("Actual TX PA3 gain: %f...\n", (s->iris[r]->getGain(SOAPY_SDR_TX, i, "PA3"))); + } + printf("Actual TX bandwidth: %fM...\n", (s->iris[r]->getBandwidth(SOAPY_SDR_TX, i) / 1e6)); + printf("Actual TX antenna: %s...\n", (s->iris[r]->getAntenna(SOAPY_SDR_TX, i).c_str())); + } + } + } + s->iris[0]->writeSetting("SYNC_DELAYS", ""); + for (r = 0; r < s->device_num; r++) + s->iris[r]->setHardwareTime(0, "TRIGGER"); + s->iris[0]->writeSetting("TRIGGER_GEN", ""); + for (r = 0; r < s->device_num; r++) + printf("Device timestamp: %f...\n", (s->iris[r]->getHardwareTime("TRIGGER") / 1e9)); + + device->priv = s; + device->trx_start_func = trx_iris_start; + device->trx_write_func = trx_iris_write; + device->trx_read_func = trx_iris_read; + device->trx_get_stats_func = trx_iris_get_stats; + device->trx_reset_stats_func = trx_iris_reset_stats; + device->trx_end_func = trx_iris_end; + device->trx_stop_func = trx_iris_stop; + device->trx_set_freq_func = trx_iris_set_freq; + device->trx_set_gains_func = trx_iris_set_gains; + device->openair0_cfg = openair0_cfg; + + s->sample_rate = openair0_cfg[0].sample_rate; + // TODO: + // init tx_forward_nsamps based iris_time_offset ex + if (is_equal(s->sample_rate, (double) 30.72e6)) + s->tx_forward_nsamps = 176; + if (is_equal(s->sample_rate, (double) 15.36e6)) + s->tx_forward_nsamps = 90; + if (is_equal(s->sample_rate, (double) 7.68e6)) + s->tx_forward_nsamps = 50; + + LOG_I(HW, "Finished initializing %d Iris device(s).\n", s->device_num); + fflush(stdout); + return 0; +} +} +/*@}*/ + + + + + diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index e1a1b768b2..1f0d78aba5 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -193,7 +193,7 @@ int trx_lms_start(openair0_device *device){ LMS_EnableChannel(lms_device,LMS_CH_RX,1,true); LMS_EnableChannel(lms_device,LMS_CH_TX,1,true); } */ - LMS_VCTCXOWrite(lms_device,129); + LMS_VCTCXOWrite(lms_device,129, true); if (LMS_SetSampleRate(lms_device,device->openair0_cfg->sample_rate,2)!=0) { diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c index 32fddb9c2d..b0f131de91 100644 --- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c +++ b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c @@ -8,33 +8,47 @@ #include #include -int fullread(int fd, void *_buf, int count) -{ +const int port = 4043; +#define helpTxt "\ +\x1b[31m\ +tcp_bridge: error: you have to run one UE and one eNB\n\ +For this, export TCPBRIDGE=enb (eNB case) or \n\ + TCPBRIDGE= (UE case)\n\ +\x1b[m" + +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; } -int fullwrite(int fd, void *_buf, int count) -{ +int fullwrite(int fd, void *_buf, int count) { char *buf = _buf; int ret = 0; int l; + while (count) { l = write(fd, buf, count); + if (l <= 0) return -1; + count -= l; buf += l; ret += l; } + return ret; } @@ -46,155 +60,208 @@ typedef struct { uint64_t timestamp; uint64_t next_tx_timestamp; int is_enb; + char *ip; } tcp_bridge_state_t; -void verify_connection(int fd, int is_enb) -{ +void verify_connection(int fd, int is_enb) { char c = is_enb; + if (fullwrite(fd, &c, 1) != 1) exit(1); + if (fullread(fd, &c, 1) != 1) exit(1); + if (c == is_enb) { - printf("\x1b[31mtcp_bridge: error: you have to run one UE and one eNB" - " (did you run 'export ENODEB=1' in the eNB terminal?)\x1b[m\n"); + printf(helpTxt); exit(1); } } -int tcp_bridge_start(openair0_device *device) -{ - int port = 4043; - tcp_bridge_state_t *tcp_bridge = device->priv; - int try; - int max_try = 5; - - int sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock == -1) { perror("tcp_bridge: socket"); exit(1); } - - int enable = 1; - if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int))) - { perror("tcp_bridge: SO_REUSEADDR"); exit(1); } +int start_enb(tcp_bridge_state_t *tcp_bridge) { struct sockaddr_in addr = { - sin_family: AF_INET, - sin_port: htons(port), - sin_addr: { s_addr: INADDR_ANY } +sin_family: + AF_INET, +sin_port: + htons(port), +sin_addr: + { s_addr: INADDR_ANY } }; - if (bind(sock, (struct sockaddr *)&addr, sizeof(addr))) { - if (errno == EADDRINUSE) goto client_mode; - { perror("tcp_bridge: bind"); exit(1); } + if (bind(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr))) { + perror("tcp_bridge: bind"); + exit(1); } - if (listen(sock, 5)) - { perror("tcp_bridge: listen"); exit(1); } + if (listen(tcp_bridge->sock, 5)) { + perror("tcp_bridge: listen"); + exit(1); + } printf("tcp_bridge: wait for connection on port %d\n", port); - socklen_t len = sizeof(addr); - int sock2 = accept(sock, (struct sockaddr *)&addr, &len); - if (sock2 == -1) - { perror("tcp_bridge: accept"); exit(1); } + int sockServ = accept(tcp_bridge->sock, (struct sockaddr *)&addr, &len); - close(sock); - - tcp_bridge->sock = sock2; + if ( sockServ == -1) { + perror("tcp_bridge: accept"); + exit(1); + } + verify_connection(sockServ, tcp_bridge->is_enb); printf("tcp_bridge: connection established\n"); - - verify_connection(sock2, tcp_bridge->is_enb); - + close(tcp_bridge->sock); + tcp_bridge->sock=sockServ; return 0; +} -client_mode: - addr.sin_addr.s_addr = inet_addr("127.0.0.1"); +int start_ue(tcp_bridge_state_t *tcp_bridge) { +struct sockaddr_in addr = {sin_family: + AF_INET, +sin_port: + htons(port), +sin_addr: + { s_addr: INADDR_ANY } + }; + addr.sin_addr.s_addr = inet_addr(tcp_bridge->ip); - for (try = 0; try < max_try; try++) { - if (try != 0) sleep(1); + while(1) { + printf("tcp_bridge: trying to connect to %s:%d\n", tcp_bridge->ip, port); - printf("tcp_bridge: trying to connect to 127.0.0.1:%d (attempt %d/%d)\n", - port, try+1, max_try); - - if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) { + if (connect(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) { + verify_connection(tcp_bridge->sock, tcp_bridge->is_enb); printf("tcp_bridge: connection established\n"); - tcp_bridge->sock = sock; - verify_connection(sock, tcp_bridge->is_enb); return 0; } perror("tcp_bridge"); + sleep(1); } - printf("tcp_bridge: connection failed\n"); - - exit(1); + return 0; } -int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; } -int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; } -int tcp_bridge_get_stats(openair0_device* device) { return 0; } -int tcp_bridge_reset_stats(openair0_device* device) { return 0; } +int tcp_bridge_start(openair0_device *device) { + tcp_bridge_state_t *tcp_bridge = device->priv; + tcp_bridge->sock = socket(AF_INET, SOCK_STREAM, 0); + + if (tcp_bridge->sock == -1) { + perror("tcp_bridge: socket"); + exit(1); + } + + int enable = 1; + + if (setsockopt(tcp_bridge->sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int))) { + perror("tcp_bridge: SO_REUSEADDR"); + exit(1); + } + + if ( tcp_bridge->is_enb ) + return start_enb(tcp_bridge); + else + return start_ue(tcp_bridge); +} + +int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) { + abort(); + return 0; +} +int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) { + abort(); + return 0; +} +int tcp_bridge_get_stats(openair0_device *device) { + return 0; +} +int tcp_bridge_reset_stats(openair0_device *device) { + return 0; +} void tcp_bridge_end(openair0_device *device) {} -int tcp_bridge_stop(openair0_device *device) { return 0; } -int tcp_bridge_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { return 0; } -int tcp_bridge_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { return 0; } +int tcp_bridge_stop(openair0_device *device) { + return 0; +} +int tcp_bridge_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { + return 0; +} +int tcp_bridge_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) { + return 0; +} + +int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) { + if (cc != 1) { + printf("tcp_bridge: only 1 antenna supported\n"); + exit(1); + } -int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) -{ - if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); } tcp_bridge_state_t *t = device->priv; + /* deal with discontinuities in output (think: eNB in TDD mode) */ if (t->next_tx_timestamp && timestamp != t->next_tx_timestamp) { uint32_t b[4096]; uint64_t to_send = timestamp - t->next_tx_timestamp; memset(b, 0, 4096 * sizeof(uint32_t)); + while (to_send) { int len = to_send > 4096 ? 4096 : to_send; int n = fullwrite(t->sock, b, len * 4); + if (n != len * 4) { printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); abort(); } + to_send -= len; } } + int n = fullwrite(t->sock, buff[0], nsamps * 4); + if (n != nsamps * 4) { printf("tcp_bridge: write error ret %d (wanted %d) error %s\n", n, nsamps*4, strerror(errno)); abort(); } + t->next_tx_timestamp = timestamp + nsamps; return nsamps; } -int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) -{ - if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); } +int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { + if (cc != 1) { + printf("tcp_bridge: only 1 antenna supported\n"); + exit(1); + } + tcp_bridge_state_t *t = device->priv; int n = fullread(t->sock, buff[0], nsamps * 4); + if (n != nsamps * 4) { printf("tcp_bridge: read error ret %d nsamps*4 %d error %s\n", n, nsamps * 4, strerror(errno)); abort(); } + *timestamp = t->timestamp; t->timestamp += nsamps; return nsamps; } -int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) -{ - if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); } +int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { + if (cc != 1) { + printf("tcp_bridge: only 1 antenna supported\n"); + exit(1); + } + tcp_bridge_state_t *t = device->priv; int n; /* In synch mode, UE does not write, but we need to - * send something to the eNodeB. - * We know that UE is in synch mode when it reads - * 10 subframes at a time. - */ + send something to the eNodeB. + We know that UE is in synch mode when it reads + 10 subframes at a time. + */ if (nsamps == t->samples_per_subframe * 10) { uint32_t b[nsamps]; memset(b, 0, nsamps * 4); n = fullwrite(t->sock, b, nsamps * 4); + if (n != nsamps * 4) { printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); abort(); @@ -205,96 +272,106 @@ int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, v } /* To startup proper communcation between eNB and UE, - * we need to understand that: - * - eNodeB starts reading subframe 0 - * - then eNodeB starts sending subframe 4 - * and then repeats read/write for each subframe. - * The UE: - * - reads 10 subframes at a time until it is synchronized - * - then reads subframe n and writes subframe n+2 - * We also want to enforce that the subframe 0 is read - * at the beginning of the UE RX buffer, not in the middle - * of it. - * So it means: - * - for the eNodeB: let it run as in normal mode (as with a B210) - * - for the UE, on its very first read: - * - we want this read to get data from subframe 0 - * but the first write of eNodeB is subframe 4 - * so we first need to read and ignore 6 subframes - * - the UE will start its TX only at the subframe 2 - * corresponding to the subframe 0 it just read, - * so we need to write 12 subframes before anything - * (the function tcp_bridge_read_ue takes care to - * insert dummy TX data during the synch phase) - * - * Here is a drawing of the beginning of things to make - * this logic clearer. - * - * We see that eNB starts RX at subframe 0, starts TX at subfram 4, - * and that UE starts RX at subframe 10 and TX at subframe 12. - * - * We understand that the UE has to transmit 12 empty - * subframes for the eNodeB to start its processing. - * - * And because the eNodeB starts its TX at subframe 4 and we - * want the UE to start its RX at subframe 10, we need to - * read and ignore 6 subframes in the UE. - * - * ------------------------------------------------------------------------- - * eNB RX: | *0* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... - * ------------------------------------------------------------------------- - * - * ------------------------------------------------------------------------- - * eNB TX: | 0 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... - * ------------------------------------------------------------------------- - * - * ------------------------------------------------------------------------- - * UE RX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *10* | 11 | 12 | 13 | 14 ... - * ------------------------------------------------------------------------- - * - * ------------------------------------------------------------------------- - * UE TX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | *12* | 13 | 14 ... - * ------------------------------------------------------------------------- - * - * As a final note, we do TX before RX to ensure that the eNB will - * get some data and send us something so there is no deadlock - * at the beginning of things. Hopefully the kernel buffers for - * the sockets are big enough so that the first (big) TX can - * return to user mode before the buffers are full. If this - * is wrong in some environment, we will need to work by smaller - * units of data at a time. - */ -int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) -{ - if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); } - tcp_bridge_state_t *t = device->priv; + we need to understand that: + - eNodeB starts reading subframe 0 + - then eNodeB starts sending subframe 4 + and then repeats read/write for each subframe. + The UE: + - reads 10 subframes at a time until it is synchronized + - then reads subframe n and writes subframe n+2 + We also want to enforce that the subframe 0 is read + at the beginning of the UE RX buffer, not in the middle + of it. + So it means: + - for the eNodeB: let it run as in normal mode (as with a B210) + - for the UE, on its very first read: + - we want this read to get data from subframe 0 + but the first write of eNodeB is subframe 4 + so we first need to read and ignore 6 subframes + - the UE will start its TX only at the subframe 2 + corresponding to the subframe 0 it just read, + so we need to write 12 subframes before anything + (the function tcp_bridge_read_ue takes care to + insert dummy TX data during the synch phase) + Here is a drawing of the beginning of things to make + this logic clearer. + + We see that eNB starts RX at subframe 0, starts TX at subfram 4, + and that UE starts RX at subframe 10 and TX at subframe 12. + + We understand that the UE has to transmit 12 empty + subframes for the eNodeB to start its processing. + + And because the eNodeB starts its TX at subframe 4 and we + want the UE to start its RX at subframe 10, we need to + read and ignore 6 subframes in the UE. + + ------------------------------------------------------------------------- + eNB RX: | *0* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... + ------------------------------------------------------------------------- + + ------------------------------------------------------------------------- + eNB TX: | 0 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 ... + ------------------------------------------------------------------------- + + ------------------------------------------------------------------------- + UE RX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *10* | 11 | 12 | 13 | 14 ... + ------------------------------------------------------------------------- + + ------------------------------------------------------------------------- + UE TX: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | *12* | 13 | 14 ... + ------------------------------------------------------------------------- + + As a final note, we do TX before RX to ensure that the eNB will + get some data and send us something so there is no deadlock + at the beginning of things. Hopefully the kernel buffers for + the sockets are big enough so that the first (big) TX can + return to user mode before the buffers are full. If this + is wrong in some environment, we will need to work by smaller + units of data at a time. +*/ +int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) { + if (cc != 1) { + printf("tcp_bridge: only 1 antenna supported\n"); + exit(1); + } + + tcp_bridge_state_t *t = device->priv; uint32_t b[t->samples_per_subframe * 12]; memset(b, 0, t->samples_per_subframe * 12 * 4); int n = fullwrite(t->sock, b, t->samples_per_subframe * 12 * 4); + if (n != t->samples_per_subframe * 12 * 4) { printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); abort(); } + n = fullread(t->sock, b, t->samples_per_subframe * 6 * 4); + if (n != t->samples_per_subframe * 6 * 4) { printf("tcp_bridge: read error ret %d error %s\n", n, strerror(errno)); abort(); } device->trx_read_func = tcp_bridge_read_ue; - return tcp_bridge_read_ue(device, timestamp, buff, nsamps, cc); } __attribute__((__visibility__("default"))) -int device_init(openair0_device* device, openair0_config_t *openair0_cfg) -{ - tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t*)malloc(sizeof(tcp_bridge_state_t)); - memset(tcp_bridge, 0, sizeof(tcp_bridge_state_t)); +int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { + tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t *)calloc(sizeof(tcp_bridge_state_t),1); - tcp_bridge->is_enb = getenv("ENODEB") != NULL; + if ((tcp_bridge->ip=getenv("TCPBRIDGE")) == NULL ) { + /* for compatibility, we test the ENB environment variable */ + if ((tcp_bridge->ip=getenv("ENODEB")) != NULL ) { + tcp_bridge->ip=strdup("enb"); + } else { + tcp_bridge->ip=strdup("127.0.0.1"); + } + } + tcp_bridge->is_enb = strncasecmp(tcp_bridge->ip,"enb",3) == 0; printf("tcp_bridge: running as %s\n", tcp_bridge->is_enb ? "eNB" : "UE"); /* only 25, 50 or 100 PRBs handled for the moment */ @@ -323,15 +400,21 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg) device->priv = tcp_bridge; switch ((int)openair0_cfg[0].sample_rate) { - case 30720000: tcp_bridge->samples_per_subframe = 30720; break; - case 15360000: tcp_bridge->samples_per_subframe = 15360; break; - case 7680000: tcp_bridge->samples_per_subframe = 7680; break; + case 30720000: + tcp_bridge->samples_per_subframe = 30720; + break; + + case 15360000: + tcp_bridge->samples_per_subframe = 15360; + break; + + case 7680000: + tcp_bridge->samples_per_subframe = 7680; + break; } /* let's pretend to be a b2x0 */ device->type = USRP_B200_DEV; - device->openair0_cfg=&openair0_cfg[0]; - return 0; } diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 0d306ee50b..2c27cc29e8 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -23,6 +23,7 @@ # include "intertask_interface.h" # include "create_tasks.h" # include "common/utils/LOG/log.h" +# include "targets/RT/USER/lte-softmodem.h" # ifdef OPENAIR2 # if defined(ENABLE_USE_MME) @@ -32,7 +33,12 @@ # include "nas_ue_task.h" # include "udp_eNB_task.h" # include "gtpv1u_eNB_task.h" +/* temporary warning removale while implementing noS1 */ +/* as config option */ # else +# ifdef EPC_MODE_ENABLED +# undef EPC_MODE_ENABLED +# endif # define EPC_MODE_ENABLED 0 # endif # if ENABLE_RAL @@ -43,7 +49,6 @@ # endif # include "enb_app.h" -extern int emulate_rf; int create_tasks(uint32_t enb_nb) { @@ -79,7 +84,7 @@ int create_tasks(uint32_t enb_nb) LOG_E(S1AP, "Create task for S1AP failed\n"); return -1; } - if(!emulate_rf){ + if(!(get_softmodem_params()->emulate_rf)){ if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { LOG_E(UDP_, "Create task for UDP failed\n"); return -1; diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index 1c27f65585..644952ca79 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -5,8 +5,18 @@ # define NUMBER_OF_eNB_MAX 1 # define NUMBER_OF_RU_MAX 2 # ifndef UE_EXPANSION +// TODO:L2 FAPI simulator. +// UESIM_EXPANSION is used to be same value of NUMBER_OF_UE_MAX +// in eNB and UE. +// now , if we use --mu option in UE, compiling error will occur. +// This problem will be fixed in the future. +# ifndef UESIM_EXPANSION # define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# else +# define NUMBER_OF_UE_MAX 256 +# define NUMBER_OF_CONNECTED_eNB_MAX 1 +# endif # else # define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_CONNECTED_eNB_MAX 1 @@ -15,8 +25,18 @@ # define NUMBER_OF_eNB_MAX 7 # define NUMBER_OF_RU_MAX 32 # ifndef UE_EXPANSION -# define NUMBER_OF_UE_MAX 20 +/* if the value of MAX_MOBILES_PER_ENB and NUMBER_OF_UE_MAX is different, +eNB process will exit because unexpected access happens. +Now some parts are using NUMBER_OF_UE_MAX +and the other are using MAX_MOBILES_PER_ENB in for-loop. +*/ +# ifndef UESIM_EXPANSION +# define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# else +# define NUMBER_OF_UE_MAX 256 +# define NUMBER_OF_CONNECTED_eNB_MAX 1 +# endif # else # define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_CONNECTED_eNB_MAX 1 diff --git a/targets/DOCS/api_icic.xml b/targets/DOCS/api_icic.xml deleted file mode 100644 index 80984fb236..0000000000 --- a/targets/DOCS/api_icic.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - SBMAP_CONF - openair2/LAYER2/MAC/defs.h - - sbmap[13] - unsigned char - subband map indicates to scheduler allowed SB for eNB - - - periodicity - unsigned char - in millisecond indicate update instant - - - first_subframe - unsigned char - ... - - - sb_size - unsigned char - number of PRB in this subband - - - nb_active_sb - unsigned char - indicates the number of set subbands - - - - - eNB_MAC_INST - openair2/LAYER2/MAC/defs.h - - ... - - - sbmap_conf - SBMAP_CONF - subband map configuration for each eNB - - openair2/LAYER2/MAC/main.c - mac_top_init - - - - MAC_xface - openair2/PHY_INTERFACE/defs.h - - ... - - - (*get_SB_size)(unsigned char) - function pointer n - return the number of PRB supported in a subband configuration - - openair2/LAYER2/MAC/main.c - l2_init - - - - Get_Cell_SBMap - unsigned char Mod_id - void - openair2/LAYER2/MAC/defs.h - openair2/LAYER2/MAC/eNB_scheduler.c - imlements ICIC algo - - - Get_SB_size - unsigned char n_rb_dl - unsigned char - openair1/PHY/LTE_TRANSPORT/proto.h - openair1/PHY/LTE_TRANSPORT/lte_mcs.c - return the number of PRB supported in a subband configuration. - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/targets/DOCS/oaiemu.doc b/targets/DOCS/oaiemu.doc deleted file mode 100644 index 13433a5f35..0000000000 Binary files a/targets/DOCS/oaiemu.doc and /dev/null differ diff --git a/targets/DOCS/oaisim_walkthrough.pdf b/targets/DOCS/oaisim_walkthrough.pdf deleted file mode 100644 index b6d766e7f6..0000000000 Binary files a/targets/DOCS/oaisim_walkthrough.pdf and /dev/null differ diff --git a/targets/DOCS/openair_header.tex b/targets/DOCS/openair_header.tex deleted file mode 100755 index 14e1baee5a..0000000000 --- a/targets/DOCS/openair_header.tex +++ /dev/null @@ -1,47 +0,0 @@ -\documentclass[a4paper]{book} -\usepackage{a4wide} -\usepackage{makeidx} -\usepackage{fancyhdr} -\usepackage{graphicx} -\usepackage{multicol} -\usepackage{float} -\usepackage{textcomp} -\usepackage{alltt} -\usepackage{amsmath} -\usepackage{amssymb} -\ifx\pdfoutput\undefined -\usepackage[ps2pdf, - pagebackref=true, - colorlinks=true, - linkcolor=blue - ]{hyperref} -\usepackage{pspicture} -\else -\usepackage[pdftex, - pagebackref=true, - colorlinks=true, - linkcolor=blue - ]{hyperref} -\fi -\usepackage{doxygen} -\usepackage{times} -\makeindex -\setcounter{tocdepth}{1} -\renewcommand{\footrulewidth}{0.4pt} -\begin{document} -\begin{titlepage} -\vspace*{7cm} -\begin{center} -{\Large openair Specifications }\\ -Phyiscal, Medium-Access, Radio-link Control, Packet Data Convergence Protocol and Radio Resource Control Layers\\ -\vspace*{1cm} -{\large Generated by Doxygen 1.3.8}\\ -\vspace*{0.5cm} -{\small Sun Oct 31 19:27:37 2004}\\ -\end{center} -\end{titlepage} -\clearemptydoublepage -\pagenumbering{roman} -\tableofcontents -\clearemptydoublepage -\pagenumbering{arabic} diff --git a/targets/DOCS/path_loss_oaisim.xlsx b/targets/DOCS/path_loss_oaisim.xlsx deleted file mode 100644 index 2ba25b466b..0000000000 Binary files a/targets/DOCS/path_loss_oaisim.xlsx and /dev/null differ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf new file mode 100644 index 0000000000..77993457ab --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf @@ -0,0 +1,264 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 38; + downlink_frequency = 2580000000L; + uplink_frequency_offset = 0; + Nid_cell = 10; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 52; # [~50 for DEV-FE, ~30 for CBRS-FE] + rx_gain = 115; # [115 for DEV-FE, 90 for CBRS-FE] + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -30; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -70; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -96; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "127.0.0.20"; + ipv6 = "fe80::d65d:dfff:fe1d:f4d4"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.10/8"; + ENB_INTERFACE_NAME_FOR_S1U = "enp5s0"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.10/8"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.10/8"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 200; + puCch10xSnr = 200; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + eNB_instances = [0]; + #sdr_addrs = "RF3C000025"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf new file mode 100644 index 0000000000..764d7886e2 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf @@ -0,0 +1,264 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + tdd_config = 1; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 42; + downlink_frequency = 3500000000L; + uplink_frequency_offset = 0; + Nid_cell = 10; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 48; # [~50 for DEV-FE, ~30 for CBRS-FE] + rx_gain = 80; # [115 for DEV-FE, 90 for CBRS-FE] + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -30; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -70; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -96; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "127.0.0.20"; + ipv6 = "fe80::d65d:dfff:fe1d:f4d4"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.10/8"; + ENB_INTERFACE_NAME_FOR_S1U = "enp5s0"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.10/8"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.10/8"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 200; + puCch10xSnr = 200; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 44; #apparently this is being used as tx_gain... + att_rx = 0; #apparently max_rxgain - att_rx -83 is what is used for rx_gain (at least for 5 MHz) + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 107; + eNB_instances = [0]; + #sdr_addrs = "RF3E000025"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf index 60b47c5c49..728492ee83 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf @@ -15,7 +15,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ); tr_s_preference = "local_mac" @@ -138,7 +138,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + mme_ip_address = ( { ipv4 = "192.168.12.148"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -187,7 +187,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 116; eNB_instances = [0]; - + sdr_addrs = "type=x300"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf new file mode 100644 index 0000000000..ca85c6538f --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf @@ -0,0 +1,264 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 10; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 52; # [~50 for DEV-FE, ~30 for CBRS-FE] + rx_gain = 115; # [115 for DEV-FE, 90 for CBRS-FE] + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -30; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -70; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -96; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "127.0.0.20"; + ipv6 = "fe80::d65d:dfff:fe1d:f4d4"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.10/8"; + ENB_INTERFACE_NAME_FOR_S1U = "lo"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.10/8"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.10/8"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 200; + puCch10xSnr = 200; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + eNB_instances = [0]; + sdr_addrs = "RF3E000028"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf index ced031163d..472d84c7e2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf @@ -172,7 +172,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "127.0.0.3"; + mme_ip_address = ( { ipv4 = "192.168.12.26"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -181,14 +181,24 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; - ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 + #ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + #ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; + #ENB_INTERFACE_NAME_FOR_S1U = "lo"; + #ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; + #ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + #ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + #ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + ENB_INTERFACE_NAME_FOR_S1_MME = "enp0s31f6"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.188/24"; + ENB_INTERFACE_NAME_FOR_S1U = "enp0s31f6"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.188/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.188/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; } ); @@ -196,7 +206,7 @@ eNBs = MACRLCs = ( { num_cc = 1; - local_s_if_name = "lo"; + local_s_if_name = "lo:"; remote_s_address = "127.0.0.1"; local_s_address = "127.0.0.2"; local_s_portc = 50001; diff --git a/targets/RT/USER/.ue.nvram b/targets/RT/USER/.ue.nvram deleted file mode 100644 index 17469c87ad..0000000000 Binary files a/targets/RT/USER/.ue.nvram and /dev/null differ diff --git a/targets/RT/USER/.ue_emm.nvram b/targets/RT/USER/.ue_emm.nvram deleted file mode 100644 index e858ba8cce..0000000000 Binary files a/targets/RT/USER/.ue_emm.nvram and /dev/null differ diff --git a/targets/RT/USER/.usim.nvram b/targets/RT/USER/.usim.nvram deleted file mode 100644 index 4e9adcd0d3..0000000000 Binary files a/targets/RT/USER/.usim.nvram and /dev/null differ diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 14024018d8..16c3fc55aa 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -89,16 +89,16 @@ #ifndef OPENAIR2 -#include "UTIL/OTG/otg_extern.h" + #include "UTIL/OTG/otg_extern.h" #endif #if defined(ENABLE_ITTI) -# if defined(ENABLE_USE_MME) -# include "s1ap_eNB.h" -#ifdef PDCP_USE_NETLINK -# include "SIMULATION/ETH_TRANSPORT/proto.h" -#endif -# endif + #if defined(ENABLE_USE_MME) + #include "s1ap_eNB.h" + #ifdef PDCP_USE_NETLINK + #include "SIMULATION/ETH_TRANSPORT/proto.h" + #endif + #endif #endif #include "T.h" @@ -118,8 +118,8 @@ struct timing_info_t { #if defined(ENABLE_ITTI) -extern volatile int start_eNB; -extern volatile int start_UE; + extern volatile int start_eNB; + extern volatile int start_UE; #endif extern volatile int oai_exit; @@ -158,11 +158,9 @@ void stop_eNB(int nb_inst); int wakeup_tx(PHY_VARS_eNB *eNB); int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB); void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); #endif -extern PARALLEL_CONF_t get_thread_parallel_conf(void); -extern WORKER_CONF_t get_thread_worker_conf(void); extern uint8_t nfapi_mode; extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); @@ -174,15 +172,21 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name) { start_meas(&softmodem_stats_rxtx_sf); -LOG_I(PHY,"ENTERED rxtx\n"); - if (nfapi_mode == 1) { + //L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx; + + // ******************************************************************* + +#if defined(PRE_SCD_THREAD) + RU_t *ru = RC.ru[0]; +#endif + + + if (nfapi_mode == 1) { // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick uint16_t frame = proc->frame_rx; uint16_t subframe = proc->subframe_rx; - //add_subframe(&frame, &subframe, 4); - //oai_subframe_ind(proc->frame_tx, proc->subframe_tx); //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe); start_meas(&nfapi_meas); @@ -195,14 +199,14 @@ LOG_I(PHY,"ENTERED rxtx\n"); eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles || eNB->UL_INFO.cqi_ind.number_of_cqis ) { - LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d preambles:%05d:%d cqis:%d] RX:%04d%d TX:%04d%d num_pdcch_symbols:%d\n", - NFAPI_SFNSF2DEC(eNB->UL_INFO.rx_ind.sfn_sf), eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, - NFAPI_SFNSF2DEC(eNB->UL_INFO.harq_ind.sfn_sf), eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, - NFAPI_SFNSF2DEC(eNB->UL_INFO.crc_ind.sfn_sf), eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, - NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf), eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles, - eNB->UL_INFO.cqi_ind.number_of_cqis, - proc->frame_rx, proc->subframe_rx, - proc->frame_tx, proc->subframe_tx, eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols); + LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d preambles:%05d:%d cqis:%d] RX:%04d%d TX:%04d%d num_pdcch_symbols:%d\n", + NFAPI_SFNSF2DEC(eNB->UL_INFO.rx_ind.sfn_sf), eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus, + NFAPI_SFNSF2DEC(eNB->UL_INFO.harq_ind.sfn_sf), eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs, + NFAPI_SFNSF2DEC(eNB->UL_INFO.crc_ind.sfn_sf), eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, + NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf), eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles, + eNB->UL_INFO.cqi_ind.number_of_cqis, + proc->frame_rx, proc->subframe_rx, + proc->frame_tx, proc->subframe_tx, eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols); } } @@ -213,13 +217,12 @@ LOG_I(PHY,"ENTERED rxtx\n"); // **************************************** // Common RX procedures subframe n - T(T_ENB_PHY_DL_TICK, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(proc->subframe_tx)); // if this is IF5 or 3GPP_eNB if (eNB && eNB->RU_list && eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) { wakeup_prach_eNB(eNB,NULL,proc->frame_rx,proc->subframe_rx); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx); #endif } @@ -230,102 +233,108 @@ LOG_I(PHY,"ENTERED rxtx\n"); if (nfapi_mode == 0 || nfapi_mode == 1) { phy_procedures_eNB_uespec_RX(eNB, proc); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 ); -/*//#TODO - if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) - { - if (pthread_mutex_lock(mutex) != 0) { - LOG_E(PHY, "[SCHED][eNB] ERROR locking mutex for eNB L1_thread_tx\n"); - exit_fun("ERROR pthread_lock"); - return(-1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 ); + +#if defined(PRE_SCD_THREAD) + if (nfapi_mode == 2){ + new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use; + dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use; + +// L2-emulator can work only one eNB. +// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); +// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); + memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + + if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) { + LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n"); + exit_fun("error locking mutex_time"); + } + + ru->proc.instance_pre_scd++; + + if (ru->proc.instance_pre_scd == 0) { + if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" ); + exit_fun( "ERROR pthread_cond_signal cond_pre_scd" ); + } + }else{ + LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n", + proc->frame_rx,proc->subframe_rx,ru->proc.instance_pre_scd ); + } + + if (pthread_mutex_unlock(&ru->proc.mutex_pre_scd)!= 0) { + LOG_E( PHY, "[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n"); + exit_fun("error unlocking mutex_pre_scd"); + } } - while(L1_proc_tx->instance_cnt == 0){ - pthread_cond_wait(L1_proc_tx->cond,L1_proc_tx->mutex); - } - L1_proc_tx->instance_cnt = 0; - if (pthread_cond_signal(&L1_proc_tx->cond) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB L1_thread_tx\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return(-1); - } - if (pthread_mutex_unlock(mutex) != 0) { - LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name); - exit_fun("ERROR pthread_unlock"); - return(-1); - } - }*/ - +#endif pthread_mutex_lock(&eNB->UL_INFO_mutex); - eNB->UL_INFO.frame = proc->frame_rx; eNB->UL_INFO.subframe = proc->subframe_rx; eNB->UL_INFO.module_id = eNB->Mod_id; eNB->UL_INFO.CC_id = eNB->CC_id; - eNB->if_inst->UL_indication(&eNB->UL_INFO); - pthread_mutex_unlock(&eNB->UL_INFO_mutex); /* this conflict resolution may be totally wrong, to be tested */ /* CONFLICT RESOLUTION: BEGIN */ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 0 ); + if(oai_exit) return(-1); - if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD){ + + if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) { #ifndef PHY_TX_THREAD phy_procedures_eNB_TX(eNB, proc, 1); #endif } + /* CONFLICT RESOLUTION: what about this release_thread call, has it to be done? if yes, where? */ //if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1); /* CONFLICT RESOLUTION: END */ - stop_meas( &softmodem_stats_rxtx_sf ); - LOG_I(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->subframe_rx, proc->frame_tx, proc->subframe_tx); + LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->subframe_rx, proc->frame_tx, proc->subframe_tx); + LOG_D(PHY, "rxtx:%lld nfapi:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", + softmodem_stats_rxtx_sf.p_time, nfapi_meas.p_time, + TICK_TO_US(eNB->phy_proc_tx), + TICK_TO_US(eNB->phy_proc_rx), + TICK_TO_US(eNB->rx_prach), + TICK_TO_US(eNB->ofdm_mod_stats) + ); - LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", - softmodem_stats_rxtx_sf.p_time, nfapi_meas.p_time, - TICK_TO_US(eNB->phy_proc), - TICK_TO_US(eNB->phy_proc_tx), - TICK_TO_US(eNB->phy_proc_rx), - TICK_TO_US(eNB->rx_prach), - TICK_TO_US(eNB->ofdm_mod_stats) - ); LOG_D(PHY, - "dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ", - TICK_TO_US(eNB->dlsch_encoding_stats), - TICK_TO_US(eNB->dlsch_modulation_stats), - TICK_TO_US(eNB->dlsch_scrambling_stats), - TICK_TO_US(eNB->dlsch_rate_matching_stats), - TICK_TO_US(eNB->dlsch_turbo_encoding_stats), - TICK_TO_US(eNB->dlsch_interleaving_stats), - TICK_TO_US(eNB->rx_dft_stats)); - + "dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ", + TICK_TO_US(eNB->dlsch_encoding_stats), + TICK_TO_US(eNB->dlsch_modulation_stats), + TICK_TO_US(eNB->dlsch_scrambling_stats), + TICK_TO_US(eNB->dlsch_rate_matching_stats), + TICK_TO_US(eNB->dlsch_turbo_encoding_stats), + TICK_TO_US(eNB->dlsch_interleaving_stats), + TICK_TO_US(eNB->rx_dft_stats)); LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld ", - TICK_TO_US(eNB->ulsch_channel_estimation_stats), - TICK_TO_US(eNB->ulsch_freq_offset_estimation_stats), - TICK_TO_US(eNB->ulsch_decoding_stats), - TICK_TO_US(eNB->ulsch_demodulation_stats), - TICK_TO_US(eNB->ulsch_rate_unmatching_stats)); - + TICK_TO_US(eNB->ulsch_channel_estimation_stats), + TICK_TO_US(eNB->ulsch_freq_offset_estimation_stats), + TICK_TO_US(eNB->ulsch_decoding_stats), + TICK_TO_US(eNB->ulsch_demodulation_stats), + TICK_TO_US(eNB->ulsch_rate_unmatching_stats)); LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld ", - TICK_TO_US(eNB->ulsch_turbo_decoding_stats), - TICK_TO_US(eNB->ulsch_deinterleaving_stats), - TICK_TO_US(eNB->ulsch_demultiplexing_stats), - TICK_TO_US(eNB->ulsch_llr_stats), - TICK_TO_US(eNB->ulsch_tc_init_stats)); - LOG_D(PHY, "tca:%lld tcb:%lld tcg:%lld tce:%lld l1:%lld l2:%lld]\n\n", - TICK_TO_US(eNB->ulsch_tc_alpha_stats), - TICK_TO_US(eNB->ulsch_tc_beta_stats), - TICK_TO_US(eNB->ulsch_tc_gamma_stats), - TICK_TO_US(eNB->ulsch_tc_ext_stats), - TICK_TO_US(eNB->ulsch_tc_intl1_stats), - TICK_TO_US(eNB->ulsch_tc_intl2_stats) - ); - + TICK_TO_US(eNB->ulsch_turbo_decoding_stats), + TICK_TO_US(eNB->ulsch_deinterleaving_stats), + TICK_TO_US(eNB->ulsch_demultiplexing_stats), + TICK_TO_US(eNB->ulsch_llr_stats), + TICK_TO_US(eNB->ulsch_tc_init_stats)); + LOG_D(PHY, "tca:%lld tcb:%lld tcg:%lld tce:%lld l1:%lld l2:%lld]\n\n", + TICK_TO_US(eNB->ulsch_tc_alpha_stats), + TICK_TO_US(eNB->ulsch_tc_beta_stats), + TICK_TO_US(eNB->ulsch_tc_gamma_stats), + TICK_TO_US(eNB->ulsch_tc_ext_stats), + TICK_TO_US(eNB->ulsch_tc_intl1_stats), + TICK_TO_US(eNB->ulsch_tc_intl2_stats) + ); return(0); } @@ -335,17 +344,16 @@ static void* L1_thread_tx(void* param) { L1_proc_t *eNB_proc = (L1_proc_t*)param; L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx; PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; - LOG_I(PHY,"ENTERED L1_thread_tx\n"); char thread_name[100]; sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1); thread_top_init(thread_name,1,470000,500000,500000); - - //wait_sync("tx_thread"); - - while (!oai_exit) { + //wait_sync("tx_thread"); + + while (!oai_exit) { if (wait_on_condition(&proc->mutex,&proc->cond,&proc->instance_cnt,thread_name)<0) break; - if (oai_exit) break; + if (oai_exit) break; + // ***************************************** // TX processing for subframe n+4 // run PHY TX procedures the one after the other for all CCs to avoid race conditions @@ -355,11 +363,12 @@ static void* L1_thread_tx(void* param) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_ENB,proc->subframe_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,proc->frame_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,proc->frame_rx); - phy_procedures_eNB_TX(eNB, proc, 1); + pthread_mutex_lock( &proc->mutex ); proc->instance_cnt = -1; + // the thread can now be woken up if (pthread_cond_signal(&proc->cond) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); @@ -383,38 +392,29 @@ static void* L1_thread( void* param ) { static int eNB_thread_rxtx_status; //L1_proc_t *eNB_proc = (L1_proc_t*)param; L1_rxtx_proc_t *proc; -LOG_I(PHY,"ENTERED L1_thread\n"); // Working if(nfapi_mode ==2){ - proc = (L1_rxtx_proc_t*)param; + proc = (L1_rxtx_proc_t*)param; } else{ - L1_proc_t *eNB_proc = (L1_proc_t*)param; - proc = &eNB_proc->L1_proc; + L1_proc_t *eNB_proc = (L1_proc_t*)param; + proc = &eNB_proc->L1_proc; } - PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; char thread_name[100]; - cpu_set_t cpuset; CPU_ZERO(&cpuset); - // set default return value eNB_thread_rxtx_status = 0; - sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1); thread_top_init(thread_name,1,470000,500000,500000); pthread_setname_np( pthread_self(),"rxtx processing"); LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid)); - - while (!oai_exit) { - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); @@ -422,38 +422,29 @@ LOG_I(PHY,"ENTERED L1_thread\n"); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu()); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx); - if (oai_exit) break; - if (eNB->CC_id==0) - { + if (eNB->CC_id==0) { if (rxtx(eNB,proc,thread_name) < 0) break; } + if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) phy_procedures_eNB_TX(eNB, proc, 1); if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break; if (nfapi_mode!=2){ if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB); - else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) - { - phy_procedures_eNB_TX(eNB, proc, 1); - wakeup_txfh(proc,eNB); - } + else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) wakeup_txfh(proc,eNB); } - } // while !oai_exit - // VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n"); - eNB_thread_rxtx_status = 0; return &eNB_thread_rxtx_status; } @@ -464,7 +455,6 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t L1_rxtx_proc_t *L1_proc = &proc->L1_proc; LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; RU_proc_t *ru_proc=&ru->proc; - proc->frame_rx = frame_rx; proc->subframe_rx = subframe_rx; @@ -485,66 +475,64 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t } int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { + RU_t *ru; RU_proc_t *ru_proc; + struct timespec wait; wait.tv_sec=0; wait.tv_nsec=5000000L; - LTE_DL_FRAME_PARMS *fp; - LOG_I(PHY,"ENTERED wakeup_txfh\n"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~inside wakeup_txfh %d.%d IC_RU = %d\n", proc->frame_tx, proc->subframe_tx, proc->instance_cnt_RUs); if(wait_on_condition(&proc->mutex_RUs,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")<0) { - LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", proc->frame_tx, proc->subframe_tx); - return(-1); + LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", proc->frame_tx, proc->subframe_tx); + return(-1); } pthread_mutex_lock(&eNB->proc.mutex_RU_tx); eNB->proc.RU_mask_tx = 0; pthread_mutex_unlock(&eNB->proc.mutex_RU_tx); if (release_thread(&proc->mutex_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")<0) return(-1); + for(int ru_id=0; ru_idnum_RU; ru_id++){ - ru_proc = &eNB->RU_list[ru_id]->proc; - fp = &eNB->RU_list[ru_id]->frame_parms; - if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)) continue; - // skip the RUs that are not synced - if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; } - - if(ru_proc == NULL) {return(0);} + ru_proc = &eNB->RU_list[ru_id]->proc; + fp = &eNB->RU_list[ru_id]->frame_parms; + if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)) continue; + // skip the RUs that are not synced + if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; } - if (ru_proc->instance_cnt_eNBs == 0) { - LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx); - return(-1); - } - if (pthread_mutex_timedlock(&ru_proc->mutex_eNBs,&wait) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", ru_proc->subframe_rx&1,ru_proc->instance_cnt_eNBs ); - exit_fun( "error locking mutex_eNB" ); - return(-1); - } - - ru_proc->instance_cnt_eNBs = 0; - ru_proc->timestamp_tx = proc->timestamp_tx; - ru_proc->subframe_tx = proc->subframe_tx; - ru_proc->frame_tx = proc->frame_tx; - - // the thread can now be woken up - if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return(-1); - } - pthread_mutex_unlock( &ru_proc->mutex_eNBs ); + if(ru_proc == NULL) {return(0);} + + if (ru_proc->instance_cnt_eNBs == 0) { + LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx); + return(-1); + } + if (pthread_mutex_timedlock(&ru_proc->mutex_eNBs,&wait) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", ru_proc->subframe_rx&1,ru_proc->instance_cnt_eNBs ); + exit_fun( "error locking mutex_eNB" ); + return(-1); + } + + ru_proc->instance_cnt_eNBs = 0; + ru_proc->timestamp_tx = proc->timestamp_tx; + ru_proc->subframe_tx = proc->subframe_tx; + ru_proc->frame_tx = proc->frame_tx; + + // the thread can now be woken up + if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + return(-1); + } + pthread_mutex_unlock( &ru_proc->mutex_eNBs ); } return(0); } int wakeup_tx(PHY_VARS_eNB *eNB) { + L1_proc_t *proc=&eNB->proc; - /* LTE_DL_FRAME_PARMS *fp; - fp = &eNB->frame_parms; -if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_UL)) return; - */ L1_rxtx_proc_t *L1_proc_tx = &proc->L1_proc_tx; L1_rxtx_proc_t *L1_proc = &proc->L1_proc; @@ -571,7 +559,7 @@ if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_ L1_proc_tx->subframe_tx = L1_proc->subframe_tx; L1_proc_tx->frame_tx = L1_proc->frame_tx; L1_proc_tx->timestamp_tx = L1_proc->timestamp_tx; - + // the thread can now be woken up if (pthread_cond_signal(&L1_proc_tx->cond) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); @@ -580,7 +568,6 @@ if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_ } pthread_mutex_unlock( &L1_proc_tx->mutex); - return(0); } @@ -588,6 +575,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { L1_proc_t *proc=&eNB->proc; RU_proc_t *ru_proc=&ru->proc; + L1_rxtx_proc_t *L1_proc=&proc->L1_proc; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; @@ -611,13 +599,13 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { exit_fun( "error locking mutex_rxtx" ); return(-1); } - + ++L1_proc->instance_cnt; // We have just received and processed the common part of a subframe, say n. // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired // transmitted timestamp of the next TX slot (first). - // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, + // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti, // and proc->subframe_tx = proc->subframe_rx+sf_ahead L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); @@ -632,9 +620,8 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { exit_fun( "ERROR pthread_cond_signal" ); return(-1); } - - pthread_mutex_unlock( &L1_proc->mutex); + pthread_mutex_unlock( &L1_proc->mutex); return(0); } @@ -646,60 +633,61 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) { if (ru!=NULL) { pthread_mutex_lock(&proc->mutex_RU_PRACH); - for (i=0;inum_RU;i++) { + + for (i=0; inum_RU; i++) { if (ru == eNB->RU_list[i]) { - LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach,eNB->num_RU); - //if ((proc->RU_mask_prach&(1< 0) - // LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information (PRACH) from RU %d (num_RU %d, mask %x) has not been served yet!\n", - // eNB->Mod_id,frame,subframe,ru->idx,eNB->num_RU,proc->RU_mask_prach); - proc->RU_mask_prach |= (1<RU_list[i]->state == RU_SYNC || eNB->RU_list[i]->wait_cnt > 0){ + LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach,eNB->num_RU); + + if ((proc->RU_mask_prach&(1< 0) + LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information (PRACH) from RU %d (num_RU %d, mask %x) has not been served yet!\n", + eNB->Mod_id,frame,subframe,ru->idx,eNB->num_RU,proc->RU_mask_prach); + proc->RU_mask_prach |= (1<RU_mask_prach != (1<num_RU)-1) { // not all RUs have provided their information so return pthread_mutex_unlock(&proc->mutex_RU_PRACH); return; - } - else { // all RUs have provided their information so continue on and wakeup eNB processing + } else { // all RUs have provided their information so continue on and wakeup eNB processing proc->RU_mask_prach = 0; pthread_mutex_unlock(&proc->mutex_RU_PRACH); } } - + // check if we have to detect PRACH first - if (is_prach_subframe(fp,frame,subframe)>0) { + if (is_prach_subframe(fp,frame,subframe)>0) { LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe); + if (proc->instance_cnt_prach == 0) { LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe); return; } - + // wake up thread for PRACH RX if (pthread_mutex_lock(&proc->mutex_prach) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach); exit_fun( "error locking mutex_prach" ); return; } - + ++proc->instance_cnt_prach; // set timing for prach thread proc->frame_prach = frame; proc->subframe_prach = subframe; - + // the thread can now be woken up if (pthread_cond_signal(&proc->cond_prach) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH thread %d\n", proc->thread_index); exit_fun( "ERROR pthread_cond_signal" ); return; } - + pthread_mutex_unlock( &proc->mutex_prach ); } - } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) { L1_proc_t *proc = &eNB->proc; @@ -708,58 +696,58 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) { if (ru!=NULL) { pthread_mutex_lock(&proc->mutex_RU_PRACH_br); - for (i=0;inum_RU;i++) { - if (ru == eNB->RU_list[i]) { - //LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH BR (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach_br,eNB->num_RU); - if ((proc->RU_mask_prach_br&(1< 0) - LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information (PRACH BR) from RU %d (num_RU %d, mask %x) has not been served yet!\n", - eNB->Mod_id,frame,subframe,ru->idx,eNB->num_RU,proc->RU_mask_prach_br); - proc->RU_mask_prach_br |= (1<RU_list[i]->state == RU_SYNC || eNB->RU_list[i]->wait_cnt > 0){ - proc->RU_mask_prach_br |= (1<num_RU; i++) { + if (ru == eNB->RU_list[i]) { + LOG_D(PHY,"frame %d, subframe %d: RU %d for eNB %d signals PRACH BR (mask %x, num_RU %d)\n",frame,subframe,i,eNB->Mod_id,proc->RU_mask_prach_br,eNB->num_RU); + + if ((proc->RU_mask_prach_br&(1< 0) + LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information (PRACH BR) from RU %d (num_RU %d, mask %x) has not been served yet!\n", + eNB->Mod_id,frame,subframe,ru->idx,eNB->num_RU,proc->RU_mask_prach_br); + + proc->RU_mask_prach_br |= (1<RU_mask_prach_br != (1<num_RU)-1) { // not all RUs have provided their information so return pthread_mutex_unlock(&proc->mutex_RU_PRACH_br); return; - } - else { // all RUs have provided their information so continue on and wakeup eNB processing + } else { // all RUs have provided their information so continue on and wakeup eNB processing proc->RU_mask_prach_br = 0; pthread_mutex_unlock(&proc->mutex_RU_PRACH_br); } } - + // check if we have to detect PRACH first - if (is_prach_subframe(fp,frame,subframe)>0) { + if (is_prach_subframe(fp,frame,subframe)>0) { LOG_D(PHY,"Triggering prach br processing, frame %d, subframe %d\n",frame,subframe); + if (proc->instance_cnt_prach_br == 0) { LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH BR\n", frame,subframe); return; } - + // wake up thread for PRACH RX if (pthread_mutex_lock(&proc->mutex_prach_br) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach_br); exit_fun( "error locking mutex_prach" ); return; } - + ++proc->instance_cnt_prach_br; // set timing for prach thread proc->frame_prach_br = frame; proc->subframe_prach_br = subframe; - + // the thread can now be woken up if (pthread_cond_signal(&proc->cond_prach_br) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH BR thread %d\n", proc->thread_index); exit_fun( "ERROR pthread_cond_signal" ); return; } - + pthread_mutex_unlock( &proc->mutex_prach_br ); } - } #endif @@ -769,76 +757,64 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) { * \param param is a \ref L1_proc_t structure which contains the info what to process. * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void* eNB_thread_prach( void* param ) { +static void *eNB_thread_prach( void *param ) { static int eNB_thread_prach_status; - - PHY_VARS_eNB *eNB= (PHY_VARS_eNB *)param; L1_proc_t *proc = &eNB->proc; // set default return value eNB_thread_prach_status = 0; - thread_top_init("eNB_thread_prach",1,500000,1000000,20000000); //wait_sync("eNB_thread_prach"); while (!oai_exit) { - - - if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break; + if (oai_exit) break; LOG_D(PHY,"Running eNB prach procedures\n"); prach_procedures(eNB -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0 #endif - ); - + ); + if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break; } LOG_I(PHY, "Exiting eNB thread PRACH\n"); - eNB_thread_prach_status = 0; return &eNB_thread_prach_status; } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) /*! * \brief The prach receive thread of eNB for BL/CE UEs. * \param param is a \ref L1_proc_t structure which contains the info what to process. * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void* eNB_thread_prach_br( void* param ) { +static void *eNB_thread_prach_br( void *param ) { static int eNB_thread_prach_status; - - PHY_VARS_eNB *eNB= (PHY_VARS_eNB *)param; L1_proc_t *proc = &eNB->proc; // set default return value eNB_thread_prach_status = 0; - thread_top_init("eNB_thread_prach_br",1,500000,1000000,20000000); while (!oai_exit) { - - - if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"eNB_prach_thread_br") < 0) break; + if (oai_exit) break; LOG_D(PHY,"Running eNB prach procedures for BL/CE UEs\n"); prach_procedures(eNB,1); - + if (release_thread(&proc->mutex_prach_br,&proc->instance_cnt_prach_br,"eNB_prach_thread_br") < 0) break; } LOG_I(PHY, "Exiting eNB thread PRACH BR\n"); - eNB_thread_prach_status = 0; return &eNB_thread_prach_status; } @@ -852,49 +828,49 @@ extern void init_te_thread(PHY_VARS_eNB *); extern void kill_td_thread(PHY_VARS_eNB *); extern void kill_te_thread(PHY_VARS_eNB *); -static void* process_stats_thread(void* param) { - - PHY_VARS_eNB *eNB = (PHY_VARS_eNB*)param; - +static void *process_stats_thread(void *param) { + PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param; wait_sync("process_stats_thread"); while (!oai_exit) { sleep(1); - if (opp_enabled == 1) { - if (eNB->td) print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL); - if (eNB->te) - { - print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL); - print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_stats,"turbo_encoding",NULL,NULL); - print_meas(&eNB->dlsch_interleaving_stats,"turbo_interleaving",NULL,NULL); - print_meas(&eNB->dlsch_rate_matching_stats,"turbo_rate_matching",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL); - } - print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL); - } + + if (opp_enabled == 1) { + if ( eNB->ulsch_decoding_stats.trials>0) + print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL); + + if (eNB->dlsch_encoding_stats.trials >0) { + print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL); + print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_stats,"turbo_encoding",NULL,NULL); + print_meas(&eNB->dlsch_interleaving_stats,"turbo_interleaving",NULL,NULL); + print_meas(&eNB->dlsch_rate_matching_stats,"turbo_rate_matching",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL); + } + + print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL); + } } + return(NULL); } void init_eNB_proc(int inst) { - /*int i=0;*/ int CC_id; PHY_VARS_eNB *eNB; L1_proc_t *proc; L1_rxtx_proc_t *L1_proc, *L1_proc_tx; pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_attr_t *attr_prach_br=NULL; #endif - LOG_I(PHY,"%s(inst:%d) RC.nb_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_CC[inst]); for (CC_id=0; CC_idfirst_rx =1; proc->first_tx =1; - //proc->RU_mask =0; - for (int i=0;i<10;i++) proc->RU_mask[i]=0; + proc->RU_mask_tx = (1<num_RU)-1; + proc->RU_mask =0; proc->RU_mask_prach =0; pthread_mutex_init( &eNB->UL_INFO_mutex, NULL); @@ -934,16 +910,15 @@ void init_eNB_proc(int inst) { pthread_mutex_init( &proc->mutex_prach, NULL); pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); pthread_mutex_init( &proc->mutex_RU,NULL); + pthread_mutex_init( &proc->mutex_RU_tx,NULL); pthread_mutex_init( &proc->mutex_RU_PRACH,NULL); - pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL); - pthread_attr_init( &proc->attr_prach); pthread_attr_init( &proc->attr_asynch_rxtx); pthread_attr_init( &L1_proc->attr); pthread_attr_init( &L1_proc_tx->attr); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) proc->instance_cnt_prach_br = -1; proc->RU_mask_prach_br=0; pthread_mutex_init( &proc->mutex_prach_br, NULL); @@ -955,42 +930,43 @@ void init_eNB_proc(int inst) { attr0 = &L1_proc->attr; attr1 = &L1_proc_tx->attr; attr_prach = &proc->attr_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) attr_prach_br = &proc->attr_prach_br; #endif - // attr_td = &proc->attr_td; - // attr_te = &proc->attr_te; + // attr_te = &proc->attr_te; #endif - if(get_thread_worker_conf() == WORKER_ENABLE) - { + if(get_thread_worker_conf() == WORKER_ENABLE) { init_te_thread(eNB); init_td_thread(eNB); } - LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag); if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) { - pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); //!!!!!!!!!!!!!!!!!!!!! for us it is eNB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 - pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc ); + pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); + pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc); + } else if (nfapi_mode == 2) { // this is neccesary in VNF or L2 FAPI simulator. + // Original Code from Fujitsu w/ old structure/field name + //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); + //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); + pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc ); + pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx); } + pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNB ); #endif AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach); - - if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB); - - + if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB); } //for multiple CCs: setup master and slaves - /* + /* for (CC_id=0; CC_idmutex); - L1_proc->instance_cnt = 0; - pthread_cond_signal(&L1_proc->cond); - pthread_mutex_unlock(&L1_proc->mutex); + if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) { + pthread_mutex_lock(&L1_proc->mutex); + L1_proc->instance_cnt = 0; + pthread_cond_signal(&L1_proc->cond); + pthread_mutex_unlock(&L1_proc->mutex); - pthread_mutex_lock(&L1_proc_tx->mutex); - L1_proc_tx->instance_cnt = 0; - pthread_cond_signal(&L1_proc_tx->cond); - pthread_mutex_unlock(&L1_proc_tx->mutex); + pthread_mutex_lock(&L1_proc_tx->mutex); + L1_proc_tx->instance_cnt = 0; + pthread_cond_signal(&L1_proc_tx->cond); + pthread_mutex_unlock(&L1_proc_tx->mutex); + } pthread_mutex_lock(&proc->mutex_prach); proc->instance_cnt_prach = 0; pthread_cond_signal( &proc->cond_prach ); pthread_mutex_unlock(&proc->mutex_prach); - pthread_cond_signal( &proc->cond_asynch_rxtx ); pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx); - LOG_D(PHY, "joining pthread_prach\n"); - pthread_join( proc->pthread_prach, (void**)&status ); - + pthread_join( proc->pthread_prach, (void **)&status ); LOG_I(PHY, "Destroying prach mutex/cond\n"); pthread_mutex_destroy( &proc->mutex_prach ); pthread_cond_destroy( &proc->cond_prach ); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) proc->instance_cnt_prach_br = 0; pthread_cond_signal( &proc->cond_prach_br ); - pthread_join( proc->pthread_prach_br, (void**)&status ); + pthread_join( proc->pthread_prach_br, (void **)&status ); pthread_mutex_destroy( &proc->mutex_prach_br ); pthread_cond_destroy( &proc->cond_prach_br ); #endif @@ -1081,19 +1053,22 @@ void kill_eNB_proc(int inst) { LOG_I(PHY, "Destroying L1_proc mutex/cond\n"); pthread_mutex_destroy( &L1_proc->mutex ); pthread_cond_destroy( &L1_proc->cond ); + pthread_mutex_destroy( &L1_proc->mutex_RUs ); + pthread_cond_destroy( &L1_proc->cond_RUs ); LOG_I(PHY, "Destroying L1_proc_tx mutex/cond\n"); pthread_mutex_destroy( &L1_proc_tx->mutex ); pthread_cond_destroy( &L1_proc_tx->cond ); + pthread_mutex_destroy( &L1_proc_tx->mutex_RUs ); + pthread_cond_destroy( &L1_proc_tx->cond_RUs ); pthread_attr_destroy(&proc->attr_prach); pthread_attr_destroy(&proc->attr_asynch_rxtx); pthread_attr_destroy(&L1_proc->attr); pthread_attr_destroy(&L1_proc_tx->attr); -#ifdef Rel14 +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_mutex_destroy(&proc->mutex_RU_PRACH_br); pthread_attr_destroy(&proc->attr_prach_br); #endif - } } @@ -1101,11 +1076,10 @@ void kill_eNB_proc(int inst) { void reset_opp_meas(void) { - int sfn; reset_meas(&softmodem_stats_mt); reset_meas(&softmodem_stats_hw); - + for (sfn=0; sfn < 10; sfn++) { reset_meas(&softmodem_stats_rxtx_sf); reset_meas(&softmodem_stats_rx_sf); @@ -1114,194 +1088,177 @@ void reset_opp_meas(void) { void print_opp_meas(void) { - int sfn=0; print_meas(&softmodem_stats_mt, "Main ENB Thread", NULL, NULL); print_meas(&softmodem_stats_hw, "HW Acquisation", NULL, NULL); - + for (sfn=0; sfn < 10; sfn++) { print_meas(&softmodem_stats_rxtx_sf,"[eNB][total_phy_proc_rxtx]",NULL, NULL); print_meas(&softmodem_stats_rx_sf,"[eNB][total_phy_proc_rx]",NULL,NULL); } } -void free_transport(PHY_VARS_eNB *eNB) -{ +void free_transport(PHY_VARS_eNB *eNB) { int i; int j; for (i=0; idlsch[i][j]); LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i); free_eNB_ulsch(eNB->ulsch[1+i]); } + free_eNB_ulsch(eNB->ulsch[0]); } void init_transport(PHY_VARS_eNB *eNB) { - int i; int j; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - LOG_I(PHY, "Initialise transport\n"); for (i=0; idlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp); + if (!eNB->dlsch[i][j]) { - LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); - exit(-1); + LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); + exit(-1); } else { - LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,eNB->dlsch[i][j]); - eNB->dlsch[i][j]->rnti=0; - LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); + eNB->dlsch[i][j]->rnti=0; + LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); } } - + LOG_D(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i); eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0); - + if (!eNB->ulsch[1+i]) { LOG_E(PHY,"Can't get eNB ulsch structures\n"); exit(-1); } - + // this is the transmission mode for the signalling channels // this will be overwritten with the real transmission mode by the RRC once the UE is connected eNB->transmission_mode[i] = fp->nb_antenna_ports_eNB==1 ? 1 : 2; } + // ULSCH for RA eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, fp->N_RB_UL, 0); - + if (!eNB->ulsch[0]) { LOG_E(PHY,"Can't get eNB ulsch structures\n"); exit(-1); } + eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); LOG_D(PHY,"eNB %d.%d : SI %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_SI); eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); LOG_D(PHY,"eNB %d.%d : RA %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_ra); eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); LOG_D(PHY,"eNB %d.%d : MCH %p\n",eNB->Mod_id,eNB->CC_id,eNB->dlsch_MCH); - - eNB->rx_total_gain_dB=130; - + for(i=0; imu_mimo_mode[i].dl_pow_off = 2; - + eNB->check_for_total_transmissions = 0; - eNB->check_for_MUMIMO_transmissions = 0; - eNB->FULL_MUMIMO_transmissions = 0; - eNB->check_for_SUMIMO_transmissions = 0; - fp->pucch_config_common.deltaPUCCH_Shift = 1; - -} +} void init_eNB_afterRU(void) { - int inst,CC_id,ru_id,i,aa; PHY_VARS_eNB *eNB; - LOG_I(PHY,"%s() RC.nb_inst:%d\n", __FUNCTION__, RC.nb_inst); - for (inst=0;instnum_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id); + LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id); eNB->frame_parms.nb_antennas_rx = 0; - LOG_I(PHY,"Overwriting eNB->prach_vars.rxsigF[0]:%p\n", eNB->prach_vars.rxsigF[0]); + eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *)); +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - eNB->prach_vars.rxsigF[0] = (int16_t**)malloc16(64*sizeof(int16_t*)); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - for (int ce_level=0;ce_level<4;ce_level++) { + for (int ce_level=0; ce_level<4; ce_level++) { LOG_I(PHY,"Overwriting eNB->prach_vars_br.rxsigF.rxsigF[0]:%p\n", eNB->prach_vars_br.rxsigF[ce_level]); - eNB->prach_vars_br.rxsigF[ce_level] = (int16_t**)malloc16(64*sizeof(int16_t*)); + eNB->prach_vars_br.rxsigF[ce_level] = (int16_t **)malloc16(64*sizeof(int16_t *)); } -#endif +#endif LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU); - for (ru_id=0,aa=0;ru_idnum_RU;ru_id++) { - eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx; + for (ru_id=0,aa=0; ru_idnum_RU; ru_id++) { + eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx; + AssertFatal(eNB->RU_list[ru_id]->common.rxdataF!=NULL, + "RU %d : common.rxdataF is NULL\n", + eNB->RU_list[ru_id]->idx); + AssertFatal(eNB->RU_list[ru_id]->prach_rxsigF!=NULL, + "RU %d : prach_rxsigF is NULL\n", + eNB->RU_list[ru_id]->idx); - AssertFatal(eNB->RU_list[ru_id]->common.rxdataF!=NULL, - "RU %d : common.rxdataF is NULL\n", - eNB->RU_list[ru_id]->idx); + for (i=0; iRU_list[ru_id]->nb_rx; aa++,i++) { + LOG_I(PHY,"Attaching RU %d antenna %d to eNB antenna %d\n",eNB->RU_list[ru_id]->idx,i,aa); + eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[ru_id]->prach_rxsigF[i]; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - AssertFatal(eNB->RU_list[ru_id]->prach_rxsigF!=NULL, - "RU %d : prach_rxsigF is NULL\n", - eNB->RU_list[ru_id]->idx); + for (int ce_level=0; ce_level<4; ce_level++) + eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i]; - for (i=0;iRU_list[ru_id]->nb_rx;aa++,i++) { - LOG_I(PHY,"Attaching RU %d antenna %d to eNB antenna %d\n",eNB->RU_list[ru_id]->idx,i,aa); - eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[ru_id]->prach_rxsigF[i]; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - for (int ce_level=0;ce_level<4;ce_level++) - eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i]; #endif - eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i]; - } + eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i]; + } } - eNB->frame_parms.nb_antennas_rx = 1; - /* TODO: review this code, there is something wrong. * In monolithic mode, we come here with nb_antennas_rx == 0 * (not tested in other modes). */ - if (eNB->frame_parms.nb_antennas_rx < 1) - { + if (eNB->frame_parms.nb_antennas_rx < 1) { LOG_I(PHY, "%s() ************* DJP ***** eNB->frame_parms.nb_antennas_rx:%d - GOING TO HARD CODE TO 1", __FUNCTION__, eNB->frame_parms.nb_antennas_rx); eNB->frame_parms.nb_antennas_rx = 1; - } - - if (eNB->frame_parms.nb_antennas_tx < 1) - { - LOG_I(PHY, "%s() ************* DJP ***** eNB->frame_parms.nb_antennas_tx:%d - GOING TO HARD CODE TO 1", __FUNCTION__, eNB->frame_parms.nb_antennas_tx); - eNB->frame_parms.nb_antennas_tx = 1; - } - else - { + } else { //LOG_I(PHY," Delete code\n"); } - - + if (eNB->frame_parms.nb_antennas_tx < 1) { + LOG_I(PHY, "%s() ************* DJP ***** eNB->frame_parms.nb_antennas_tx:%d - GOING TO HARD CODE TO 1", __FUNCTION__, eNB->frame_parms.nb_antennas_tx); + eNB->frame_parms.nb_antennas_tx = 1; + } else { + //LOG_I(PHY," Delete code\n"); + } AssertFatal(eNB->frame_parms.nb_antennas_rx >0, - "inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx); + "inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx); LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx); - init_transport(eNB); //init_precoding_weights(RC.eNB[inst][CC_id]); } + init_eNB_proc(inst); } - for (ru_id=0;ru_idwakeup_rxtx = wakeup_rxtx; RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) RC.ru[ru_id]->wakeup_prach_eNB_br = wakeup_prach_eNB_br; #endif RC.ru[ru_id]->eNB_top = eNB_top; @@ -1309,40 +1266,34 @@ void init_eNB_afterRU(void) { } void init_eNB(int single_thread_flag,int wait_for_sync) { - int CC_id; int inst; PHY_VARS_eNB *eNB; - LOG_I(PHY,"[lte-softmodem.c] eNB structure about to allocated RC.nb_L1_inst:%d RC.nb_L1_CC[0]:%d\n",RC.nb_L1_inst,RC.nb_L1_CC[0]); - if (RC.eNB == NULL) RC.eNB = (PHY_VARS_eNB***) malloc(RC.nb_L1_inst*sizeof(PHY_VARS_eNB **)); + if (RC.eNB == NULL) RC.eNB = (PHY_VARS_eNB ** *) malloc(RC.nb_L1_inst*sizeof(PHY_VARS_eNB **)); + LOG_I(PHY,"[lte-softmodem.c] eNB structure RC.eNB allocated\n"); - for (inst=0;instabstraction_flag = 0; eNB->single_thread_flag = single_thread_flag; - - LOG_I(PHY,"Initializing eNB %d CC_id %d single_thread_flag:%d\n",inst,CC_id,single_thread_flag); #ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id); #endif - - - eNB->td = ulsch_decoding_data_all; - eNB->te = dlsch_encoding_all; - - LOG_I(PHY,"Registering with MAC interface module\n"); AssertFatal((eNB->if_inst = IF_Module_init(inst))!=NULL,"Cannot register interface"); eNB->if_inst->schedule_response = schedule_response; eNB->if_inst->PHY_config_req = phy_config_request; - memset((void*)&eNB->UL_INFO,0,sizeof(eNB->UL_INFO)); - memset((void*)&eNB->Sched_INFO,0,sizeof(eNB->Sched_INFO)); + memset((void *)&eNB->UL_INFO,0,sizeof(eNB->UL_INFO)); + memset((void *)&eNB->Sched_INFO,0,sizeof(eNB->Sched_INFO)); LOG_I(PHY,"Setting indication lists\n"); eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list = eNB->rx_pdu_list; eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list = eNB->crc_pdu_list; @@ -1352,7 +1303,6 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list; eNB->prach_energy_counter = 0; } - } @@ -1364,8 +1314,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { void stop_eNB(int nb_inst) { - - for (int inst=0;inst= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) else if (packet_type == IF4p5_PRACH_BR_CE0) prach_rx &= (~0x2); else if (packet_type == IF4p5_PRACH_BR_CE1) prach_rx &= (~0x4); else if (packet_type == IF4p5_PRACH_BR_CE2) prach_rx &= (~0x8); @@ -535,6 +543,7 @@ static void* emulatedRF_thread(void* param) { RU_proc_t *proc = (RU_proc_t *) param; int microsec = 500; // length of time to sleep, in miliseconds struct timespec req = {0}; + int numerology = get_softmodem_params()->numerology; req.tv_sec = 0; req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2; cpu_set_t cpuset; @@ -585,7 +594,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); old_ts = proc->timestamp_rx; - if(emulate_rf){ + if(get_softmodem_params()->emulate_rf){ wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); rxs = fp->samples_per_tti; @@ -615,9 +624,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { proc->timestamp_rx = ts-ru->ts_offset; // AssertFatal(rxs == fp->samples_per_tti, -// "rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs); +// "rx_rf: Asked for %d samples, got %d from SDR\n",fp->samples_per_tti,rxs); if(rxs != fp->samples_per_tti){ - LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs); + LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from SDR\n",fp->samples_per_tti,rxs); late_control=STATE_BURST_TERMINATE; } @@ -955,9 +964,9 @@ static void* ru_thread_prach( void* param ) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 ); if (ru->eNB_list[0]){ prach_procedures( - ru->eNB_list[0] -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,0 + ru->eNB_list[0] +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,0 #endif ); } @@ -969,7 +978,7 @@ static void* ru_thread_prach( void* param ) { NULL, proc->frame_prach, 0 -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,0 #endif ); @@ -984,7 +993,7 @@ static void* ru_thread_prach( void* param ) { return &ru_thread_prach_status; } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) static void* ru_thread_prach_br( void* param ) { static int ru_thread_prach_status; @@ -1181,7 +1190,6 @@ void wakeup_L1s(RU_t *ru) { }else if (ru->is_slave == 1 && ru->state == RU_RUN && ( (proc->RU_mask[ru->proc.subframe_rx]&(1<<0)) == 1)){ // master already received. TODO: we assume that RU0 is master. if (check_sync(ru,eNB->RU_list[0],ru->proc.subframe_rx) == 0) LOG_E(PHY,"RU %d is not SYNC time, subframe %d, time %f\n", ru->idx, ru->proc.subframe_rx, fabs(ru->proc.t[ru->proc.subframe_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.subframe_rx].tv_nsec)); - } } //clock_gettime(CLOCK_MONOTONIC,&t); @@ -1266,7 +1274,7 @@ static inline int wakeup_prach_ru(RU_t *ru) { return(0); } -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) static inline int wakeup_prach_ru_br(RU_t *ru) { struct timespec wait; @@ -1303,7 +1311,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; openair0_config_t *cfg = &ru->openair0_cfg; //printf("////////////////numerology in config = %d\n",numerology); - + int numerology = get_softmodem_params()->numerology; if(fp->N_RB_DL == 100) { if(numerology == 0){ if (fp->threequarter_fs) { @@ -1363,6 +1371,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->num_rb_dl=fp->N_RB_DL; cfg->tx_num_channels=ru->nb_tx; cfg->rx_num_channels=ru->nb_rx; + cfg->clock_source=get_softmodem_params()->clock_source; for (i=0; inb_tx; i++) { @@ -1509,19 +1518,18 @@ static void* ru_thread_tx( void* param ) { if (oai_exit) break; - LOG_I(PHY,"ru_thread_tx (ru %d): Waiting for TX processing\n",ru->idx); + LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); // wait until eNBs are finished subframe RX n and TX n+4 wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); LOG_I(PHY,"ru_thread_tx (ru %d): Woken from condition\n",ru->idx); if (oai_exit) break; - //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ru_thread_tx is waken up %d.%d having L1 %d\n", proc->frame_tx, proc->subframe_tx, ru->num_eNB); // do TX front-end processing if needed (precoding and/or IDFTs) if (ru->feptx_prec) ru->feptx_prec(ru); // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru); - if(!emulate_rf){ + if(!(get_softmodem_params()->emulate_rf)){ // do outgoing fronthaul (south) if needed if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru); @@ -1534,6 +1542,7 @@ static void* ru_thread_tx( void* param ) { eNB = ru->eNB_list[i]; eNB_proc = &eNB->proc; L1_proc = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? &eNB_proc->L1_proc_tx : &eNB_proc->L1_proc; + char *L1_proc_name = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? "L1_proc_tx" : "L1_proc"; pthread_mutex_lock(&eNB_proc->mutex_RU_tx); for (int j=0;jnum_RU;j++) { @@ -1545,17 +1554,14 @@ static void* ru_thread_tx( void* param ) { } } if (eNB_proc->RU_mask_tx != (1<num_RU)-1) { // not all RUs have provided their information so return -printf("~~~~~~~~~~~~~~~~~~~~~~(mask = %d)\n", eNB_proc->RU_mask_tx); pthread_mutex_unlock(&eNB_proc->mutex_RU_tx); } else { // all RUs TX are finished so send the ready signal to eNB processing -printf("~~~~~~~~~~~~~~~~~~~~~~ready to send wakeup signal\n"); eNB_proc->RU_mask_tx = 0; pthread_mutex_unlock(&eNB_proc->mutex_RU_tx); pthread_mutex_lock( &L1_proc->mutex_RUs); L1_proc->instance_cnt_RUs = 0; -printf("~~~~~~~~~~~~~~~~~~~~~~ru_thread_tx send signal to L1_thread_tx with (mask = %d)\n", eNB_proc->RU_mask_tx); // the thread can now be woken up if (pthread_cond_signal(&L1_proc->cond_RUs) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); @@ -1597,7 +1603,7 @@ static void* ru_thread( void* param ) { LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]); - if(emulate_rf){ + if(get_softmodem_params()->emulate_rf){ fill_rf_config(ru,ru->rf_config_file); init_frame_parms(&ru->frame_parms,1); phy_init_RU(ru); @@ -1664,6 +1670,8 @@ static void* ru_thread( void* param ) { if (ru->is_slave == 0) AssertFatal(ru->state == RU_RUN,"ru-%d state = %s != RU_RUN\n",ru->idx,ru_states[ru->state]); else if (ru->is_slave == 1) AssertFatal(ru->state == RU_SYNC || ru->state == RU_RUN,"ru %d state = %s != RU_SYNC or RU_RUN\n",ru->idx,ru_states[ru->state]); + + if(!(get_softmodem_params()->emulate_rf)){ // Start RF device if any if (ru->start_rf) { if (ru->start_rf(ru) != 0) @@ -1778,6 +1786,7 @@ static void* ru_thread( void* param ) { wakeup_prach_ru(ru); } + #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) { wakeup_prach_ru_br(ru); @@ -1837,7 +1846,7 @@ static void* ru_thread( void* param ) { // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru); - if(!emulate_rf){ + if(!(get_softmodem_params()->emulate_rf)){ // do outgoing fronthaul (south) if needed if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru); @@ -1861,7 +1870,7 @@ static void* ru_thread( void* param ) { printf( "Exiting ru_thread \n"); - if (!emulate_rf){ + if (!(get_softmodem_params()->emulate_rf)){ if (ru->stop_rf != NULL) { if (ru->stop_rf(ru) != 0) LOG_E(HW,"Could not stop the RF device\n"); @@ -1948,7 +1957,12 @@ void* pre_scd_thread( void* param ){ int CC_id; int Mod_id; RU_t *ru = (RU_t*)param; - Mod_id = ru->eNB_list[0]->Mod_id; + + // L2-emulator can work only one eNB + if( nfapi_mode == 2) + Mod_id = 0; + else + Mod_id = ru->eNB_list[0]->Mod_id; frame = 0; subframe = 4; @@ -2154,7 +2168,7 @@ void init_RU_proc(RU_t *ru) { 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_fep=NULL; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_attr_t *attr_prach_br=NULL; #endif char name[100]; @@ -2182,8 +2196,6 @@ void init_RU_proc(RU_t *ru) { proc->frame_offset = 0; proc->num_slaves = 0; proc->frame_tx_unwrap = 0; - proc->ru_rx_ready = 0; - proc->ru_tx_ready = 0; for (i=0;i<10;i++) proc->symbol_mask[i]=0; @@ -2213,7 +2225,7 @@ void init_RU_proc(RU_t *ru) { pthread_attr_init( &proc->attr_asynch_rxtx); pthread_attr_init( &proc->attr_fep); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) proc->instance_cnt_prach_br = -1; pthread_mutex_init( &proc->mutex_prach_br, NULL); pthread_cond_init( &proc->cond_prach_br, NULL); @@ -2236,7 +2248,7 @@ void init_RU_proc(RU_t *ru) { attr_synch = &proc->attr_synch; attr_asynch = &proc->attr_asynch_rxtx; attr_emulateRF = &proc->attr_emulateRF; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) attr_prach_br = &proc->attr_prach_br; #endif #endif @@ -2261,7 +2273,7 @@ void init_RU_proc(RU_t *ru) { pthread_create( &proc->pthread_rf_tx, NULL, rf_tx, (void*)ru ); #endif - if(emulate_rf) + if(get_softmodem_params()->emulate_rf) pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void*)proc ); if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) @@ -2270,7 +2282,7 @@ void init_RU_proc(RU_t *ru) { if (ru->function == NGFI_RRU_IF4p5) { pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru ); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_create( &proc->pthread_prach_br, attr_prach_br, ru_thread_prach_br, (void*)ru ); #endif if (ru->is_slave == 1) pthread_create( &proc->pthread_synch, attr_synch, ru_thread_synch, (void*)ru); @@ -2376,7 +2388,7 @@ void kill_RU_proc(RU_t *ru) pthread_cond_signal(&proc->cond_prach); pthread_mutex_unlock(&proc->mutex_prach); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_mutex_lock(&proc->mutex_prach_br); proc->instance_cnt_prach_br = 0; pthread_cond_signal(&proc->cond_prach_br); @@ -2389,7 +2401,6 @@ void kill_RU_proc(RU_t *ru) pthread_mutex_unlock(&proc->mutex_synch); pthread_mutex_lock(&proc->mutex_eNBs); - proc->ru_tx_ready = 0; proc->instance_cnt_eNBs = 1; // cond_eNBs is used by both ru_thread and ru_thread_tx, so we need to send // a broadcast to wake up both threads @@ -2410,7 +2421,7 @@ void kill_RU_proc(RU_t *ru) if (ru->function == NGFI_RRU_IF4p5) { LOG_D(PHY, "Joining pthread_prach\n"); pthread_join(proc->pthread_prach, NULL); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) LOG_D(PHY, "Joining pthread_prach_br\n"); pthread_join(proc->pthread_prach_br, NULL); #endif @@ -2452,7 +2463,7 @@ void kill_RU_proc(RU_t *ru) pthread_attr_destroy(&proc->attr_asynch_rxtx); pthread_attr_destroy(&proc->attr_fep); -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_mutex_destroy(&proc->mutex_prach_br); pthread_cond_destroy(&proc->cond_prach_br); pthread_attr_destroy(&proc->attr_prach_br); @@ -2769,6 +2780,114 @@ void stop_RU(int nb_ru) } } +//Some of the member of ru pointer is used in pre_scd. +//This funtion is for initializing ru pointer for L2 FAPI simulator. +#if defined(PRE_SCD_THREAD) +void init_ru_vnf(void) { + + int ru_id; + RU_t *ru; + RU_proc_t *proc; +// PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL; + int i; + int CC_id; + + + dlsch_ue_select_tbl_in_use = 1; + + + // create status mask + RC.ru_mask = 0; + pthread_mutex_init(&RC.ru_mutex,NULL); + pthread_cond_init(&RC.ru_cond,NULL); + + // read in configuration file) + printf("configuring RU from file\n"); + RCconfig_RU(); + LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs()); + + if (RC.nb_CC != 0) + for (i=0;inum_RU=0; + + LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU); + for (ru_id=0;ru_idrf_config_file = rf_config_file; + ru->idx = ru_id; + ru->ts_offset = 0; + // use eNB_list[0] as a reference for RU frame parameters + // NOTE: multiple CC_id are not handled here yet! + + if (ru->num_eNB > 0) { +// LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file); + + if (ru->eNB_list[0] == 0) + { + LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__); + ru->eNB_list[0] = RC.eNB[0][0]; + ru->num_eNB=1; + // + // DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU + // + } + else + { + LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__); + } + } + +// frame_parms is not used in L2 FAPI simulator +/* + eNB0 = ru->eNB_list[0]; + LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south); + LOG_D(PHY, "eNB0:%p\n", eNB0); + if (eNB0) + { + if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5)) + AssertFatal(eNB0!=NULL,"eNB0 is null!\n"); + + if (eNB0) { + LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx); + memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS)); + + // attach all RU to all eNBs in its list/ + LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU); + for (i=0;inum_eNB;i++) { + eNB0 = ru->eNB_list[i]; + eNB0->RU_list[eNB0->num_RU++] = ru; + } + } + } +*/ + LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); + +// set_function_spec_param(ru); + LOG_I(PHY,"Starting ru_thread %d\n",ru_id); + +// init_RU_proc(ru); + + proc = &ru->proc; + memset((void*)proc,0,sizeof(RU_proc_t)); + + proc->instance_pre_scd = -1; + pthread_mutex_init( &proc->mutex_pre_scd, NULL); + pthread_cond_init( &proc->cond_pre_scd, NULL); + pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void*)ru); + pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread"); + + } // for ru_id + + + + // sleep(1); + LOG_D(HW,"[lte-softmodem.c] RU threads created\n"); + + +} +#endif + /* --------------------------------------------------------*/ /* from here function to use configuration module */ diff --git a/targets/RT/USER/lte-softmodem-common.c b/targets/RT/USER/lte-softmodem-common.c new file mode 100644 index 0000000000..7e1235b310 --- /dev/null +++ b/targets/RT/USER/lte-softmodem-common.c @@ -0,0 +1,105 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file lte-softmodem-common.c + * \brief Top-level threads for eNodeB + * \author Nokia BellLabs France, francois Taburet + * \date 2012 + * \version 0.1 + * \company Eurecom + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ + +#include "lte-softmodem.h" +#include "UTIL/OPT/opt.h" +#include "common/config/config_userapi.h" +#include "common/utils/load_module_shlib.h" +static softmodem_params_t softmodem_params; +char *parallel_config=NULL; +char *worker_config=NULL; + +uint64_t get_softmodem_optmask(void) { + return softmodem_params.optmask; +} + +uint64_t set_softmodem_optmask(uint64_t bitmask) { + softmodem_params.optmask = softmodem_params.optmask | bitmask; + return softmodem_params.optmask; +} + +softmodem_params_t* get_softmodem_params(void) { + return &softmodem_params; +} + +void get_common_options(void) +{ + + +uint32_t online_log_messages; +uint32_t glog_level ; +uint32_t start_telnetsrv; +uint32_t noS1; +uint32_t nokrnmod; +uint32_t nonbiot; +paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; +paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; + + + + config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); + + if (strlen(in_path) > 0) { + opt_type = OPT_PCAP; + opt_enabled=1; + printf("Enabling OPT for PCAP with the following file %s \n",in_path); + } + if (strlen(in_ip) > 0) { + opt_enabled=1; + opt_type = OPT_WIRESHARK; + printf("Enabling OPT for wireshark for local interface"); + } + + config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); + + if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { + set_glog_onlinelog(online_log_messages); + } + if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { + set_glog(glog_level); + } + if (start_telnetsrv) { + load_module_shlib("telnetsrv",NULL,0,NULL); + } + + if (noS1) { + set_softmodem_optmask(SOFTMODEM_NOS1_BIT); + } + if (nokrnmod) { + set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT); + } + if (nonbiot) { + set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT); + } + if(parallel_config != NULL) set_parallel_conf(parallel_config); + if(worker_config != NULL) set_worker_conf(worker_config); +} diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 6ae1ea91a6..58ccfcace2 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file lte-enb.c +/*! \file lte-softmodem.c * \brief Top-level threads for eNodeB * \author R. Knopp, F. Kaltenberger, Navid Nikaein * \date 2012 @@ -79,11 +79,11 @@ unsigned short config_frames[4] = {2,9,11,13}; //#include "PHY/TOOLS/time_meas.h" #ifndef OPENAIR2 -#include "UTIL/OTG/otg_vars.h" + #include "UTIL/OTG/otg_vars.h" #endif #if defined(ENABLE_ITTI) -#include "create_tasks.h" + #include "create_tasks.h" #endif #include "PHY/INIT/phy_init.h" @@ -91,24 +91,24 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "system.h" #ifdef XFORMS -#include "PHY/TOOLS/lte_phy_scope.h" -#include "stats.h" + #include "PHY/TOOLS/lte_phy_scope.h" + #include "stats.h" #endif #include "lte-softmodem.h" #include "NB_IoT_interface.h" #ifdef XFORMS -// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) -// at eNB 0, an UL scope for every UE -FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; -FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; -char title[255]; -unsigned char scope_enb_num_ue = 2; -static pthread_t forms_thread; //xforms + // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) + // at eNB 0, an UL scope for every UE + FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; + FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; + char title[255]; + unsigned char scope_enb_num_ue = 2; + static pthread_t forms_thread; //xforms #endif //XFORMS #ifndef ENABLE_USE_MME -#define EPC_MODE_ENABLED 0 + #define EPC_MODE_ENABLED 0 #endif pthread_cond_t nfapi_sync_cond; @@ -128,32 +128,18 @@ uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100] #if defined(ENABLE_ITTI) -volatile int start_eNB = 0; -volatile int start_UE = 0; + volatile int start_eNB = 0; + volatile int start_UE = 0; #endif volatile int oai_exit = 0; -static clock_source_t clock_source = internal,time_source=internal; -static int wait_for_sync = 0; -static int send_dmrssync = 0; - -unsigned int mmapped_dma=0; -int single_thread_flag = 0; - -static int8_t threequarter_fs=0; - uint32_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; - -// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB) -int16_t dlsch_demod_shift = 0; - int UE_scan = 1; int UE_scan_carrier = 0; runmode_t mode = normal_txrx; int simL1flag; -int snr_dB; FILE *input_fd=NULL; @@ -172,11 +158,6 @@ double rx_gain_off = 0.0; double sample_rate=30.72e6; double bw = 10.0e6; -char rf_config_file[1024]; - -int chain_offset=0; -int phy_test = 0; -uint8_t usim_test = 0; uint8_t dci_Format = 0; uint8_t agregation_Level =0xFF; @@ -190,17 +171,13 @@ char channels[128] = "0"; int rx_input_level_dBm; #ifdef XFORMS -extern int otg_enabled; -static char do_forms=0; + extern int otg_enabled; #else -int otg_enabled; + int otg_enabled; #endif //int number_of_cards = 1; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; -uint32_t timing_advance = 0; uint8_t exit_missed_slots=1; uint64_t num_missed_slots=0; // counter for the number of missed slots @@ -208,58 +185,20 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots extern void reset_opp_meas(void); extern void print_opp_meas(void); -extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t UE_id, - uint8_t abstraction_flag); extern void init_eNB_afterRU(void); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -char *parallel_config = NULL; -char *worker_config = NULL; - -static THREAD_STRUCT thread_struct; -void set_parallel_conf(char *parallel_conf) -{ - if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT; - printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf); -} -void set_worker_conf(char *worker_conf) -{ - if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE; - else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE; - printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf); -} -PARALLEL_CONF_t get_thread_parallel_conf(void) -{ - return thread_struct.parallel_conf; -} -WORKER_CONF_t get_thread_worker_conf(void) -{ - return thread_struct.worker_conf; -} - - +THREAD_STRUCT thread_struct; /* struct for ethernet specific parameters given in eNB conf file */ eth_params_t *eth_params; double cpuf; -extern char uecap_xer[1024]; -char uecap_xer_in=0; -int oaisim_flag=0; -threads_t threads= {-1,-1,-1,-1,-1,-1,-1}; - -/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed - * this is very hackish - find a proper solution - */ -uint8_t abstraction_flag=0; /* forward declarations */ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); @@ -271,6 +210,7 @@ struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 }; struct timespec clock_difftime(struct timespec start, struct timespec end) { struct timespec temp; + if ((end.tv_nsec-start.tv_nsec)<0) { temp.tv_sec = end.tv_sec-start.tv_sec-1; temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec; @@ -278,6 +218,7 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) { temp.tv_sec = end.tv_sec-start.tv_sec; temp.tv_nsec = end.tv_nsec-start.tv_nsec; } + return temp; } @@ -293,16 +234,21 @@ void update_difftimes(struct timespec start, struct timespec end) { struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 }; int changed = 0; diff_time = clock_difftime(start, end); + if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) { min_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; } + if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) { max_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; } + #if 1 + if (changed) print_difftimes(); + #endif } @@ -315,7 +261,7 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) { return (dcoff_i_rxfe + (dcoff_q_rxfe<<8)); } -#if !defined(ENABLE_ITTI) + void signal_handler(int sig) { void *array[10]; size_t size; @@ -323,36 +269,18 @@ void signal_handler(int sig) { if (sig==SIGSEGV) { // get void*'s for all entries on the stack size = backtrace(array, 10); - // print out all the frames to stderr fprintf(stderr, "Error: signal %d:\n", sig); backtrace_symbols_fd(array, size, 2); exit(-1); } else { - printf("trying to exit gracefully...\n"); - oai_exit = 1; + printf("Linux signal %s...\n",strsignal(sig)); + exit_function(__FILE__, __FUNCTION__, __LINE__,"softmodem starting exit procedure\n"); } } -#endif -#define KNRM "\x1B[0m" -#define KRED "\x1B[31m" -#define KGRN "\x1B[32m" -#define KBLU "\x1B[34m" -#define RESET "\033[0m" -#if defined(ENABLE_ITTI) -void signal_handler_itti(int sig) { - // Call exit function - char msg[256]; - memset(msg, 0, 256); - sprintf(msg, "caught signal %s\n", strsignal(sig)); - exit_function(__FILE__, __FUNCTION__, __LINE__, msg); -} -#endif - -void exit_function(const char* file, const char* function, const int line, const char* s) -{ +void exit_function(const char *file, const char *function, const int line, const char *s) { int ru_id; if (s != NULL) { @@ -361,50 +289,46 @@ void exit_function(const char* file, const char* function, const int line, const oai_exit = 1; + if (RC.ru == NULL) + exit(-1); // likely init not completed, prevent crash or hang, exit now... - if (RC.ru == NULL) - exit(-1); // likely init not completed, prevent crash or hang, exit now... - for (ru_id=0; ru_idrfdevice.trx_end_func) { - RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); - RC.ru[ru_id]->rfdevice.trx_end_func = NULL; - } - if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func) { - RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); - RC.ru[ru_id]->ifdevice.trx_end_func = NULL; - } + for (ru_id=0; ru_idrfdevice.trx_end_func) { + RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); + RC.ru[ru_id]->rfdevice.trx_end_func = NULL; } + if (RC.ru[ru_id] && RC.ru[ru_id]->ifdevice.trx_end_func) { + RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); + RC.ru[ru_id]->ifdevice.trx_end_func = NULL; + } + } - sleep(1); //allow lte-softmodem threads to exit first + sleep(1); //allow lte-softmodem threads to exit first #if defined(ENABLE_ITTI) - itti_terminate_tasks (TASK_UNKNOWN); + itti_terminate_tasks (TASK_UNKNOWN); #endif - exit(1); - + exit(1); } #ifdef XFORMS -void reset_stats(FL_OBJECT *button, long arg) -{ +void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; for (i=0; idlsch[i][0]->Mlimit; j++) { - phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; } phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; - - phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; @@ -413,54 +337,47 @@ void reset_stats(FL_OBJECT *button, long arg) } static void *scope_thread(void *arg) { - # ifdef ENABLE_XFORMS_WRITE_STATS FILE *eNB_stats; # endif struct sched_param sched_param; int UE_id, CC_id; int ue_cnt=0; - sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; sched_setscheduler(0, SCHED_FIFO,&sched_param); - printf("Scope thread has priority %d\n",sched_param.sched_priority); - # ifdef ENABLE_XFORMS_WRITE_STATS - eNB_stats = fopen("eNB_stats.txt", "w"); - #endif while (!oai_exit) { + ue_cnt=0; + + for(UE_id=0; UE_id 0) { - opt_type = OPT_PCAP; - opt_enabled=1; - printf("Enabling OPT for PCAP with the following file %s \n",in_path); - } - if (strlen(in_ip) > 0) { - opt_enabled=1; - opt_type = OPT_WIRESHARK; - printf("Enabling OPT for wireshark for local interface"); - } + get_common_options(); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); - config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); - - if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { - set_glog_onlinelog(online_log_messages); - } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { - set_glog(glog_level); - } - if (start_telnetsrv) { - load_module_shlib("telnetsrv",NULL,0,NULL); - } if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) { - memset((void*)&RC,0,sizeof(RC)); - /* Read RC configuration file */ - RCConfig(); - NB_eNB_INST = RC.nb_inst; - printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,RC.nb_RU); - if (nonbiotflag <= 0) { - load_NB_IoT(); - printf(" nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n", - RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst); - } else { - printf("All Nb-IoT instances disabled\n"); - RC.nb_nb_iot_rrc_inst=RC.nb_nb_iot_L1_inst=RC.nb_nb_iot_macrlc_inst=0; - } - } - if(parallel_config != NULL) set_parallel_conf(parallel_config); - if(worker_config != NULL) set_worker_conf(worker_config); + memset((void *)&RC,0,sizeof(RC)); + /* Read RC configuration file */ + RCConfig(); + NB_eNB_INST = RC.nb_inst; + printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,RC.nb_RU); + + if (!SOFTMODEM_NONBIOT) { + load_NB_IoT(); + printf(" nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n", + RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst); + } else { + printf("All Nb-IoT instances disabled\n"); + RC.nb_nb_iot_rrc_inst=RC.nb_nb_iot_L1_inst=RC.nb_nb_iot_macrlc_inst=0; + } + } } @@ -582,11 +465,10 @@ static void get_options(unsigned int *start_msc) { void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { - int CC_id; for (CC_id=0; CC_idframe_type = FDD; frame_parms[CC_id]->tdd_config = 3; @@ -600,9 +482,7 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->nb_antenna_ports_eNB = 1; frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_rx = 1; - frame_parms[CC_id]->nushift = 0; - frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth; frame_parms[CC_id]->phich_config_common.phich_duration = normal; // UL RS Config @@ -610,61 +490,55 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0; frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; - frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; - -// downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31. -// downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; -// downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; -// downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; + // downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31. + // downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; + // downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; + // downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]); frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0]; - } - } void wait_RUs(void) { - LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); - // wait for all RUs to be configured over fronthaul pthread_mutex_lock(&RC.ru_mutex); + while (RC.ru_mask>0) { pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex); printf("RC.ru_mask:%02lx\n", RC.ru_mask); } - pthread_mutex_unlock(&RC.ru_mutex); + pthread_mutex_unlock(&RC.ru_mutex); LOG_I(PHY,"RUs configured\n"); } void wait_eNBs(void) { - int i,j; int waiting=1; - while (waiting==1) { printf("Waiting for eNB L1 instances to all get configured ... sleeping 50ms (nb_L1_inst %d)\n",RC.nb_L1_inst); usleep(50*1000); waiting=0; - for (i=0;iconfigured==0) { - waiting=1; - break; - } + for (j=0; jconfigured==0) { + waiting=1; + break; + } } } } + printf("eNB L1 are configured\n"); } @@ -672,20 +546,18 @@ void wait_eNBs(void) { /* * helper function to terminate a certain ITTI task */ -void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) -{ +void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE from task %s (%d) to task %s (%d)\n", - itti_get_task_name(from), from, itti_get_task_name(to), to); + itti_get_task_name(from), from, itti_get_task_name(to), to); MessageDef *msg; msg = itti_alloc_new_message (from, TERMINATE_MESSAGE); itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } extern void free_transport(PHY_VARS_eNB *); -extern void phy_free_RU(RU_t*); +extern void phy_free_RU(RU_t *); -int stop_L1L2(module_id_t enb_id) -{ +int stop_L1L2(module_id_t enb_id) { LOG_W(ENB_APP, "stopping lte-softmodem\n"); if (!RC.ru) { @@ -702,10 +574,12 @@ int stop_L1L2(module_id_t enb_id) LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id); kill_eNB_proc(enb_id); oai_exit = 0; + for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) { free_transport(RC.eNB[enb_id][cc_id]); phy_free_lte_eNB(RC.eNB[enb_id][cc_id]); } + phy_free_RU(RC.ru[enb_id]); free_lte_top(); return 0; @@ -714,14 +588,11 @@ int stop_L1L2(module_id_t enb_id) /* * Restart the lte-softmodem after it has been soft-stopped with stop_L1L2() */ -int restart_L1L2(module_id_t enb_id) -{ +int restart_L1L2(module_id_t enb_id) { RU_t *ru = RC.ru[enb_id]; int cc_id; MessageDef *msg_p = NULL; - LOG_W(ENB_APP, "restarting lte-softmodem\n"); - /* block threads */ pthread_mutex_lock(&sync_mutex); sync_var = -1; @@ -739,14 +610,15 @@ int restart_L1L2(module_id_t enb_id) /* reset the list of connected UEs in the MAC, since in this process with * loose all UEs (have to reconnect) */ init_UE_list(&RC.mac[enb_id]->UE_list); - LOG_I(ENB_APP, "attempting to create ITTI tasks\n"); + if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { LOG_E(RRC, "Create task for RRC eNB failed\n"); return -1; } else { LOG_I(RRC, "Re-created task for RRC eNB successfully\n"); } + if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { LOG_E(PDCP, "Create task for L2L1 failed\n"); return -1; @@ -761,97 +633,88 @@ int restart_L1L2(module_id_t enb_id) itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); /* TODO XForms might need to be restarted, but it is currently (09/02/18) * broken, so we cannot test it */ - wait_eNBs(); init_RU_proc(ru); ru->rf_map.card = 0; ru->rf_map.chain = 0; /* CC_id + chain_offset;*/ wait_RUs(); init_eNB_afterRU(); - printf("Sending sync to all threads\n"); pthread_mutex_lock(&sync_mutex); sync_var=0; pthread_cond_broadcast(&sync_cond); pthread_mutex_unlock(&sync_mutex); - return 0; } #endif static void wait_nfapi_init(char *thread_name) { - printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); pthread_mutex_lock( &nfapi_sync_mutex ); - + while (nfapi_sync_var<0) pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex ); - + pthread_mutex_unlock(&nfapi_sync_mutex); - printf( "NFAPI: got sync (%s)\n", thread_name); } -int main( int argc, char **argv ) -{ +int main( int argc, char **argv ) { int i; #if defined (XFORMS) void *status; #endif - int CC_id; int ru_id; #if defined (XFORMS) int ret; #endif - unsigned int start_msc=0; - if ( load_configmodule(argc,argv) == NULL) { + if ( load_configmodule(argc,argv,0) == NULL) { exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); - } - - - mode = normal_txrx; - - set_latency_target(); - - logInit(); - - printf("Reading in command-line options\n"); - - get_options (&start_msc); - if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { - fprintf(stderr,"Getting configuration failed\n"); - exit(-1); } + mode = normal_txrx; + set_latency_target(); + logInit(); + printf("Reading in command-line options\n"); + CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT); + get_options (); + + if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { + fprintf(stderr,"Getting configuration failed\n"); + exit(-1); + } #if T_TRACER T_Config_Init(); #endif + ret=config_check_unknown_cmdlineopt(NULL); + if (ret != 0) { + LOG_E(ENB_APP, "%i unknown options in command line\n",ret); + exit_fun(""); + } - + CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT); //randominit (0); set_taus_seed (0); - printf("configuring for RAU/RRU\n"); if (opp_enabled ==1) { reset_opp_meas(); } + cpuf=get_cpu_freq_GHz(); - #if defined(ENABLE_ITTI) - printf("ITTI init, useMME: %i\n" ,EPC_MODE_ENABLED); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); // initialize mscgen log after ITTI - if (start_msc) { - load_module_shlib("msc",NULL,0,&msc_interface); + if (get_softmodem_params()->start_msc) { + load_module_shlib("msc",NULL,0,&msc_interface); } + MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); #endif @@ -867,64 +730,50 @@ int main( int argc, char **argv ) pdcp_netlink_init(); #endif #endif - -#if !defined(ENABLE_ITTI) // to make a graceful exit when ctrl-c is pressed signal(SIGSEGV, signal_handler); signal(SIGINT, signal_handler); -#endif - -#if defined(ENABLE_ITTI) - signal(SIGINT, signal_handler_itti); - signal(SIGTERM, signal_handler_itti); - signal(SIGABRT, signal_handler_itti); -#endif - + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); check_clock(); - #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" #endif - LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); - - - - - printf("Before CC \n"); - printf("Runtime table\n"); fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); - - #ifndef DEADLINE_SCHEDULER - printf("NO deadline scheduler\n"); /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */ - cpu_set_t cpuset; int s; char cpu_affinity[1024]; CPU_ZERO(&cpuset); #ifdef CPU_AFFINITY + if (get_nprocs() > 2) { CPU_SET(0, &cpuset); s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + if (s != 0) { perror( "pthread_setaffinity_np"); exit_fun("Error setting processor affinity"); } + LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n"); } + #endif - /* Check the actual affinity mask assigned to the thread */ s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + if (s != 0) { perror( "pthread_getaffinity_np"); exit_fun("Error getting processor affinity "); } + memset(cpu_affinity, 0 , sizeof(cpu_affinity)); + for (int j = 0; j < CPU_SETSIZE; j++) { if (CPU_ISSET(j, &cpuset)) { char temp[1024]; @@ -932,30 +781,28 @@ int main( int argc, char **argv ) strcat(cpu_affinity, temp); } } + LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); #endif - - - - #if defined(ENABLE_ITTI) + if (RC.nb_inst > 0) { - // don't create if node doesn't connect to RRC/S1/GTP - if (create_tasks(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode - } + if (create_tasks(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } + printf("ITTI tasks created\n"); - } - else { + } else { printf("No ITTI, Initializing L1\n"); RCconfig_L1(); } -#endif +#endif /* Start the agent. If it is turned off in the configuration, it won't start */ RCconfig_flexran(); + for (i = 0; i < RC.nb_L1_inst; i++) { flexran_agent_start(i); } @@ -963,55 +810,48 @@ int main( int argc, char **argv ) // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); - mlockall(MCL_CURRENT | MCL_FUTURE); - pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); - #ifdef XFORMS int UE_id; - printf("XFORMS\n"); - if (do_forms==1) { + if (get_softmodem_params()->do_forms==1) { fl_initialize (&argc, argv, NULL, 0, 0); - - form_stats_l2 = create_form_stats_form(); - fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); - form_stats = create_form_stats_form(); - fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); - - for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - - if (otg_enabled) { - fl_set_button(form_enb[CC_id][UE_id]->button_0,1); - fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); - } else { - fl_set_button(form_enb[CC_id][UE_id]->button_0,0); - fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF"); - } - } // CC_id - } // UE_id - + form_stats_l2 = create_form_stats_form(); + fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); + form_stats = create_form_stats_form(); + fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); + + for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); + + if (otg_enabled) { + fl_set_button(form_enb[CC_id][UE_id]->button_0,1); + fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); + } else { + fl_set_button(form_enb[CC_id][UE_id]->button_0,0); + fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF"); + } + } // CC_id + } // UE_id + ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); - + if (ret == 0) pthread_setname_np( forms_thread, "xforms" ); - + printf("Scope thread created, ret=%d\n",ret); } - + #endif - rt_sleep_ns(10*100000000ULL); - if (nfapi_mode) - { + if (nfapi_mode) { printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); @@ -1023,90 +863,100 @@ int main( int argc, char **argv ) case 0: nfapi_mode_str = "MONOLITHIC"; break; + case 1: nfapi_mode_str = "PNF"; break; + case 2: nfapi_mode_str = "VNF"; break; + default: nfapi_mode_str = ""; break; } + printf("NFAPI MODE:%s\n", nfapi_mode_str); - if (nfapi_mode==2) // VNF + +if (nfapi_mode==2) {// VNF +#if defined(PRE_SCD_THREAD) + init_ru_vnf(); // ru pointer is necessary for pre_scd. +#endif wait_nfapi_init("main?"); + } + printf("START MAIN THREADS\n"); - // start the main threads + number_of_cards = 1; + printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); - number_of_cards = 1; - printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); - if (RC.nb_L1_inst > 0) { - printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync); - init_eNB(single_thread_flag,wait_for_sync); - // for (inst=0;inst 0) { + printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync); + init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync); + // for (inst=0;inst0 && nfapi_mode != 2) { + printf("Initializing RU threads\n"); + init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->clock_source,get_softmodem_params()->send_dmrssync); + for (ru_id=0;ru_idrf_map.card=0; + RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); } + } - printf("wait_eNBs()\n"); - wait_eNBs(); + config_sync_var=0; - printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU); - if (RC.nb_RU >0) { - printf("Initializing RU threads\n"); - init_RU(rf_config_file,clock_source,time_source,send_dmrssync); - for (ru_id=0;ru_idrf_map.card=0; - RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; - } - } + if (nfapi_mode==1) { // PNF + wait_nfapi_init("main?"); + } - config_sync_var=0; + printf("wait RUs\n"); + fflush(stdout); + fflush(stderr); + wait_RUs(); + printf("ALL RUs READY!\n"); + printf("RC.nb_RU:%d\n", RC.nb_RU); + // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration) + printf("ALL RUs ready - init eNBs\n"); - if (nfapi_mode==1) { // PNF - wait_nfapi_init("main?"); - } + if (nfapi_mode != 1 && nfapi_mode != 2) { + printf("Not NFAPI mode - call init_eNB_afterRU()\n"); + init_eNB_afterRU(); + } else { + printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n"); + } - printf("wait RUs\n"); - fflush(stdout); - fflush(stderr); - wait_RUs(); - printf("ALL RUs READY!\n"); - printf("RC.nb_RU:%d\n", RC.nb_RU); - // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration) - printf("ALL RUs ready - init eNBs\n"); - - if (nfapi_mode != 1 && nfapi_mode != 2) - { - printf("Not NFAPI mode - call init_eNB_afterRU()\n"); - init_eNB_afterRU(); - } - else - { - printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n"); - } - - printf("ALL RUs ready - ALL eNBs ready\n"); - - + printf("ALL RUs ready - ALL eNBs ready\n"); // connect the TX/RX buffers - sleep(1); /* wait for thread activation */ - printf("Sending sync to all threads\n"); - pthread_mutex_lock(&sync_mutex); sync_var=0; pthread_cond_broadcast(&sync_cond); pthread_mutex_unlock(&sync_mutex); + ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); + + if (ret != 0) { + LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret); + exit_fun(""); + } // wait for end of program printf("TYPE TO TERMINATE\n"); //getchar(); - #if defined(ENABLE_ITTI) printf("Entering ITTI signals handler\n"); itti_wait_tasks_end(); @@ -1117,36 +967,33 @@ int main( int argc, char **argv ) while (oai_exit==0) rt_sleep_ns(100000000ULL); + printf("Terminating application - oai_exit=%d\n",oai_exit); - #endif - // stop threads #ifdef XFORMS printf("waiting for XFORMS thread\n"); - if (do_forms==1) { + if (get_softmodem_params()->do_forms==1) { pthread_join(forms_thread,&status); fl_hide_form(form_stats->stats_form); fl_free_form(form_stats->stats_form); + fl_hide_form(form_stats_l2->stats_form); + fl_free_form(form_stats_l2->stats_form); - fl_hide_form(form_stats_l2->stats_form); - fl_free_form(form_stats_l2->stats_form); - - for(UE_id=0; UE_idlte_phy_scope_enb); - fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); - } + for(UE_id=0; UE_idlte_phy_scope_enb); + fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); } + } } #endif - printf("stopping MODEM threads\n"); - stop_eNB(NB_eNB_INST); stop_RU(RC.nb_RU); + /* release memory used by the RU/eNB threads (incomplete), after all * threads have been stopped (they partially use the same memory) */ for (int inst = 0; inst < NB_eNB_INST; inst++) { @@ -1155,41 +1002,37 @@ int main( int argc, char **argv ) phy_free_lte_eNB(RC.eNB[inst][cc_id]); } } + for (int inst = 0; inst < RC.nb_RU; inst++) { phy_free_RU(RC.ru[inst]); } - free_lte_top(); + free_lte_top(); printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); end_configmodule(); printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - pthread_cond_destroy(&sync_cond); pthread_mutex_destroy(&sync_mutex); - pthread_cond_destroy(&nfapi_sync_cond); pthread_mutex_destroy(&nfapi_sync_mutex); - pthread_mutex_destroy(&ue_pf_po_mutex); - - for(ru_id=0; ru_idrfdevice.trx_end_func) { - RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); - RC.ru[ru_id]->rfdevice.trx_end_func = NULL; - } - if (RC.ru[ru_id]->ifdevice.trx_end_func) { - RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); - RC.ru[ru_id]->ifdevice.trx_end_func = NULL; - } + for(ru_id=0; ru_idrfdevice.trx_end_func) { + RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); + RC.ru[ru_id]->rfdevice.trx_end_func = NULL; } - + + if (RC.ru[ru_id]->ifdevice.trx_end_func) { + RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); + RC.ru[ru_id]->ifdevice.trx_end_func = NULL; + } + } + if (opt_enabled == 1) terminate_opt(); - - logClean(); + logClean(); printf("Bye.\n"); - return 0; } diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 06ef1ca4fd..103a8bfe78 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -97,7 +97,8 @@ #define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n" #define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n" #define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n" - +#define CONFIG_HLP_NOS1 "Disable s1 interface\n" +#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n" @@ -132,29 +133,49 @@ #define CMDLINE_DUMPMEMORY_IDX 7 /*------------------------------------------------------------------------------------------------------------------------------------------*/ +#define START_MSC softmodem_params.start_msc +/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters specific to UE */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters specific to UE */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*--------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_UEPARAMS_DESC { \ -{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \ -{"U", CONFIG_HLP_NUMUE, 0, u8ptr:&NB_UE_INST, defuintval:1, TYPE_UINT, 0}, \ -{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \ -{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ -{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ -{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \ -{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ -{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \ -{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \ -{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ -{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ -{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \ -{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ -{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ -{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ -{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0} \ - } +{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \ +{"U", CONFIG_HLP_NUMUE, 0, u8ptr:&NB_UE_INST, defuintval:1, TYPE_UINT, 0}, \ +{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \ +{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ +{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ +{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \ +{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ +{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \ +{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \ +{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ +{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ +{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \ +{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \ +{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ +{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ +{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \ +{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \ +{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ +{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \ +{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \ +{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ +{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \ +} + +/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters specific to UE threads */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define CMDLINE_UETHREADSPARAMS_DESC { \ +{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \ +{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \ +{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \ +{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \ +{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \ +{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \ +} #define DEFAULT_DLF 2680000000 @@ -162,41 +183,38 @@ /* command line parameters common to eNodeB and UE */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define RF_CONFIG_FILE softmodem_params.rf_config_file +#define PHY_TEST softmodem_params.phy_test +#define WAIT_FOR_SYNC softmodem_params.wait_for_sync +#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag +#define CHAIN_OFFSET softmodem_params.chain_offset +#define DO_FORMS softmodem_params.do_forms +#define NUMEROLOGY softmodem_params.numerology +#define EMULATE_RF softmodem_params.emulate_rf +#define CLOCK_SOURCE softmodem_params.clock_source +#define USIM_TEST softmodem_params.usim_test #define CMDLINE_PARAMS_DESC { \ -{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)}, \ +{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \ {"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \ -{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \ -{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \ -{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ -{"external-timesource", CONFIG_HLP_EXTS, PARAMFLAG_BOOL, uptr:&time_source, defintval:0, TYPE_INT, 0}, \ -{"external-clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \ -{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ -{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:0, TYPE_INT, 0}, \ -{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \ -{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \ -{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \ -{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \ -{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \ -{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \ -{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ -{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ +{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ +{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \ +{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \ +{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \ +{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \ +{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \ {"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \ -{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \ -{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ -{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ -{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ -{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ +{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \ +{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \ {"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \ {"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ -{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ -{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \ -{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \ -{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \ +{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ -{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \ +{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \ +{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ +{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ } #define CONFIG_HLP_FLOG "Enable online log \n" @@ -207,11 +225,12 @@ /* command line parameters for LOG utility */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC { \ {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ -{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:start_msc, defintval:0, TYPE_UINT, 0}, \ +{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ } #define CMDLINE_ONLINELOG_IDX 0 #define CMDLINE_GLOGLEVEL_IDX 1 @@ -220,6 +239,38 @@ /***************************************************************************************************************************************/ /* */ +#include "threads_t.h" + +#define SOFTMODEM_NOS1_BIT (1<<0) +#define SOFTMODEM_NOKRNMOD_BIT (1<<1) +#define SOFTMODEM_NONBIOT_BIT (1<<2) +typedef struct { + uint64_t optmask; + THREAD_STRUCT thread_struct; + char rf_config_file[1024]; + int phy_test; + uint8_t usim_test; + int emulate_rf; + int wait_for_sync; //eNodeB only + int single_thread_flag; //eNodeB only + int chain_offset; + uint32_t do_forms; + int numerology; + unsigned int start_msc; + int nonbiotflag; + uint32_t clock_source; + int hw_timing_advance; +} softmodem_params_t; + +#define SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT) +#define SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT) +#define SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT) +extern uint64_t get_softmodem_optmask(void); +extern uint64_t set_softmodem_optmask(uint64_t bitmask); +extern void get_common_options(void); +extern softmodem_params_t* get_softmodem_params(void); + +uint64_t get_pdcp_optmask(void); extern pthread_cond_t sync_cond; extern pthread_mutex_t sync_mutex; extern int sync_var; @@ -247,8 +298,8 @@ extern volatile int start_eNB; extern volatile int start_UE; #endif -#include "threads_t.h" -extern threads_t threads; + + // In lte-enb.c extern void init_eNB(int single_thread_flag,int wait_for_sync); @@ -258,7 +309,8 @@ extern void kill_eNB_proc(int inst); // In lte-ru.c extern void init_RU(const char*,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync); -//extern void stop_ru(RU_t *ru); +extern void stop_ru(RU_t *ru); +extern void init_ru_vnf(void); extern void init_RU_proc(RU_t *ru); extern void stop_RU(int nb_ru); extern void kill_RU_proc(RU_t *ru); @@ -274,7 +326,7 @@ extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, c extern void reset_opp_meas(void); extern void print_opp_meas(void); -extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *); + extern void init_td_thread(PHY_VARS_eNB *); extern void init_te_thread(PHY_VARS_eNB *); extern void kill_td_thread(PHY_VARS_eNB *); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index c49a54b98a..31857026ee 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -58,8 +58,8 @@ #include "UTIL/MATH/oml.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" - - +#include "lte-softmodem.h" +#include "common/config/config_userapi.h" #include "T.h" extern double cpuf; @@ -94,7 +94,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); extern int simL1flag; - +extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); void ue_stub_rx_handler(unsigned int, char *); @@ -102,9 +102,11 @@ void ue_stub_rx_handler(unsigned int, char *); int32_t **rxdata; int32_t **txdata; -int timer_subframe; -int timer_frame; -SF_ticking *phy_stub_ticking; +int timer_subframe = 0; +int timer_frame = 0; +SF_ticking *phy_stub_ticking = NULL; +int next_ra_frame = 0; +module_id_t next_Mod_id = 0; #define KHz (1000UL) #define MHz (1000*KHz) @@ -158,12 +160,21 @@ static const eutra_band_t eutra_bands[] = { }; - +threads_t threads= {-1,-1,-1,-1,-1,-1,-1}; pthread_t main_ue_thread; pthread_attr_t attr_UE_thread; struct sched_param sched_param_UE_thread; + +void get_uethreads_params(void) { + paramdef_t cmdline_threadsparams[] =CMDLINE_UETHREADSPARAMS_DESC; + + + config_process_cmdline( cmdline_threadsparams,sizeof(cmdline_threadsparams)/sizeof(paramdef_t),NULL); +} + + void phy_init_lte_ue_transport(PHY_VARS_UE *ue,int absraction_flag); PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, @@ -179,7 +190,7 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } - + ue->hw_timing_advance=get_softmodem_params()->hw_timing_advance; ue->Mod_id = UE_id; ue->mac_enabled = 1; @@ -377,7 +388,7 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, for (inst=0;instproc; - // Initializations for nfapi-L2-emulator mode - dl_config_req = NULL; - ul_config_req = NULL; - hi_dci0_req = NULL; - tx_request_pdu_list = NULL; - + // settings for nfapi-L2-emulator mode + module_id_t ue_thread_id = rtd->ue_thread_id; + uint16_t ue_index = 0; + uint16_t ue_num = NB_UE_INST/NB_THREAD_INST+((NB_UE_INST%NB_THREAD_INST > ue_thread_id) ? 1 :0); + module_id_t ue_Mod_id; PHY_VARS_UE *UE; //= rtd->UE; int ret; + uint8_t end_flag; + proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; + phy_stub_ticking->num_single_thread[ue_thread_id] = -1; + if(ue_thread_id == 0){ + phy_stub_ticking->ticking_var = -1; + proc->subframe_rx=proc->sub_frame_start; + // Initializations for nfapi-L2-emulator mode + dl_config_req = NULL; + ul_config_req = NULL; + hi_dci0_req = NULL; + tx_request_pdu_list = NULL; - phy_stub_ticking->ticking_var = -1; - proc->subframe_rx=proc->sub_frame_start; + // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. + do{ + end_flag = 1; + for(uint16_t i = 0;i< NB_THREAD_INST;i++){ + if(phy_stub_ticking->num_single_thread[i] == 0){ + end_flag = 0; + } + } + }while(end_flag == 0); + + sync_var=0; + } //PANOS: CAREFUL HERE! wait_sync("UE_phy_stub_single_thread_rxn_txnp4"); while (!oai_exit) { - + if(ue_thread_id == 0){ if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) { LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" ); exit_fun("nothing to add"); @@ -997,12 +1030,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { proc->subframe_rx=timer_subframe; proc->frame_rx = timer_frame; - proc->subframe_tx=(timer_subframe+4)%10; - proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); + + // FDD and TDD tx timing settings. + // XXX:It is the result of timing adjustment in debug. + // It is necessary to investigate why this will work in the future. + proc->subframe_tx=(timer_subframe+sf_ahead)%10; + proc->frame_tx = proc->frame_rx + (proc->subframe_rx>(9-sf_ahead)?1:0); //oai_subframe_ind(proc->frame_rx, proc->subframe_rx); - - oai_subframe_ind(timer_frame, timer_subframe); + if(UE->frame_parms.frame_type == FDD){ + oai_subframe_ind(proc->frame_rx, proc->subframe_rx); + }else{ + oai_subframe_ind(proc->frame_tx,proc->subframe_tx); + } //Guessing that the next 4 lines are not needed for the phy_stub mode. /*initRefTimes(t2); @@ -1026,14 +1066,45 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + UL_INFO->cqi_ind.cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t)); + UL_INFO->cqi_ind.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t)); + UL_INFO->cqi_ind.number_of_cqis = 0; + if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST); + pthread_cond_broadcast(&phy_stub_ticking->cond_single_thread); + if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + }else{ + if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + while (phy_stub_ticking->num_single_thread[ue_thread_id] < 0) { + // most of the time, the thread is waiting here + LOG_D(MAC,"Waiting for single_thread (ue_thread_id %d)\n",ue_thread_id); + pthread_cond_wait( &phy_stub_ticking->cond_single_thread, &phy_stub_ticking->mutex_single_thread); + } + if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + } - for (Mod_id=0; Mod_idframe_parms, proc->subframe_rx); if ((sf_type == SF_DL) || (UE->frame_parms.frame_type == FDD) || @@ -1059,12 +1130,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { if (dl_config_req!=NULL && tx_request_pdu_list!=NULL){ //if(dl_config_req!= NULL) { - dl_config_req_UE_MAC(dl_config_req, Mod_id); + dl_config_req_UE_MAC(dl_config_req, ue_Mod_id); } if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ - hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id); + hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id); } if(nfapi_mode!=3) @@ -1078,7 +1149,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { if (UE->mac_enabled==1) { - ret = ue_scheduler(UE->Mod_id, + ret = ue_scheduler(ue_Mod_id, proc->frame_rx, proc->subframe_rx, proc->frame_tx, @@ -1104,34 +1175,37 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { // We make the start of RA between consecutive UEs differ by 20 frames //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) { - + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { + next_ra_frame++; + if(next_ra_frame > 200){ // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[Mod_id].SI_Decoded == 1) { + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { // The one working strangely... //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); if(prach_resources!=NULL ) { - UE_mac_inst[Mod_id].ra_frame = proc->frame_rx; - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d \n", Mod_id ); - fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = Mod_id + 1; - next_ra_frame = (proc->frame_rx + 20)%1000; + UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id ,proc->frame_tx, proc->subframe_tx); + fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (proc->frame_rx + 20)%1000; + next_ra_frame = 0; } //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } + } } // mode is PRACH // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which correspond to UL traffic. if(ul_config_req!=NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); } } @@ -1140,6 +1214,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { } //for (Mod_id=0; Mod_idnum_single_thread[ue_thread_id] = -1; + + // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. + if(ue_thread_id == 0){ + do{ + end_flag = 1; + for(uint16_t i = 0;i< NB_THREAD_INST;i++){ + if(phy_stub_ticking->num_single_thread[i] == 0){ + end_flag = 0; + } + } + }while(end_flag == 0); + if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0) { @@ -1154,6 +1241,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); oai_nfapi_rx_ind(&UL_INFO->rx_ind); + for(uint8_t num_pdu = 0;num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus;num_pdu++){ + free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data); + } //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; } @@ -1190,14 +1280,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; //} - + free(UL_INFO->cqi_ind.cqi_pdu_list); + UL_INFO->cqi_ind.cqi_pdu_list = NULL; + free(UL_INFO->cqi_ind.cqi_raw_pdu_list); + UL_INFO->cqi_ind.cqi_raw_pdu_list = NULL; free(UL_INFO); UL_INFO = NULL; // De-allocate memory of nfapi requests copies before next subframe round if(dl_config_req!=NULL){ - if(dl_config_req->vendor_extension) - free(dl_config_req->vendor_extension); + if(dl_config_req->vendor_extension!=NULL){ + free(dl_config_req->vendor_extension); + dl_config_req->vendor_extension = NULL; + } if(dl_config_req->dl_config_request_body.dl_config_pdu_list!=NULL){ free(dl_config_req->dl_config_request_body.dl_config_pdu_list); dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; @@ -1227,7 +1322,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { hi_dci0_req = NULL; } - + } } // thread finished @@ -1771,6 +1866,13 @@ void init_UE_single_thread_stub(int nb_inst) { AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); AssertFatal(PHY_vars_UE_g[i]!=NULL,"PHY_vars_UE_g[inst] is NULL\n"); AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n"); + if(nfapi_mode == 3){ +#ifdef NAS_UE + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE); + itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p); +#endif + } } UE = PHY_vars_UE_g[0][0]; @@ -1785,19 +1887,22 @@ void init_UE_single_thread_stub(int nb_inst) { // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; - for (int i=0; iUE = UE; - rtd->proc = &UE->proc.proc_rxtx[i]; - - pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL); - pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); - UE->proc.proc_rxtx[i].sub_frame_start=i; - UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; - printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i); - pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd); + for(uint16_t ue_thread_id = 0;ue_thread_id < NB_THREAD_INST;ue_thread_id++){ + UE = PHY_vars_UE_g[ue_thread_id][0]; + for (int i=0; iUE = UE; + rtd->proc = &UE->proc.proc_rxtx[i]; + rtd->ue_thread_id = ue_thread_id; + pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL); + pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); + UE->proc.proc_rxtx[i].sub_frame_start=i; + UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; + printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i); + pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd); + } } // Remove thread for UE_sync in phy_stub_UE mode. //pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE); @@ -1862,7 +1967,7 @@ void init_UE_threads_stub(int inst) { #ifdef OPENAIR2 void fill_ue_band_info(void) { - UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability; + LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability; int i,j; bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; @@ -2067,8 +2172,11 @@ int init_timer_thread(void) { pthread_mutex_init(&UE->timer_mutex,NULL); pthread_cond_init(&UE->timer_cond,NULL); UE->instance_cnt_timer = -1; + memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST); pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); + pthread_mutex_init(&phy_stub_ticking->mutex_single_thread,NULL); + pthread_cond_init(&phy_stub_ticking->cond_single_thread,NULL); pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL); return 0; } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index a92226992f..9897b92f58 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file lte-enb.c +/*! \file lte-uesoftmodem.c * \brief Top-level threads for eNodeB * \author R. Knopp, F. Kaltenberger, Navid Nikaein * \date 2012 @@ -34,9 +34,6 @@ #define _GNU_SOURCE /* See feature_test_macros(7) */ #include - -#include "T.h" - #include "rt_wrapper.h" @@ -76,38 +73,36 @@ #include "UTIL/MATH/oml.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" -#include "enb_config.h" -//#include "PHY/TOOLS/time_meas.h" #ifndef OPENAIR2 -#include "UTIL/OTG/otg_vars.h" + #include "UTIL/OTG/otg_vars.h" #endif #if defined(ENABLE_ITTI) -#include "create_tasks.h" + #include "create_tasks.h" #endif #include "system.h" #ifdef XFORMS -#include "PHY/TOOLS/lte_phy_scope.h" -#include "stats.h" + #include "PHY/TOOLS/lte_phy_scope.h" + #include "stats.h" #endif #include "lte-softmodem.h" -RAN_CONTEXT_t RC; + /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; #ifdef XFORMS -// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) -// at eNB 0, an UL scope for every UE -FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; -FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; -char title[255]; -unsigned char scope_enb_num_ue = 2; -static pthread_t forms_thread; //xforms + // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) + // at eNB 0, an UL scope for every UE + FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; + FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; + char title[255]; + unsigned char scope_enb_num_ue = 2; + static pthread_t forms_thread; //xforms #endif //XFORMS pthread_cond_t nfapi_sync_cond; @@ -115,9 +110,13 @@ pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex uint8_t nfapi_mode = 0; - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION +uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif +#endif uint16_t sf_ahead=2; - +int tddflag; char *emul_iface; @@ -130,19 +129,18 @@ uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100] #if defined(ENABLE_ITTI) -volatile int start_eNB = 0; -volatile int start_UE = 0; + volatile int start_eNB = 0; + volatile int start_UE = 0; #endif volatile int oai_exit = 0; -static clock_source_t clock_source = internal,time_source=internal; + +clock_source_t clock_source = internal,time_source=internal; static int wait_for_sync = 0; unsigned int mmapped_dma=0; -int single_thread_flag=1; -static int8_t threequarter_fs=0; uint32_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; @@ -176,11 +174,6 @@ double bw = 10.0e6; static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; -char rf_config_file[1024]; - -int chain_offset=0; -int phy_test = 0; -uint8_t usim_test = 0; uint8_t dci_Format = 0; uint8_t agregation_Level =0xFF; @@ -194,62 +187,34 @@ char channels[128] = "0"; int rx_input_level_dBm; #ifdef XFORMS -extern int otg_enabled; -static char do_forms=0; -#else -int otg_enabled; + extern int otg_enabled; #endif //int number_of_cards = 1; static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; -uint32_t timing_advance = 0; + uint8_t exit_missed_slots=1; uint64_t num_missed_slots=0; // counter for the number of missed slots - +/* prototypes from function implemented in lte-ue.c, probably should be elsewhere in a include + file */ extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface); -extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t UE_id, - uint8_t abstraction_flag); +extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t UE_id, + uint8_t abstraction_flag); +extern void get_uethreads_params(void); int transmission_mode=1; -int emulate_rf = 0; -int numerology = 0; -char *parallel_config = NULL; -char *worker_config = NULL; -char* usrp_args=NULL; -char* usrp_clksrc=NULL; -static THREAD_STRUCT thread_struct; -void set_parallel_conf(char *parallel_conf) -{ - if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT; - else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT; - printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf); -} -void set_worker_conf(char *worker_conf) -{ - if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE; - else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE; - printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf); -} -PARALLEL_CONF_t get_thread_parallel_conf(void) -{ - return thread_struct.parallel_conf; -} -WORKER_CONF_t get_thread_worker_conf(void) -{ - return thread_struct.worker_conf; -} +char *usrp_args=NULL; +char *usrp_clksrc=NULL; +THREAD_STRUCT thread_struct; /* struct for ethernet specific parameters given in eNB conf file */ eth_params_t *eth_params; @@ -261,7 +226,7 @@ extern char uecap_xer[1024]; char uecap_xer_in=0; int oaisim_flag=0; -threads_t threads= {-1,-1,-1,-1,-1,-1,-1}; + /* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed * this is very hackish - find a proper solution @@ -278,6 +243,7 @@ struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 }; struct timespec clock_difftime(struct timespec start, struct timespec end) { struct timespec temp; + if ((end.tv_nsec-start.tv_nsec)<0) { temp.tv_sec = end.tv_sec-start.tv_sec-1; temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec; @@ -285,6 +251,7 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) { temp.tv_sec = end.tv_sec-start.tv_sec; temp.tv_nsec = end.tv_nsec-start.tv_nsec; } + return temp; } @@ -300,16 +267,21 @@ void update_difftimes(struct timespec start, struct timespec end) { struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 }; int changed = 0; diff_time = clock_difftime(start, end); + if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) { min_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; } + if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) { max_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; } + #if 1 + if (changed) print_difftimes(); + #endif } @@ -322,7 +294,8 @@ unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe) { return (dcoff_i_rxfe + (dcoff_q_rxfe<<8)); } -#if !defined(ENABLE_ITTI) + + void signal_handler(int sig) { void *array[10]; size_t size; @@ -330,47 +303,38 @@ void signal_handler(int sig) { if (sig==SIGSEGV) { // get void*'s for all entries on the stack size = backtrace(array, 10); - // print out all the frames to stderr fprintf(stderr, "Error: signal %d:\n", sig); backtrace_symbols_fd(array, size, 2); exit(-1); } else { - printf("trying to exit gracefully...\n"); - oai_exit = 1; + char msg[64]; + sprintf(msg,"Received linux signal %s...\n",strsignal(sig)); + exit_function(__FILE__, __FUNCTION__, __LINE__,msg); } } -#endif -#define KNRM "\x1B[0m" -#define KRED "\x1B[31m" -#define KGRN "\x1B[32m" -#define KBLU "\x1B[34m" -#define RESET "\033[0m" - -void exit_function(const char* file, const char* function, const int line, const char* s) -{ +void exit_function(const char *file, const char *function, const int line, const char *s) { int CC_id; - logClean(); - if (s != NULL) { - printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s); - } - + printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, ((s==NULL)?"":s)); oai_exit = 1; for(CC_id=0; CC_idrfdevice.trx_end_func) - PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); - } + if (PHY_vars_UE_g[0][CC_id]) + if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func) + PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); + } - sleep(1); //allow lte-softmodem threads to exit first + sleep(1); //allow lte-softmodem threads to exit first #if defined(ENABLE_ITTI) + + if(PHY_vars_UE_g != NULL ) itti_terminate_tasks (TASK_UNKNOWN); + #endif exit(1); } @@ -378,24 +342,21 @@ void exit_function(const char* file, const char* function, const int line, const #ifdef XFORMS -void reset_stats(FL_OBJECT *button, long arg) -{ +void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; for (i=0; idlsch[i][0]->Mlimit; j++) { - phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; } phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; - - phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; @@ -409,43 +370,35 @@ static void *scope_thread(void *arg) { FILE *UE_stats, *eNB_stats; # endif struct sched_param sched_param; - - sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; sched_setscheduler(0, SCHED_FIFO,&sched_param); - printf("Scope thread has priority %d\n",sched_param.sched_priority); - # ifdef ENABLE_XFORMS_WRITE_STATS - UE_stats = fopen("UE_stats.txt", "w"); - #endif while (!oai_exit) { // dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm); - //fl_set_object_label(form_stats->stats_text, stats_buffer); - fl_clear_browser(form_stats->stats_text); - fl_add_browser_line(form_stats->stats_text, stats_buffer); + //fl_set_object_label(form_stats->stats_text, stats_buffer); + fl_clear_browser(form_stats->stats_text); + fl_add_browser_line(form_stats->stats_text, stats_buffer); + phy_scope_UE(form_ue[0], + PHY_vars_UE_g[0][0], + 0, + 0,7); + // printf("%s",stats_buffer); + } - phy_scope_UE(form_ue[0], - PHY_vars_UE_g[0][0], - 0, - 0,7); - - // printf("%s",stats_buffer); - } # ifdef ENABLE_XFORMS_WRITE_STATS - if (UE_stats) { - rewind (UE_stats); - fwrite (stats_buffer, 1, len, UE_stats); - fclose (UE_stats); - } + if (UE_stats) { + rewind (UE_stats); + fwrite (stats_buffer, 1, len, UE_stats); + fclose (UE_stats); + } # endif - - pthread_exit((void*)arg); + pthread_exit((void *)arg); } #endif @@ -455,36 +408,34 @@ static void *scope_thread(void *arg) { void *l2l1_task(void *arg) { MessageDef *message_p = NULL; int result; - itti_set_task_real_time(TASK_L2L1); itti_mark_task_ready(TASK_L2L1); - do { // Wait for a message itti_receive_msg (TASK_L2L1, &message_p); switch (ITTI_MSG_ID(message_p)) { - case TERMINATE_MESSAGE: - oai_exit=1; - itti_exit_task (); - break; + case TERMINATE_MESSAGE: + oai_exit=1; + itti_exit_task (); + break; - case ACTIVATE_MESSAGE: - start_UE = 1; - break; + case ACTIVATE_MESSAGE: + start_UE = 1; + break; - case DEACTIVATE_MESSAGE: - start_UE = 0; - break; + case DEACTIVATE_MESSAGE: + start_UE = 0; + break; - case MESSAGE_TEST: - LOG_I(SIM, "Received %s\n", ITTI_MSG_NAME(message_p)); - break; + case MESSAGE_TEST: + LOG_I(SIM, "Received %s\n", ITTI_MSG_NAME(message_p)); + break; - default: - LOG_E(SIM, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); - break; + default: + LOG_E(SIM, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); @@ -497,108 +448,98 @@ void *l2l1_task(void *arg) { extern int16_t dlsch_demod_shift; -static void get_options(unsigned int *start_msc) { +static void get_options(void) { int CC_id; - int tddflag, nonbiotflag; + int tddflag; char *loopfile=NULL; - int dumpframe=0; - uint32_t online_log_messages; - uint32_t glog_level; - uint32_t start_telnetsrv; - paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; - paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; + int dumpframe=0; + int timingadv; set_default_frame_parms(frame_parms); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); - - if (strlen(in_path) > 0) { - opt_type = OPT_PCAP; - opt_enabled=1; - printf("Enabling OPT for PCAP with the following file %s \n",in_path); - } - if (strlen(in_ip) > 0) { - opt_enabled=1; - opt_type = OPT_WIRESHARK; - printf("Enabling OPT for wireshark for local interface"); - } - - config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); - if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { - set_glog_onlinelog(online_log_messages); - } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { - set_glog(glog_level); - } - if (start_telnetsrv) { - load_module_shlib("telnetsrv",NULL,0,NULL); - } - + /* unknown parameters on command line will be checked in main + after all init have been performed */ + CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT); + get_common_options(); + get_uethreads_params(); paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC; paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC; - - config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL); - CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); + if (loopfile != NULL) { - printf("Input file for hardware emulation: %s",loopfile); - mode=loop_through_memory; - input_fd = fopen(loopfile,"r"); - AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); + printf("Input file for hardware emulation: %s",loopfile); + mode=loop_through_memory; + input_fd = fopen(loopfile,"r"); + AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); } + get_softmodem_params()->hw_timing_advance = timingadv; + if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; + if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med; + if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp; + if (cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) - if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach; + if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach; + if (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) - if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect; - if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) - if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; + if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect; + + if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) + if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; + if (dumpframe > 0) mode = rx_dump_frame; - + for (CC_id=0; CC_iddl_CarrierFreq = downlink_frequency[0][0]; } + UE_scan=0; - if (tddflag > 0) { - for (CC_id=0; CC_idframe_type = TDD; + if (tddflag > 0) { + for (CC_id=0; CC_idframe_type = TDD; + frame_parms[CC_id]->tdd_config = tddflag; + } } if (frame_parms[0]->N_RB_DL !=0) { - if ( frame_parms[0]->N_RB_DL < 6 ) { - frame_parms[0]->N_RB_DL = 6; - printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 100 ) { - frame_parms[0]->N_RB_DL = 100; - printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) { - frame_parms[0]->N_RB_DL = 50; - printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL); - } - if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) { - frame_parms[0]->N_RB_DL = 25; - printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL); - } - UE_scan = 0; - frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL; - for (CC_id=1; CC_idN_RB_DL=frame_parms[0]->N_RB_DL; - frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL; - } + if ( frame_parms[0]->N_RB_DL < 6 ) { + frame_parms[0]->N_RB_DL = 6; + printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL); + } + + if ( frame_parms[0]->N_RB_DL > 100 ) { + frame_parms[0]->N_RB_DL = 100; + printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL); + } + + if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) { + frame_parms[0]->N_RB_DL = 50; + printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL); + } + + if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) { + frame_parms[0]->N_RB_DL = 25; + printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL); + } + + UE_scan = 0; + frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL; + + for (CC_id=1; CC_idN_RB_DL=frame_parms[0]->N_RB_DL; + frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL; + } } - - for (CC_id=1;CC_idframe_type = FDD; frame_parms[CC_id]->tdd_config = 3; @@ -634,9 +572,7 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->nb_antenna_ports_eNB = 1; frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_rx = 1; - frame_parms[CC_id]->nushift = 0; - frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth; frame_parms[CC_id]->phich_config_common.phich_duration = normal; // UL RS Config @@ -644,45 +580,38 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = 0; frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; - frame_parms[CC_id]->prach_config_common.rootSequenceIndex=22; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=1; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0; - downlink_frequency[CC_id][0] = DEFAULT_DLF; // Use float to avoid issue with frequency over 2^31. downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; - frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0]; - } - } void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) { - int card; int i; for (card=0; cardN_RB_DL == 100) { if (frame_parms->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; + openair0_cfg[card].sample_rate=23.04e6; + openair0_cfg[card].samples_per_frame = 230400; + openair0_cfg[card].tx_bw = 10e6; + openair0_cfg[card].rx_bw = 10e6; } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; + openair0_cfg[card].sample_rate=30.72e6; + openair0_cfg[card].samples_per_frame = 307200; + openair0_cfg[card].tx_bw = 10e6; + openair0_cfg[card].rx_bw = 10e6; } } else if(frame_parms->N_RB_DL == 50) { openair0_cfg[card].sample_rate=15.36e6; @@ -701,67 +630,58 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) { openair0_cfg[card].rx_bw = 1.5e6; } - - - if (frame_parms->frame_type==TDD) openair0_cfg[card].duplex_mode = duplex_mode_TDD; else //FDD openair0_cfg[card].duplex_mode = duplex_mode_FDD; openair0_cfg[card].Mod_id = 0; - openair0_cfg[card].num_rb_dl=frame_parms->N_RB_DL; - openair0_cfg[card].clock_source = clock_source; - - openair0_cfg[card].tx_num_channels=min(2,frame_parms->nb_antennas_tx); openair0_cfg[card].rx_num_channels=min(2,frame_parms->nb_antennas_rx); for (i=0; i<4; i++) { - if (irf_config_file; printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", - card,i, openair0_cfg[card].tx_gain[i], - openair0_cfg[card].rx_gain[i], - openair0_cfg[card].tx_freq[i], - openair0_cfg[card].rx_freq[i]); + card,i, openair0_cfg[card].tx_gain[i], + openair0_cfg[card].rx_gain[i], + openair0_cfg[card].tx_freq[i], + openair0_cfg[card].rx_freq[i]); } if (usrp_args) openair0_cfg[card].sdr_addrs = usrp_args; + if (usrp_clksrc) { if (strcmp(usrp_clksrc, "internal") == 0) { - openair0_cfg[card].clock_source = internal; - LOG_D(PHY, "USRP clock source set as internal\n"); + openair0_cfg[card].clock_source = internal; + LOG_D(PHY, "USRP clock source set as internal\n"); } else if (strcmp(usrp_clksrc, "external") == 0) { - openair0_cfg[card].clock_source = external; - LOG_D(PHY, "USRP clock source set as external\n"); + openair0_cfg[card].clock_source = external; + LOG_D(PHY, "USRP clock source set as external\n"); } else if (strcmp(usrp_clksrc, "gpsdo") == 0) { - openair0_cfg[card].clock_source = gpsdo; - LOG_D(PHY, "USRP clock source set as gpsdo\n"); + openair0_cfg[card].clock_source = gpsdo; + LOG_D(PHY, "USRP clock source set as gpsdo\n"); } else { - openair0_cfg[card].clock_source = internal; - LOG_I(PHY, "USRP clock source unknown ('%s'). defaulting to internal\n", usrp_clksrc); + openair0_cfg[card].clock_source = internal; + LOG_I(PHY, "USRP clock source unknown ('%s'). defaulting to internal\n", usrp_clksrc); } } else { openair0_cfg[card].clock_source = internal; - LOG_I(PHY, "USRP clock source not specified. defaulting to internal\n"); + LOG_I(PHY, "USRP clock source not specified. defaulting to internal\n"); } } } @@ -773,8 +693,7 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) { /* * helper function to terminate a certain ITTI task */ -void terminate_task(task_id_t task_id, module_id_t mod_id) -{ +void terminate_task(task_id_t task_id, module_id_t mod_id) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id); MessageDef *msg; msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE); @@ -788,7 +707,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) static inline void wait_nfapi_init(char *thread_name) { - printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); pthread_mutex_lock( &nfapi_sync_mutex ); @@ -796,70 +714,71 @@ static inline void wait_nfapi_init(char *thread_name) { pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex ); pthread_mutex_unlock(&nfapi_sync_mutex); - printf( "NFAPI: got sync (%s)\n", thread_name); } -int stop_L1L2(module_id_t enb_id) -{ - return 0; +int stop_L1L2(module_id_t enb_id) { + return 0; } -int restart_L1L2(module_id_t enb_id) -{ - return 0; +int restart_L1L2(module_id_t enb_id) { + return 0; } -int main( int argc, char **argv ) -{ +int main( int argc, char **argv ) { #if defined (XFORMS) void *status; #endif - int CC_id; uint8_t abstraction_flag=0; - unsigned int start_msc=0; - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list)); +#endif +#endif // Default value for the number of UEs. It will hold, // if not changed from the command line option --num-ues NB_UE_INST=1; - + NB_THREAD_INST=1; #if defined (XFORMS) int ret; #endif - start_background_system(); - if ( load_configmodule(argc,argv) == NULL) { - exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); - } - + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } mode = normal_txrx; memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS); - - set_latency_target(); - logInit(); - printf("Reading in command-line options\n"); - for (int i=0;i 1 && simL1flag != 1) { + + if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) { printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n"); abort(); } printf("NFAPI_MODE value: %d \n", nfapi_mode); + // Checking option of nums_ue_thread. + if(NB_THREAD_INST < 1){ + printf("Running with 0 UE rxtx thread, exiting.\n"); + abort(); + } + // Checking option's relation between nums_ue_thread and num-ues + if(NB_UE_INST start_msc) { + load_module_shlib("msc",NULL,0,&msc_interface); } + MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); #endif @@ -913,68 +825,176 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con pdcp_netlink_init(); #endif #endif - -//TTN for D2D -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + //TTN for D2D +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) printf ("RRC control socket\n"); rrc_control_socket_init(); printf ("PDCP PC5S socket\n"); pdcp_pc5_socket_init(); #endif - -#if !defined(ENABLE_ITTI) // to make a graceful exit when ctrl-c is pressed signal(SIGSEGV, signal_handler); signal(SIGINT, signal_handler); -#endif - - + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); check_clock(); - #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" #endif - LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); // init the parameters for (CC_id=0; CC_idnb_antennas_tx = nb_antenna_tx; - frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx; - frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later + frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx; + frame_parms[CC_id]->nb_antennas_rx = nb_antenna_rx; + frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later } - - NB_INST=1; - if(nfapi_mode == 3){ - PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**)*NB_UE_INST); - for (int i=0; imac_enabled = 0; - else - PHY_vars_UE_g[i][CC_id]->mac_enabled = 1; - } - } - } - else init_openair0(frame_parms[0],(int)rx_gain[0][0]); + for (int i=0; iphy_test==1) + PHY_vars_UE_g[i][CC_id]->mac_enabled = 0; + else + PHY_vars_UE_g[i][CC_id]->mac_enabled = 1; + } + } + } else init_openair0(frame_parms[0],(int)rx_gain[0][0]); if (simL1flag==1) { - AssertFatal(NULL!=load_configmodule(argc,argv), + AssertFatal(NULL!=load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY), "[SOFTMODEM] Error, configuration module init failed\n"); - RCConfig_sim(); } +// source code written in below moved to later to avoid keeping waiting for nfapi_sync_cond in wait_nfapi_init. +/* // start the main UE threads int eMBMS_active = 0; + if (nfapi_mode==3) { // UE-STUB-PNF + config_sync_var=0; + wait_nfapi_init("main?"); + //Panos: Temporarily we will be using single set of threads for multiple UEs. + //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface); + init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); + } else { + init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], + frame_parms[0]); + } + + if (get_softmodem_params()->phy_test==0) { + printf("Filling UE band info\n"); + fill_ue_band_info(); + dl_phy_sync_success (0, 0, 0, 1); + } + + if (nfapi_mode!=3) { + number_of_cards = 1; + + for(CC_id=0; CC_idrf_map.card=0; + PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); + } + } +*/ + + cpuf=get_cpu_freq_GHz(); +#ifndef DEADLINE_SCHEDULER + printf("NO deadline scheduler\n"); + /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */ + cpu_set_t cpuset; + int s; + char cpu_affinity[1024]; + CPU_ZERO(&cpuset); +#ifdef CPU_AFFINITY + + if (get_nprocs() > 2) { + CPU_SET(0, &cpuset); + s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + + if (s != 0) { + perror( "pthread_setaffinity_np"); + exit_fun("Error setting processor affinity"); + } + + LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n"); + } + +#endif + /* Check the actual affinity mask assigned to the thread */ + s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + + if (s != 0) { + perror( "pthread_getaffinity_np"); + exit_fun("Error getting processor affinity "); + } + + memset(cpu_affinity, 0 , sizeof(cpu_affinity)); + + for (int j = 0; j < CPU_SETSIZE; j++) { + if (CPU_ISSET(j, &cpuset)) { + char temp[1024]; + sprintf(temp, " CPU_%d ", j); + strcat(cpu_affinity, temp); + } + } + + LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); +#endif +#if defined(ENABLE_ITTI) + if (create_tasks_ue(NB_UE_INST) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } + + if(nfapi_mode==3) { // Here we should add another nfapi_mode for the case of Supervised LTE-D2D + UE_config_stub_pnf(); + } + + printf("ITTI tasks created\n"); +#endif + mlockall(MCL_CURRENT | MCL_FUTURE); + rt_sleep_ns(10*100000000ULL); + const char *nfapi_mode_str = ""; + // start the main UE threads + int eMBMS_active = 0; + + switch(nfapi_mode) { + case 0: + nfapi_mode_str = "MONOLITHIC"; + break; + + case 1: + nfapi_mode_str = "PNF"; + break; + + case 2: + nfapi_mode_str = "VNF"; + break; + + case 3: + nfapi_mode_str = "UE_STUB_PNF"; + break; + + case 4: + nfapi_mode_str = "UE_STUB_OFFNET"; + break; + + default: + nfapi_mode_str = ""; + break; + } + + printf("NFAPI MODE:%s\n", nfapi_mode_str); + if (nfapi_mode==3) // UE-STUB-PNF { config_sync_var=0; @@ -984,12 +1004,12 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); } else { - init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], + init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], frame_parms[0]); } - if (phy_test==0) { + if (get_softmodem_params()->phy_test==0) { printf("Filling UE band info\n"); fill_ue_band_info(); dl_phy_sync_success (0, 0, 0, 1); @@ -999,185 +1019,89 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con number_of_cards = 1; for(CC_id=0; CC_idrf_map.card=0; - PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; + PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); } } - - - cpuf=get_cpu_freq_GHz(); - - - -#ifndef DEADLINE_SCHEDULER - - printf("NO deadline scheduler\n"); - /* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */ - - cpu_set_t cpuset; - int s; - char cpu_affinity[1024]; - CPU_ZERO(&cpuset); -#ifdef CPU_AFFINITY - if (get_nprocs() > 2) { - CPU_SET(0, &cpuset); - s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - if (s != 0) { - perror( "pthread_setaffinity_np"); - exit_fun("Error setting processor affinity"); - } - LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n"); - } -#endif - - /* Check the actual affinity mask assigned to the thread */ - s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - if (s != 0) { - perror( "pthread_getaffinity_np"); - exit_fun("Error getting processor affinity "); - } - memset(cpu_affinity, 0 , sizeof(cpu_affinity)); - for (int j = 0; j < CPU_SETSIZE; j++) { - if (CPU_ISSET(j, &cpuset)) { - char temp[1024]; - sprintf(temp, " CPU_%d ", j); - strcat(cpu_affinity, temp); - } - } - LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity); -#endif - - - - -#if defined(ENABLE_ITTI) - if (create_tasks_ue(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode - } - if(nfapi_mode==3){ // Here we should add another nfapi_mode for the case of Supervised LTE-D2D - UE_config_stub_pnf(); - } - printf("ITTI tasks created\n"); -#endif - - - mlockall(MCL_CURRENT | MCL_FUTURE); - - - rt_sleep_ns(10*100000000ULL); - - const char *nfapi_mode_str = ""; - - switch(nfapi_mode) - { - case 0: - nfapi_mode_str = "MONOLITHIC"; - break; - case 1: - nfapi_mode_str = "PNF"; - break; - case 2: - nfapi_mode_str = "VNF"; - break; - case 3: - nfapi_mode_str = "UE_STUB_PNF"; - break; - case 4: - nfapi_mode_str = "UE_STUB_OFFNET"; - break; - default: - nfapi_mode_str = ""; - break; - } - printf("NFAPI MODE:%s\n", nfapi_mode_str); - - // connect the TX/RX buffers - - /* - if(nfapi_mode!=3) { - if (setup_ue_buffers(PHY_vars_UE_g[0],&openair0_cfg[0])!=0) { - printf("Error setting up eNB buffer\n"); - exit(-1); - } + /* + if(nfapi_mode!=3) { + if (setup_ue_buffers(PHY_vars_UE_g[0],&openair0_cfg[0])!=0) { + printf("Error setting up eNB buffer\n"); + exit(-1); } - */ - - - - if (input_fd) { - printf("Reading in from file to antenna buffer %d\n",0); - if (fread(PHY_vars_UE_g[0][0]->common_vars.rxdata[0], - sizeof(int32_t), - frame_parms[0]->samples_per_tti*10, - input_fd) != frame_parms[0]->samples_per_tti*10) - printf("error reading from file\n"); - } - //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX; - - - if (simL1flag==1) { - init_ocm((double)snr_dB,0); - PHY_vars_UE_g[0][0]->no_timing_correction = 1; } - + */ + if (input_fd) { + printf("Reading in from file to antenna buffer %d\n",0); + + if (fread(PHY_vars_UE_g[0][0]->common_vars.rxdata[0], + sizeof(int32_t), + frame_parms[0]->samples_per_tti*10, + input_fd) != frame_parms[0]->samples_per_tti*10) + printf("error reading from file\n"); + } + + //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX; + + if (simL1flag==1) { + init_ocm((double)snr_dB,0); + PHY_vars_UE_g[0][0]->no_timing_correction = 1; + } #ifdef XFORMS int UE_id; - printf("XFORMS\n"); - if (do_forms==1) { + if (get_softmodem_params()->do_forms==1) { fl_initialize (&argc, argv, NULL, 0, 0); - - form_stats = create_form_stats_form(); - fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); - UE_id = 0; - form_ue[UE_id] = create_lte_phy_scope_ue(); - sprintf (title, "LTE DL SCOPE UE"); - fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - - /* - if (openair_daq_vars.use_ia_receiver) { - fl_set_button(form_ue[UE_id]->button_0,1); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON"); - } else { - fl_set_button(form_ue[UE_id]->button_0,0); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); - }*/ - fl_set_button(form_ue[UE_id]->button_0,0); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); + form_stats = create_form_stats_form(); + fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); + UE_id = 0; + form_ue[UE_id] = create_lte_phy_scope_ue(); + sprintf (title, "LTE DL SCOPE UE"); + fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); + /* + if (openair_daq_vars.use_ia_receiver) { + fl_set_button(form_ue[UE_id]->button_0,1); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON"); + } else { + fl_set_button(form_ue[UE_id]->button_0,0); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); + }*/ + fl_set_button(form_ue[UE_id]->button_0,0); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); - + if (ret == 0) pthread_setname_np( forms_thread, "xforms" ); - + printf("Scope thread created, ret=%d\n",ret); } - -#endif - - printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex); - +#endif + ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); + + if (ret != 0) { + LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret); + exit_fun(""); + } + + printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex); pthread_mutex_lock(&sync_mutex); sync_var=0; pthread_cond_broadcast(&sync_cond); pthread_mutex_unlock(&sync_mutex); - printf("sync sent\n"); -/* - printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - end_configmodule(); - printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); -*/ + /* + printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + end_configmodule(); + printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + */ // wait for end of program printf("TYPE TO TERMINATE\n"); //getchar(); - - #if defined(ENABLE_ITTI) printf("Entering ITTI signals handler\n"); itti_wait_tasks_end(); @@ -1186,17 +1110,16 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con printf("oai_exit=%d\n",oai_exit); #else - while (oai_exit==0) - rt_sleep_ns(100000000ULL); - printf("Terminating application - oai_exit=%d\n",oai_exit); + while (oai_exit==0) + rt_sleep_ns(100000000ULL); + printf("Terminating application - oai_exit=%d\n",oai_exit); #endif - // stop threads #ifdef XFORMS printf("waiting for XFORMS thread\n"); - if (do_forms==1) { + if (get_softmodem_params()->do_forms==1) { pthread_join(forms_thread,&status); fl_hide_form(form_stats->stats_form); fl_free_form(form_stats->stats_form); @@ -1205,9 +1128,7 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con } #endif - printf("stopping MODEM threads\n"); - pthread_cond_destroy(&sync_cond); pthread_mutex_destroy(&sync_mutex); @@ -1216,13 +1137,11 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con // *** Handle per CC_id openair0 if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func) PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice); - + if (opt_enabled == 1) terminate_opt(); - - logClean(); + logClean(); printf("Bye.\n"); - return 0; } diff --git a/targets/RT/USER/rfsim.c b/targets/RT/USER/rfsim.c index 06b7617519..67f129e936 100644 --- a/targets/RT/USER/rfsim.c +++ b/targets/RT/USER/rfsim.c @@ -62,7 +62,9 @@ sim_t sim; void init_ru_devices(void); + void init_RU(const char*,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync); + void *rfsim_top(void *n_frames); void wait_RUs(void)