diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 3042ada815afe4ad4a60c7efb4a096ee432f3187..54be9b653d53d92ad8720c82e3ec39e949fa5076 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -136,16 +136,6 @@ 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" } - // With Mosaic 5G being part of OSA and making all it's repositories public - // No need to pass credentials to clone flexran-rtc - if (doMandatoryTests) { - sh "mkdir flexran" - dir ('flexran') { - sh "git clone https://gitlab.eurecom.fr/flexran/flexran-rtc.git . > ../git_clone.log 2>&1" - sh "git checkout develop >> ../git_clone.log 2>&1" - sh "zip -r -qq flexran.zip ." - } - } } } post { @@ -159,16 +149,6 @@ pipeline { } } - stage ("Start VM -- basic-sim") { - steps { - lock (vmResource) { - timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Start VM -- gnb-usrp") { steps { lock (vmResource) { @@ -211,15 +191,6 @@ pipeline { stage ("Variant Builds") { parallel { - stage ("Build basic simulator") { - steps { - gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 45, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } - } - } - } stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { @@ -270,9 +241,9 @@ pipeline { script { dir ('archives') { if (fileExists('red_hat')) { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + sh "zip -r -qq vm_build_logs.zip enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" } else { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp" + sh "zip -r -qq vm_build_logs.zip enb_eth ue_eth gnb_usrp nr_ue_usrp" } } if(fileExists('archives/vm_build_logs.zip')) { @@ -306,44 +277,6 @@ pipeline { parallel { stage ("VM-based tests") { stages { - stage ("Build Flexran Controller") { - when { - expression {doMandatoryTests} - } - steps { - lock (vmResource) { - script { - timeout (time: 20, unit: 'MINUTES') { - try { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant flexran-rtc --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } - stage ("Test basic simulator") { - when { - expression {doMandatoryTests} - } - steps { - lock (vmResource) { - script { - timeout (time: 30, unit: 'MINUTES') { - try { - gitlabCommitStatus(name: "Test basic-sim") { - sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } stage ("Test L1 simulator") { when { expression {doMandatoryTests} @@ -581,7 +514,7 @@ pipeline { script { if (doMandatoryTests) { dir ('archives') { - sh "if [ -d basic_sim/test ] || [ -d rf_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + sh "if [ -d rf_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' diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index f4cf3931dd327827dc36731ce8d45855059f3c00..eaca22f550b3cefc0ac36e66409840821f2a7962 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -62,7 +62,7 @@ function build_on_vm { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index 7e6590cde28709d4803f7faeb04bab8b13efb6f7..8b14b7455681031550803aaeb63ed19c81f52ada 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -258,7 +258,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 3eeaac9875a4e7704e8efc09bb12c05d925169e2..02035ea827c2965a4c96314b28f7316ddf31e494 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -254,7 +254,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index c7ae67610810c3ce3966f6adc8870c4d684dcde2..84b66060d978b97862af6291e6cf1bef10065399 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -232,7 +232,7 @@ RUs = ( bf_weights = [0x00007fff, 0x00007fff]; #clock_src = "external"; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index 3d94d65f6e748d27c2be6df24fd953ee15067e7a..9f5c2875b39c80e73c59efdbb22815ca3e64d524 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -261,7 +261,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 83e947411d7196b138dbafee53ed1e5942e15d4f..594bd5e4c82dc0a1db81e39e61cc9ad392060e66 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -265,7 +265,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index c5effb39cd159287717852b0fc54b7adea8657f0..2361437f7c7c1b4004850bd1e0252d5f8dea823d 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -260,7 +260,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/doc/vm_based_simulator_build.md b/ci-scripts/doc/vm_based_simulator_build.md index 28fbc955d59de0788ac3032065f9288c94f16ec2..16faa3ce9bff5433536dcd0c2ce4fc14e1bfaca4 100644 --- a/ci-scripts/doc/vm_based_simulator_build.md +++ b/ci-scripts/doc/vm_based_simulator_build.md @@ -52,7 +52,6 @@ Options: -------- # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) diff --git a/ci-scripts/doc/vm_based_simulator_create.md b/ci-scripts/doc/vm_based_simulator_create.md index 09ce26c5536956c9891e4c0683970e291d2e2236..46817380385a9e8d4fca3d60dd30cd686c3266b4 100644 --- a/ci-scripts/doc/vm_based_simulator_create.md +++ b/ci-scripts/doc/vm_based_simulator_create.md @@ -45,7 +45,6 @@ Mandatory Options: # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) diff --git a/ci-scripts/doc/vm_based_simulator_main_scripts.md b/ci-scripts/doc/vm_based_simulator_main_scripts.md index 000d89a1eba1fbbd6c3ae0c81cba953e29251774..0d54d035210018cc8c36b793fe18889c785f75b2 100644 --- a/ci-scripts/doc/vm_based_simulator_main_scripts.md +++ b/ci-scripts/doc/vm_based_simulator_main_scripts.md @@ -109,12 +109,6 @@ You can get the list of variant specific variables specifying the variant argume NB_PATTERN_FILES=9 BUILD_OPTIONS="" LOG_PATTERN=.Rel15.txt - --variant basic-sim OR -v2 ( build and test ) - VM_NAME=ci-basic-sim ARCHIVES_LOC=basic_sim - VM_MEMORY=8192 VM_CPU=4 - NB_PATTERN_FILES=13 BUILD_OPTIONS="--eNB --UE" - LOG_PATTERN=.Rel15.txt - --variant phy-sim OR -v3 ( build and test ) VM_NAME=ci-phy-sim ARCHIVES_LOC=phy_sim VM_MEMORY=2048 VM_CPU=4 diff --git a/ci-scripts/doc/vm_based_simulator_test.md b/ci-scripts/doc/vm_based_simulator_test.md index 73308b972e5fa4eef268cb7fd496ca0cc6c73462..ab2810154381dfae15569b6d9555edbe98d05d92 100644 --- a/ci-scripts/doc/vm_based_simulator_test.md +++ b/ci-scripts/doc/vm_based_simulator_test.md @@ -18,16 +18,14 @@ 2. [Detailed Description](#2-detailed-description) 3. [Typical Usage](#3-typical-usage) 1. [Testing the physical simulators](#31-testing-the-physicals-simulators) - 2. [Testing the basic simulator](#32-testing-the-basic-simulator) - 3. [Testing the RF simulator](#33-testing-the-rf-simulator) - 4. [Testing the L2-nFAPI simulator](#33-testing-the-l2-nfapi-simulator) + 2. [Testing the RF simulator](#33-testing-the-rf-simulator) + 3. [Testing the L2-nFAPI simulator](#33-testing-the-l2-nfapi-simulator) # 1. Introduction # -Currently 2 build variants can be directly tested: +Currently 1 build variant can be directly tested: * Physical Simulators -* Basic Simulator In addition, 2 build variants are used: @@ -73,7 +71,6 @@ Options: # OpenAirInterface Build Variants --variant enb-usrp OR -v1 ( build and test ) - --variant basic-sim OR -v2 ( build and test ) --variant phy-sim OR -v3 ( build and test ) --variant cppcheck OR -v4 ( build and test ) --variant gnb-usrp OR -v5 ( build and test ) @@ -143,64 +140,7 @@ $ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-dev Note that the VM instance is destroyed. You do that when you are sure your test is passing. -## 3.2. Testing the basic simulator ## - -```bash -$ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant basic-sim --job-name RAN-CI-develop --build-id 48 -15:11:13 ############################################################ -15:11:13 OAI CI VM script -15:11:13 ############################################################ -15:11:13 VM_NAME = RAN-CI-develop-b48-basic-sim -15:11:13 VM_CMD_FILE = RAN-CI-develop-b48-basic-sim_cmds.txt -15:11:13 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop -15:11:13 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/basic_sim/test -15:11:13 ############################################################ -15:11:13 Waiting for VM to be started -15:11:13 ############################################################ -15:11:14 Warning: Permanently added '192.168.122.29' (ECDSA) to the list of known hosts. -15:11:15 RAN-CI-develop-b48-basic-sim has for IP addr = 192.168.122.29 -15:11:15 ############################################################ -15:11:15 Test EPC on VM (RAN-CI-develop-b48-epc) will be using ltebox -15:11:15 ############################################################ -15:11:15 EPC_VM_CMD_FILE = RAN-CI-develop-b48-epc_cmds.txt -15:11:15 ############################################################ -15:11:15 Creating test EPC VM (RAN-CI-develop-b48-epc) on Ubuntu Cloud Image base -15:11:15 ############################################################ -15:11:18 Waiting for VM to be started -15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts. -15:13:25 RAN-CI-develop-b48-epc has for IP addr = 192.168.122.156 -15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts. -15:13:25 ls: cannot access '/opt/ltebox/tools/start_ltebox': No such file or directory -15:13:25 ############################################################ -15:13:25 Copying ltebox archives into EPC VM (RAN-CI-develop-b48-epc) -15:13:25 ############################################################ -15:13:25 ############################################################ -15:13:25 Install EPC on EPC VM (RAN-CI-develop-b48-epc) -15:13:25 ############################################################ -.... -15:24:39 ############################################################ -15:24:39 Terminate EPC -15:24:39 ############################################################ -15:24:39 cd /opt/ltebox/tools -15:24:39 sudo ./stop_ltebox -15:24:40 sudo daemon --name=simulated_hss --stop -15:24:40 sudo killall --signal SIGKILL hss_sim -15:24:40 ############################################################ -15:24:40 Destroying VMs -15:24:40 ############################################################ -15:24:41 # Host 192.168.122.29 found: line 18 -15:24:41 /home/eurecom/.ssh/known_hosts updated. -15:24:41 Original contents retained as /home/eurecom/.ssh/known_hosts.old -15:24:43 # Host 192.168.122.60 found: line 20 -15:24:43 /home/eurecom/.ssh/known_hosts updated. -15:24:43 Original contents retained as /home/eurecom/.ssh/known_hosts.old -15:24:43 ############################################################ -15:24:43 Checking run status -15:24:43 ############################################################ -15:24:43 STATUS seems OK -``` - -## 3.3. Test the RF simulator ## +## 3.2. Test the RF simulator ## ```bash ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant rf-sim --job-name RAN-CI-develop --build-id 48 --keep-vm-alive @@ -209,7 +149,7 @@ $ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-dev 15:24:45 STATUS seems OK ``` -## 3.4. Testing the L2-nFAPI simulator +## 3.3. Testing the L2-nFAPI simulator ```bash ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant l2-sim --job-name RAN-CI-develop --build-id 48 diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 5ee653c8e15768303ff5a67d505c13ce95157bb1..8363c91461a1800e5d6a792ce4c86de34dc9031c 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -174,7 +174,7 @@ function variant__v1__enb_usrp { BUILD_OPTIONS="--eNB -w USRP --mu" VM_MEMORY=3072 } - + function variant__v2__basic_sim { NB_PATTERN_FILES=11 BUILD_OPTIONS="--eNB --UE" @@ -200,28 +200,28 @@ function variant__v4__cppcheck { function variant__v5__gnb_usrp { VM_MEMORY=10240 VM_CPU=8 - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--gNB -w USRP" } function variant__v6__nr_ue_usrp { VM_MEMORY=4096 VM_CPU=4 - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--nrUE -w USRP" } function variant__v7__enb_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=enb_eth - NB_PATTERN_FILES=7 + NB_PATTERN_FILES=6 BUILD_OPTIONS="--eNB -w USRP" } function variant__v8__ue_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=ue_eth - NB_PATTERN_FILES=11 + NB_PATTERN_FILES=10 BUILD_OPTIONS="--UE -w USRP" } diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index e5d0f10ee4ce6b9a785df156fc2bd824dc5369d2..3b32a75542db080ea50a91ffdc13e530709010a1 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -677,13 +677,13 @@ class RANManagement(): # if T tracer was run with option 0 (no logs), analyze logs # from textlog, otherwise do normal analysis (e.g., option 2) result = re.search('T_stdout 0', str(self.Initialize_eNB_args)) + enbLogFile = self.eNBLogFiles[int(self.eNB_instance)] + raw_record_file = enbLogFile.replace('.log', '_record.raw') + replay_log_file = enbLogFile.replace('.log', '_replay.log') if (result is not None): logging.debug('\u001B[1m Replaying RAW record file\u001B[0m') mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.command('cd ' + lSourcePath + '/common/utils/T/tracer/', '\$', 5) - enbLogFile = self.eNBLogFiles[int(self.eNB_instance)] - raw_record_file = enbLogFile.replace('.log', '_record.raw') - replay_log_file = enbLogFile.replace('.log', '_replay.log') extracted_txt_file = enbLogFile.replace('.log', '_extracted_messages.txt') extracted_log_file = enbLogFile.replace('.log', '_extracted_messages.log') mySSH.command('./extract_config -i ' + lSourcePath + '/cmake_targets/' + raw_record_file + ' > ' + lSourcePath + '/cmake_targets/' + extracted_txt_file, '\$', 5) @@ -706,6 +706,8 @@ class RANManagement(): mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*stats.log', '.') mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.pickle', '.') mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.png', '.') + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/'+raw_record_file, '.') + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/'+replay_log_file, '.') # copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + fileToAnalyze, '.') if (copyin_res == -1): @@ -721,7 +723,9 @@ class RANManagement(): mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrL1_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrMAC_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.pickle', self.eNBSourceCodePath + '/cmake_targets/') - mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.png', self.eNBSourceCodePath + '/cmake_targets/') + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './gnb_stats_monitor.png', self.eNBSourceCodePath + '/cmake_targets/')#RH 21/02/2002 this does not work, there are more than 1 png file + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword,'./'+raw_record_file, self.eNBSourceCodePath + '/cmake_targets/') + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword,'./'+replay_log_file, self.eNBSourceCodePath + '/cmake_targets/') # mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + fileToAnalyze, self.eNBSourceCodePath + '/cmake_targets/') logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + fileToAnalyze) diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 8b6db9261a57945d5c2621d7ef5a7229dddb83f6..bcd3e2f7fecf0ed24cc9ea921cb0bdc6fdddd8c3 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -574,7 +574,6 @@ function report_build { summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_eth_row3.html summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_eth_row4.html summary_table_row "RF Simulator - Release 15" ./archives/enb_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_eth_row5.html - summary_table_row "TCP OAI Bridge - Release 15" ./archives/enb_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html summary_table_row "OAI USRP device if - Release 15" ./archives/enb_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_eth_row7.html summary_table_footer @@ -584,7 +583,6 @@ function report_build { summary_table_row "OAI ETHERNET transport - Release 15" ./archives/ue_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./ue_eth_row3.html summary_table_row "Parameters Lib Config - Release 15" ./archives/ue_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./ue_eth_row4.html summary_table_row "RF Simulator - Release 15" ./archives/ue_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./ue_eth_row5.html - summary_table_row "TCP OAI Bridge - Release 15" ./archives/ue_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./ue_eth_row6.html summary_table_row "Conf 2 UE Data - Release 15" ./archives/ue_eth/conf2uedata.Rel15.txt "Built target conf2uedata" ./ue_eth_row7.html summary_table_row "NVRAM - Release 15" ./archives/ue_eth/nvram.Rel15.txt "Built target nvram" ./ue_eth_row8.html summary_table_row "UE IP - Release 15" ./archives/ue_eth/ue_ip.Rel15.txt "Built target ue_ip" ./ue_eth_row9.html @@ -592,20 +590,6 @@ function report_build { summary_table_row "OAI USRP device if - Release 15" ./archives/ue_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./ue_eth_row9b.html summary_table_footer - summary_table_header "OAI Build: 4G LTE basic simulator option" ./archives/basic_sim - summary_table_row "LTE SoftModem - Release 15" ./archives/basic_sim/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./basic_sim_row1.html - summary_table_row "LTE UE SoftModem - Release 15" ./archives/basic_sim/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./basic_sim_row2.htm - summary_table_row "Coding - Release 15" ./archives/basic_sim/coding.Rel15.txt "Built target coding" ./basic_sim_row3.html - summary_table_row "Conf 2 UE data - Release 15" ./archives/basic_sim/conf2uedata.Rel15.txt "Built target conf2uedata" ./basic_sim_row4.html - summary_table_row "OAI ETHERNET transport - Release 15" ./archives/basic_sim/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./basic_sim_row5.html - summary_table_row "Parameters Lib Config - Release 15" ./archives/basic_sim/params_libconfig.Rel15.txt "Built target params_libconfig" ./basic_sim_row7.html - summary_table_row "RF Simulator - Release 15" ./archives/basic_sim/rfsimulator.Rel15.txt "Built target rfsimulator" ./basic_sim_row9.html - summary_table_row "TCP Bridge - Release 15" ./archives/basic_sim/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./basic_sim_row10.html - summary_table_row "UE IP - Release 15" ./archives/basic_sim/ue_ip.Rel15.txt "Built target ue_ip" ./basic_sim_row11.html - summary_table_row "USIM - Release 15" ./archives/basic_sim/usim.Rel15.txt "Built target usim" ./basic_sim_row12.html - summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html - summary_table_footer - if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ] then summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp @@ -658,13 +642,6 @@ function report_build { cat $DETAILS_TABLE >> ./build_results.html done fi - if [ -f ./basic_sim_row1.html ] || [ -f ./basic_sim_row2.html ] || [ -f ./basic_sim_row3.html ] || [ -f ./basic_sim_row4.html ] || [ -f ./basic_sim_row5.html ] - then - for DETAILS_TABLE in `ls ./basic_sim_row*.html` - do - cat $DETAILS_TABLE >> ./build_results.html - done - fi if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ] then for DETAILS_TABLE in `ls ./gnb_usrp_row*.html` diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index d22bfe177a88fa99b271067dc2337b00eb080f81..c137fcdcbbb52ada1aa7571ea70f7b74a1f7bc42 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -250,156 +250,6 @@ function report_test { echo " </table>" >> ./test_simulator_results.html echo " <h2>Test Summary</h2>" >> ./test_simulator_results.html - ARCHIVES_LOC=archives/basic_sim/test - if [ -d $ARCHIVES_LOC ] - then - echo " <h3>4G LTE Basic Simulator Check</h3>" >> ./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 " <div class=\"alert alert-success\">" >> ./test_simulator_results.html - echo " <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - else - echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html - echo " <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - fi - else - echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html - echo " <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - fi - - echo " <button data-toggle=\"collapse\" data-target=\"#oai-basic-sim-test-details\">More details on Basic Simulator test results</button>" >> ./test_simulator_results.html - echo " <div id=\"oai-basic-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html - echo " <table border = \"1\">" >> ./test_simulator_results.html - echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html - echo " <th>Log File Name</th>" >> ./test_simulator_results.html - echo " <th>Command</th>" >> ./test_simulator_results.html - echo " <th>Status</th>" >> ./test_simulator_results.html - echo " <th>Statistics</th>" >> ./test_simulator_results.html - echo " </tr>" >> ./test_simulator_results.html - - TRANS_MODES=("fdd" "tdd") - BW_CASES=(05 10 20) - for TMODE in ${TRANS_MODES[@]} - do - echo " <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html - if [[ $TMODE =~ .*fdd.* ]] - then - echo " <td align = \"center\" colspan = 4 >Test in FDD</td>" >> ./test_simulator_results.html - else - echo " <td align = \"center\" colspan = 4 >Test in TDD</td>" >> ./test_simulator_results.html - fi - echo " </tr>" >> ./test_simulator_results.html - 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 " <tr>" >> ./test_simulator_results.html - echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html - echo " <td>N/A</td>" >> ./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 -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] - then - echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html - else - echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html - fi - echo " <td><pre>" >> ./test_simulator_results.html - if [ $NB_ENB_GOT_SYNC -gt 0 ] - then - echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html - else - echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html - fi - if [ $NB_UE_GOT_SYNC -eq 2 ] - then - echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html - else - echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html - fi - if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] - then - echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html - else - echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html - fi - NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG` - if [ $NB_SEGFAULT_ENB -ne 0 ] - then - echo "<font color = \"red\"><b>- eNB --> Segmentation Fault</b></font>" >> ./test_simulator_results.html - fi - NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG` - if [ $NB_SEGFAULT_UE -ne 0 ] - then - echo "<font color = \"red\"><b>- UE --> Segmentation Fault</b></font>" >> ./test_simulator_results.html - fi - NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG` - if [ $NB_ASSERTION_ENB -ne 0 ] - then - echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./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 "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./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 " </pre></td>" >> ./test_simulator_results.html - echo " </tr>" >> ./test_simulator_results.html - fi - PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt 2> /dev/null` - analyzePingFiles - - IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt 2> /dev/null` - analyzeIperfFiles - done - done - - echo " </table>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - fi - - if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] - then - echo " <h3>4G LTE Basic Simulator + FlexRan Controller Check</h3>" >> ./test_simulator_results.html - echo " <div class=\"alert alert-success\">" >> ./test_simulator_results.html - echo " <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - echo " <button data-toggle=\"collapse\" data-target=\"#oai-flexran-test-details\">More details on Basic Simulator + Fleran Controller test results</button>" >> ./test_simulator_results.html - echo " <div id=\"oai-flexran-test-details\" class=\"collapse\">" >> ./test_simulator_results.html - echo " <table border = \"1\">" >> ./test_simulator_results.html - echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html - echo " <th>Log File Name</th>" >> ./test_simulator_results.html - echo " <th>JSON Query Response</th>" >> ./test_simulator_results.html - echo " </tr>" >> ./test_simulator_results.html - - FLEXRAN_QUERIES=`ls $ARCHIVES_LOC/flexran_ctl_query_*log` - for QUERY in $FLEXRAN_QUERIES - do - echo " <tr>" >> ./test_simulator_results.html - NAME=`echo $QUERY | sed -e "s#$ARCHIVES_LOC/##"` - echo " <td>$NAME</td>" >> ./test_simulator_results.html - echo " <td><pre><code>" >> ./test_simulator_results.html - egrep -v "LOG_NAME|\-\-\-\-\-" $QUERY >> ./test_simulator_results.html - echo " </code></pre></td>" >> ./test_simulator_results.html - echo " </tr>" >> ./test_simulator_results.html - done - echo " </table>" >> ./test_simulator_results.html - echo " </div>" >> ./test_simulator_results.html - fi - ARCHIVES_LOC=archives/rf_sim/test if [ -d $ARCHIVES_LOC ] then diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index b5abb5ff45257157c0a51fab84527a6ede4eb261..31ffa9d727053deb6577ae6e351f0418966b1dda 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -36,137 +36,6 @@ function test_usage { command_options_usage } -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 - echo "echo \"export ENODEB=1\"" >> $1 - echo "export ENODEB=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 - 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/ran_build/build/\"" >> $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/" >> $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,time --basicsim\" > ./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/ran_build/build -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 - - ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - rm $1 - sleep 5 - - local i="0" - echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1 - while [ $i -lt 10 ] - do - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1` - if [ $CONNECTED -ne 0 ] - then - i="100" - else - sleep 5 - i=$[$i+1] - fi - done - ENB_SYNC=0 - echo "echo \"free -m\"" > $1 - echo "free -m" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 - rm $1 - if [ $i -lt 50 ] - then - ENB_SYNC=0 - echo "Basic-Sim eNB: eNB did NOT got sync" - else - echo "Basic-Sim eNB: eNB GOT SYNC --> waiting for UE to connect" - fi - sleep 5 -} - -function start_basic_sim_ue { - local LOC_UE_LOG_FILE=$3 - local LOC_NB_RBS=$4 - local LOC_FREQUENCY=$5 - echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" > $1 - echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build" >> $1 - echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options nocolor,line_num,level --basicsim\" > ./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/ran_build/build -o /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ./my-lte-uesoftmodem-run.sh" >> $1 - - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - - local i="0" - echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1 - while [ $i -lt 10 ] - do - sleep 5 - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` - if [ $CONNECTED -eq 1 ] - then - i="100" - else - i=$[$i+1] - fi - done - UE_SYNC=1 - rm $1 - if [ $i -lt 50 ] - then - UE_SYNC=0 - echo "Basic-Sim UE: oaitun_ue1 is DOWN and/or NOT CONFIGURED" - else - echo "Basic-Sim UE: oaitun_ue1 is UP and CONFIGURED" - fi - i="0" - echo "egrep -c \"Generating RRCConnectionReconfigurationComplete\" /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE" > $1 - while [ $i -lt 10 ] - do - CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` - if [ $CONNECTED -ne 0 ] - then - i="100" - else - sleep 5 - i=$[$i+1] - fi - done - echo "echo \"free -m\"" > $1 - echo "free -m" >> $1 - ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 - if [ $i -lt 50 ] - then - UE_SYNC=0 - echo "Basic-Sim UE: UE did NOT complete RRC Connection" - else - echo "Basic-Sim UE: UE did COMPLETE RRC Connection" - fi -} - function get_ue_ip_addr { local LOC_IF_ID=$3 echo "ifconfig oaitun_ue${LOC_IF_ID} | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1 @@ -417,7 +286,6 @@ function check_iperf { local LOC_REQ_BW_MINUS_TWO=`echo "$LOC_REQ_BW - 2" | bc -l` local LOC_REQ_BW_MINUS_THREE=`echo "$LOC_REQ_BW - 3" | bc -l` local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl` - local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim` local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim` local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c _106prb` if [ -f ${LOC_BASE_LOG}_client.txt ] @@ -438,28 +306,17 @@ function check_iperf { local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Kbits/sec" | sed -e "s#^.*KBytes *##" -e "s#sec.*#sec#"` local BW_PREFIX="K" fi - if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ] + if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] then - if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*${BW_PREFIX}bits.* ]] + if [ $LOC_IS_DL -eq 1 ] then echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH" else - echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - IPERF_STATUS=-1 + echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH" fi else - if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] - then - if [ $LOC_IS_DL -eq 1 ] - then - echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - else - echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH" - fi - else - echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" - IPERF_STATUS=-1 - fi + echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH" + IPERF_STATUS=-1 fi fi else @@ -526,22 +383,6 @@ function full_terminate { sleep 10 } -function full_basic_sim_destroy { - if [ $KEEP_VM_ALIVE -eq 0 ] - then - echo "############################################################" - echo "Destroying VMs" - echo "############################################################" - uvt-kvm destroy $VM_NAME - ssh-keygen -R $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 -} - function install_epc_on_vm { local LOC_EPC_VM_NAME=$1 local LOC_EPC_VM_CMDS=$2 @@ -744,35 +585,6 @@ function terminate_epc { 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 -T -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 -T -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 -T -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 -} - function build_ue_on_separate_folder { echo "mkdir tmp-ue" > $1 echo "cd tmp-ue" >> $1 @@ -1480,6 +1292,11 @@ function run_test_on_vm { echo "This VM test type is no longer supported in the pipeline framework" return fi + if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-basic-sim.* )) ]] + then + echo "This VM test type is no longer supported in the pipeline framework" + return + fi if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] then ENB_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#enb-ethernet#"` @@ -1667,234 +1484,6 @@ function run_test_on_vm { 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 - if [[ "$EPC_IPADDR" == "" ]] - then - # Creating a VM for EPC and installing SW - 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 - else - echo "We will use EPC on $EPC_IPADDR" - EPC_VM_IP_ADDR=$EPC_IPADDR - fi - - # Retrieve EPC real IP address - retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR - - TRANS_MODES=("fdd" "tdd") - BW_CASES=(05 10 20) - - for TMODE in ${TRANS_MODES[@]} - do - for BW in ${BW_CASES[@]} - do - # Not Running in TDD-20MHz : too unstable - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then continue; fi - - if [[ $BW =~ .*05.* ]]; then PRB=25; fi - if [[ $BW =~ .*10.* ]]; then PRB=50; fi - if [[ $BW =~ .*20.* ]]; then PRB=100; fi - if [[ $TMODE =~ .*fdd.* ]]; then FREQUENCY=2680; else FREQUENCY=2350; fi - - echo "############################################################" - echo "Starting the eNB in ${TMODE}-${BW}MHz mode" - echo "############################################################" - CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_enb.log - start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB lte-${TMODE}-basic-sim.conf none - - echo "############################################################" - echo "Starting the UE in ${TMODE}-${BW}MHz mode" - echo "############################################################" - CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_ue.log - start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY - if [ $UE_SYNC -eq 0 ] - then - echo "Problem w/ eNB and UE not syncing" - full_terminate - STATUS=-1 - continue - fi - get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1 - - echo "############################################################" - echo "Pinging the UE" - echo "############################################################" - PING_LOG_FILE=${TMODE}_${BW}MHz_ping_ue.txt - ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0 - 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 - - # Not more testing in any TDD : too unstable - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*05.* ]]; then full_terminate; continue; fi - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then full_terminate; continue; fi - if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi - echo "############################################################" - echo "Iperf DL" - echo "############################################################" - if [[ $TMODE =~ .*fdd.* ]] - then - if [[ $BW =~ .*20.* ]]; then THROUGHPUT=12; else THROUGHPUT=10; fi - else - THROUGHPUT=6 - fi - CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_dl - generic_iperf $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0 - 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/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT - - # Not more testing in FDD-20MHz : too unstable - if [[ $TMODE =~ .*fdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi - echo "############################################################" - echo "Iperf UL" - echo "############################################################" - THROUGHPUT=2 - CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_ul - generic_iperf $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0 - 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/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC - check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT - - full_terminate - - done - done - - 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 - STATUS=-1 - return - 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 - full_basic_sim_destroy - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - STATUS=-1 - return - fi - uvt-kvm wait $FLEXRAN_CTL_VM_NAME --insecure - FLEXRAN_CTL_VM_IP_ADDR=`uvt-kvm ip $FLEXRAN_CTL_VM_NAME` - - 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 "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 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 0 - 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 - STATUS=-1 - return - 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 1 - - sleep 30 - echo "############################################################" - echo "Terminate enb/ue simulators" - echo "############################################################" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0 - 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 "Terminate EPC" - echo "############################################################" - - if [[ "$EPC_IPADDR" == "" ]] - then - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - fi - - full_basic_sim_destroy - - 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 - if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then PING_STATUS=0 @@ -2343,11 +1932,11 @@ function run_test_on_vm { echo "SA test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) - SA_106PRB_STATUS = -1 + SA_106PRB_STATUS=-1 else echo "SA test OK" try_cnt=$((try_cnt+10)) - SA_106PRB_STATUS = 0 + SA_106PRB_STATUS=0 fi done ########### end SA test @@ -2426,11 +2015,11 @@ function run_test_on_vm { echo "SA test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) - SA_24PRB_STATUS = -1 + SA_24PRB_STATUS=-1 else echo "SA test OK" try_cnt=$((try_cnt+10)) - SA_24PRB_STATUS = 0 + SA_24PRB_STATUS=0 fi done ########### end SA test diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index 4a604a1fe94d8d1c466608a76fc6a174e0f18583..73a8b558fe506adc291e1ca4f3fd90ec6af38d17 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -47,7 +47,7 @@ function wait_on_vm_build { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -93,7 +93,7 @@ function wait_on_vm_build { } function check_on_vm_build { - if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] || [[ "$VM_NAME" == *"-basic-sim"* ]] || [[ "$VM_NAME" == *"-flexran-rtc"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -174,13 +174,13 @@ function check_on_vm_build { 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 [[ "$VM_NAME" == *"-flexran-rtc"* ]] + #then + # if [[ $STATUS -eq 0 ]] + # then + # touch $JENKINS_WKSP/flexran/flexran_build_complete.txt + # fi + #fi if [[ "$VM_NAME" == *"-cppcheck"* ]] then diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 2476a75427d41e2f62c199a570510bebbac595a1..5dbd36f00d323af2240bb675acfb251827b020f5 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -75,7 +75,7 @@ <testCase id="040000"> <class>Initialize_eNB</class> <desc>Initialize gNB</desc> - <Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time,line_num,function</Initialize_eNB_args> + <Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time,line_num,function</Initialize_eNB_args> <eNB_instance>1</eNB_instance> <eNB_serverId>1</eNB_serverId> <air_interface>nr</air_interface> diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index fc562dd1eb97521aef7471435d04c1daef2ccc70..5eb2a789a94c30ae294a65680cd1864f0d476ffc 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -23,6 +23,7 @@ This page is only valid for an `Ubuntu18` host. 1. [Deploy OAI 5G Core Network](#21-deploy-oai-5g-core-network) 2. [Deploy OAI gNB in RF simulator mode and in Standalone Mode](#22-deploy-oai-gnb-in-rf-simulator-mode-and-in-standalone-mode) 3. [Deploy OAI NR-UE in RF simulator mode and in Standalone Mode](#23-deploy-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) + 4. [Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode](#24-deploy-second-oai-nr-ue-in-rf-simulator-mode-and-in-standalone-mode) 3. [Check traffic](#3-check-traffic) 1. [Check your Internet connectivity](#31-check-your-internet-connectivity) 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) @@ -203,6 +204,8 @@ $ docker logs rfsim5g-oai-amf $ docker-compose up -d oai-nr-ue rfsim5g-mysql is up-to-date rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date rfsim5g-oai-spgwu is up-to-date rfsim5g-oai-ext-dn is up-to-date rfsim5g-oai-gnb is up-to-date @@ -255,6 +258,98 @@ oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` +## 2.4. Deploy Second OAI NR-UE in RF simulator mode and in Standalone Mode ## + +```bash +Create a entry for new IMSI (208990100001101) in oai_db.sql file +Refer Section - [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + +Create entry for Second UE in docker-compose.yaml file as follows: + oai-nr-ue2: + image: oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue2 + environment: + RFSIMULATOR: 192.168.71.136 + FULL_IMSI: '208990100001101' + FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'C42449363BBAD02B66D16BC975D77CC1' + DNN: oai + NSSAI_SST: 1 + NSSAI_SD: 1 + USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time + depends_on: + - oai-gnb + networks: + public_net: + ipv4_address: 192.168.71.138 + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 +``` + + +```bash +$ docker-compose up -d oai-nr-ue2 +rfsim5g-mysql is up-to-date +rfsim5g-oai-nrf is up-to-date +rfsim5g-oai-amf is up-to-date +rfsim5g-oai-smf is up-to-date +rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-ext-dn is up-to-date +rfsim5g-oai-gnb is up-to-date +Creating rfsim5g-oai-nr-ue2 ... done +``` + +Wait for a bit. + +```bash +$ docker-compose ps -a + Name Command State Ports +------------------------------------------------------------------------------------------------- +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nr-ue2 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp +rfsim5g-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +``` + +Making sure the Second OAI UE is connected: + +```bash +$ docker exec -it rfsim5g-oai-nr-ue2 /bin/bash +root@bb4d400a832d:/opt/oai-nr-ue# ifconfig +eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 + inet 192.168.71.138 netmask 255.255.255.192 broadcast 192.168.71.191 + ether 02:42:c0:a8:47:8a txqueuelen 0 (Ethernet) + RX packets 3192021 bytes 67784900946 (67.7 GB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 3397743 bytes 91320004542 (91.3 GB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + loop txqueuelen 1000 (Local Loopback) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 + inet 12.1.1.3 netmask 255.255.255.0 destination 12.1.1.3 + unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + # 3. Check traffic # ## 3.1. Check your Internet connectivity ## @@ -299,6 +394,9 @@ Let now try to check UDP traffic in Downlink. You will need 2 terminals: one in the NR-UE container, one in the ext-dn container. +Note: +Similarly, Second OAI UE Internet connectivity can be checked. + ## 3.2. Start the `iperf` server inside the NR-UE container ## ```bash @@ -384,24 +482,26 @@ The `500 Kbits/sec` value may change depending on your CPU power! ```bash $ docker-compose down +Stopping rfsim5g-oai-nr-ue2 ... done Stopping rfsim5g-oai-nr-ue ... done Stopping rfsim5g-oai-gnb ... done Stopping rfsim5g-oai-ext-dn ... done +Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-smf ... done Stopping rfsim5g-oai-amf ... done -Stopping rfsim5g-oai-spgwu ... done Stopping rfsim5g-oai-nrf ... done Stopping rfsim5g-mysql ... done +Removing rfsim5g-oai-nr-ue2 ... done Removing rfsim5g-oai-nr-ue ... done Removing rfsim5g-oai-gnb ... done Removing rfsim5g-oai-ext-dn ... done +Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-smf ... done Removing rfsim5g-oai-amf ... done -Removing rfsim5g-oai-spgwu ... done Removing rfsim5g-oai-nrf ... done Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net -Removing network rfsim5g-oai-traffic_net-net +Removing network rfsim5g-oai-traffic-net ``` # 5. Explanations on the configuration in the `docker-compose.yaml` # @@ -419,13 +519,19 @@ This value is also present in the `oai_db.sql` file: ```bash INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +INSERT INTO `users` VALUES ('208990100001101','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); ``` As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: +OAI UE - 1 * `FULL_IMSI: '208990100001100'` * `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` +OAI UE - 2 +* `FULL_IMSI: '208990100001101'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). ## 5.2. Making the gNB connect to the core network ## diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 6d56316e9cd6090827d5bf8e1e43e8bde22a2058..bf1f5e8b9cdfba23d299a63e5ccdad32c0f7398b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -755,27 +755,6 @@ 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) -# TCP bridge libraries -###################################################################### - -# this one is for internal use at Eurecom and is not documented -set(HWLIB_TCP_BRIDGE_SOURCE - ${OPENAIR_TARGETS}/ARCH/tcp_bridge/tcp_bridge.c - ) -add_library(tcp_bridge MODULE ${HWLIB_TCP_BRIDGE_SOURCE} ) - -#get_target_property(tcp_bridge_cflags tcp_bridge COMPILE_FLAGS) -#set_target_properties(tcp_bridge PROPERTIES COMPILE_FLAGS "${tcp_bridge_cflags} -fvisibility=hidden") -set_target_properties(tcp_bridge PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") - -# this one is to connect OAI eNB and OAI UE in the basic simulator -# see targets/ARCH/tcp_bridge/README.tcp_bridge_oai for usage -set(HWLIB_TCP_BRIDGE_OAI_SOURCE - ${OPENAIR_TARGETS}/ARCH/tcp_bridge/tcp_bridge_oai.c - ) -add_library(tcp_bridge_oai MODULE ${HWLIB_TCP_BRIDGE_OAI_SOURCE} ) -set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") - # Benetel 4G library ###################################################################### @@ -3010,8 +2989,7 @@ if (${T_TRACER}) #all "add_library" definitions ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer - oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai - coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO + oai_eth_transpro oai_mobipass coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 7497fb419c4a50659e2fd3ff0a80bd2945a7d625..ce1b9dcdf4981b968de86b36245fcfd47d5044f5 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1093,10 +1093,10 @@ (Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset), (Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27), (Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16), - (Test11: 106 MCS-TABLE 256 QAM MCS Index 26), - (Test12: HARQ test 25% TP (4 rounds), - (Test13: HARQ test 33% TP (3 rounds), - (Test14: HARQ test 50% TP (2 rounds), + (Test11: 106 MCS-TABLE 256 QAM MCS Index 27), + (Test12: HARQ test 25% TP 4 rounds), + (Test13: HARQ test 33% TP 3 rounds), + (Test14: HARQ test 50% TP 2 rounds), (Test15: 3 PTRS, 8 Interpolated Symbols), (Test16: 6 PTRS, 5 Interpolated Symbols), (Test17: 11 PTRS, 0 Interpolated Symbols), diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 930f2a7f77f6960553c613f85cadc6242bf03bf7..c65728a41d623917680f3be13205369e1ae3e3bb 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -894,11 +894,6 @@ function main() { compilations \ $BUILD_DIR rfsimulator \ librfsimulator.so $dbin/librfsimulator.so.$REL - - echo_info "Compiling tcp_bridge_oai" - compilations \ - $BUILD_DIR tcp_bridge_oai \ - libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL fi #build transport protocol libraries (currently only ETHERNET is available) diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 49742bf600795016afb6f168003bcfd2d31137a2..2d724ffd0024dd08c9a25663a5039cebbb3df642 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -33,12 +33,6 @@ volatile int _T_freelist_head; volatile int *T_freelist_head = &_T_freelist_head; T_cache_t *T_cache; -#if BASIC_SIMULATOR - /* global variables used by T_GET_SLOT, see in T.h */ - volatile uint64_t T_next_id; - volatile uint64_t T_active_id; -#endif - static void get_message(int s) { char t; int l; diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 014294505454bd8640fa55525812e6c0dccf543e..df1e95d2df3289f2919b76f070a5a1fa88ad52f2 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -111,39 +111,8 @@ typedef struct { extern volatile int *T_freelist_head; extern T_cache_t *T_cache; extern int *T_active; -/* When running the basic simulator, we may fill the T cache too fast. - * Let's serialize write accesses to the T cache. For that, we use a - * 'ticket' mechanism. To acquire a T slot the caller needs to own the - * current active ticket. We also wait for the slot to be free if - * it is already in use. - */ -#if BASIC_SIMULATOR -# define T_GET_SLOT \ - do { \ - extern volatile uint64_t T_next_id; \ - extern volatile uint64_t T_active_id; \ - uint64_t id; \ - /* get a ticket */ \ - id = __sync_fetch_and_add(&T_next_id, 1); \ - /* wait for our turn */ \ - while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \ - /* this is our turn, try to acquire the slot until it's free */ \ - do { \ - T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \ - if (T_LOCAL_busy & 0x01) usleep(100); \ - } while (T_LOCAL_busy & 0x01); \ - /* check that there are still some tickets */ \ - if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \ - printf("T: reached the end of times, bye...\n"); \ - abort(); \ - } \ - /* free our ticket, which signals the next waiter that it's its turn */ \ - (void)__sync_fetch_and_add(&T_active_id, 1); \ - } while (0) -#else -# define T_GET_SLOT \ +#define T_GET_SLOT \ T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); -#endif /* used at header of Tn, allocates buffer */ #define T_LOCAL_DATA \ diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index b74c0567ce7333544d8a29f95419b1f08eb57f85..00e0df496304b9888869aaf04dfb5652c58d199e 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -40,20 +40,10 @@ #define T_MAX_ARGS 16 /* maximum size of a message - increase if needed */ -#if BASIC_SIMULATOR - /* let's have 100 RBs functional for the basic simulator */ -# define T_BUFFER_MAX (1024*64*4) -#else -# define T_BUFFER_MAX (1024*64*4) -#endif +#define T_BUFFER_MAX (1024*64*4) /* size of the local cache for messages (must be pow(2,something)) */ -#if BASIC_SIMULATOR - /* we don't need much space for the basic simulator */ -# define T_CACHE_SIZE 1024 -#else -# define T_CACHE_SIZE (8192) -#endif +#define T_CACHE_SIZE (8192) /* maximum number of bytes a message can contain */ #ifdef T_SEND_TIME diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 539e72b2239e0268f7fb949ac8dd9c93bf15f975..b4f1804c41c2bf8dd0962ac6c983858e20610e8f 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -357,22 +357,6 @@ static void forward(void *_forwarder, char *buf, int size) { if (f->tail != NULL) f->tail->next = new; f->tail = new; -#if BASIC_SIMULATOR - /* When runnng the basic simulator, the tracer may be too slow. - * Let's not take too much memory in the tracee and - * wait if there is too much data to send. 200MB is - * arbitrary. - */ - while (f->memusage > 200 * 1024 * 1024) { - if (pthread_cond_signal(&f->cond)) abort(); - - if (pthread_mutex_unlock(&f->lock)) abort(); - - usleep(1000); - - if (pthread_mutex_lock(&f->lock)) abort(); - } -#endif f->memusage += size+4; /* warn every 100MB */ diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 5e6cd6a13c212821854b3e302e48c148188934a9..fbef867d7dcb6470b246c0b3b2d2c2037ae6468b 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -520,7 +520,6 @@ int get_subband_size(int NPRB,int size) { } - // from start symbol index and nb or symbols to symbol occupation bitmap in a slot uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols) { return ((1<<nrOfSymbols)-1)<<startSymbolIndex; @@ -542,5 +541,4 @@ void SLIV2SL(int SLIV,int *S,int *L) { *L=15-SLIVdiv14; *S=13-SLIVmod14; } - } diff --git a/doc/BASIC_SIM.md b/doc/BASIC_SIM.md deleted file mode 100644 index 1bfc6e76d203c222d520a190a4053590fc6e1d96..0000000000000000000000000000000000000000 --- a/doc/BASIC_SIM.md +++ /dev/null @@ -1,191 +0,0 @@ -<table style="border-collapse: collapse; border: none;"> - <tr style="border-collapse: collapse; border: none;"> - <td style="border-collapse: collapse; border: none;"> - <a href="http://www.openairinterface.org/"> - <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150> - </img> - </a> - </td> - <td style="border-collapse: collapse; border: none; vertical-align: center;"> - <b><font size = "5">Running OAI Basic Simulator</font></b> - </td> - </tr> -</table> - -This page is valid on the following branches: - -- `master` starting from tag `v1.1.0` -- `develop` starting from tag `2019.w11` - -# 1. Building the basic-simulator. - -After the build simplification, the basic simulator is available directly from the standard build. - -```bash -$ source oaienv -$ cd cmake_targets -$ ./build_oai --eNB --UE -``` - -Both eNB (lte-softmodem) and UE (lte-uesoftmodem) are present on `cmake_targets/ran_build/build` folder. - -More details are available on the [build page](BUILD.md). - -# 2. Running the basic simulator. - -The basic simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. - -This is the ideal tool to check signal processing algorithms and protocols implementation and having debug sessions without any HW radio equipment. - -The main limitations are: - -- A single OAI UE will connect to the OAI eNB -- No channel noise - -## 2.1. Starting eNB - -The basic simulator is able to run with a connected EPC or without any (the so-called "noS1" mode). - -Example 1: running in FDD mode with EPC. - -```bash -$ source oaienv -$ cd cmake_targets/ran_build/build -$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim -``` - -Edit previously the `ci-scripts/conf_files/lte-fdd-basic-sim.conf` file to modify: - -- `N_RB_DL` field to change the Bandwidth (25, 50, 100) -- `CI_MME_IP_ADDR` with the EPC IP address -- `CI_ENB_IP_ADDR` with the container (physical server, virtual machine, ...) on which you are executing the eNB soft-modem - -Example 2: running in TDD mode without any EPC. - -```bash -$ source oaienv -$ cd cmake_targets/ran_build/build -$ ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-tdd-basic-sim.conf --basicsim --noS1 -``` - -## 2.2. Starting UE - -Before starting the UE, you may need to edit the SIM parameters to adapt to your eNB configuration and HSS database. - -The <conf> file to use for conf2uedate is `openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf` - -You need to set the correct OPC, USIM_API_K, MSIN (this is the end par of the IMSI), HPLMN (the front part of IMSI) to match values from HSS. - -```bash -$ source oaienv -# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -$ cd cmake_targets/ran_build/build -$ ../../nas_sim_tools/build/conf2uedata -c $OPENAIR_HOME/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o . -$ sudo -E ./lte-uesoftmodem -C 2625000000 -r 25 --ue-rxgain 140 --basicsim [--noS1] -``` - -The `-r 25` is to use if in the conf file of the eNB you use N_RB_DL=25. Use 50 if you have N_RB_DL=50 and 100 if you have N_RB_DL=100. - -The `-C 2625000000` is the downlink frequency. Use the same value as `downlink_frequency` in the eNB configuration file. - -The `--noS1` is mandatory if you started the eNB in that mode. - -# 3. Testing the data plane - -# 3.1. In S1 mode - -First we need to retrieve the IP address allocated to the OAI UE. - -On the server that runs the UE: - -```bash -$ ifconfig oaitun_ue1 -oaitun_ue1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:192.172.0.2 P-t-P:192.172.0.2 Mask:255.255.255.0 -... -``` - -`192.172.0.2` is the IP address that has been allocated by the SPGW in the EPC. - -On the server that runs the EPC: - -```bash -$ ping -c 20 192.172.0.2 - --- 192.172.0.2 ping statistics --- - 20 packets transmitted, 20 received, 0% packet loss, time 19020ms - rtt min/avg/max/mdev = 13.241/18.999/24.208/2.840 ms -``` - -You can ping the EPC from the UE: - -```bash -$ ping -I oaitun_ue1 -c 20 192.172.0.1 - --- 192.172.0.1 ping statistics --- -... - 20 packets transmitted, 20 received, 0% packet loss, time 19019ms - rtt min/avg/max/mdev = 13.015/18.674/23.738/2.917 ms -``` - -For DL iperf testing: - -On the server that runs the UE. - -```bash -$ iperf -B 192.172.0.2 -u -s -i 1 -fm -p 5001 -``` - -On the server that runs the EPC. - -```bash -$ iperf -c 192.172.0.2 -u -t 30 -b 10M -i 1 -fm -B 192.172.0.1 -p 5001 -``` - -For UL iperf testing: - -On the server that runs the EPC. - -```bash -$ iperf -B 192.172.0.1 -u -s -i 1 -fm -p 5001 -``` - -On the server that runs the UE. - -```bash -$ iperf -c 192.172.0.1 -u -t 30 -b 2M -i 1 -fm -B 192.172.0.2 -p 5001 -``` - -# 3.2. In noS1 mode - -The IP addresses are fixed. But we can still retrieve them programmatically. - -For the UE it is quite the same: - -```bash -$ ifconfig oaitun_ue1 -oaitun_ue1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:10.0.1.2 P-t-P:10.0.1.2 Mask:255.255.255.0 -... -``` - -For the eNB: - -```bash -$ ifconfig oaitun_enb1 -oaitun_enb1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 - inet addr:10.0.1.1 P-t-P:10.0.1.1 Mask:255.255.255.0 -... -``` - -Pinging like this: - -```bash -$ ping -I oaitun_ue1 -c 20 10.0.1.1 -$ ping -I oaitun_enb1 -c 20 10.0.1.2 -``` - -And the same for iperf: - -```bash -$ iperf -B 10.0.1.2 -u -s -i 1 -fm -$ iperf -c 10.0.1.2 -u -b 1.00M -t 30 -i 1 -fm -B 10.0.1.1 -``` diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 7ee3ae9d7e6d01bf42fdb0c961754f06fbad2f02..919bbc2dc06fdf1a6b783d51e79711c2f9cc5bc7 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -14,10 +14,6 @@ After you have [built the softmodem executables](BUILD.md) you can set your default directory to the build directory `cmake_targets/ran_build/build/` and start testing some use cases. Below, the description of the different oai functionalities should help you choose the oai configuration that suits your need. -# Basic Simulator - -See the [dedicated page](BASIC_SIM.md). - # RF Simulator The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE (LTE or 5G) and respectively the oai eNodeB or gNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation. The rf simulator has some preliminary support for channel modeling. diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index 6c921a493226808c49ac80dde8d55dcf697c65a9..7924f5bd78844f99c7603f79a5f31f218945491b 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -62,7 +62,6 @@ COPY --from=enb-build \ COPY --from=enb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.eNB.rhel8.2.oc4-4 b/docker/Dockerfile.eNB.rhel8.2.oc4-4 index 5b784c08a28f0c47d79e384c08bc46f3834ade68..03f6ec8e45472d70bdbb211c6cf2f80ef53b3f92 100644 --- a/docker/Dockerfile.eNB.rhel8.2.oc4-4 +++ b/docker/Dockerfile.eNB.rhel8.2.oc4-4 @@ -62,7 +62,6 @@ COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/libcoding.so . @@ -95,7 +94,6 @@ RUN ldconfig #debug RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 1f375a20dc9ab0725258024ad1433128008946c8..222a7f42bbac0cf7f0c61c6fc86cc264f1db6adb 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -69,7 +69,6 @@ COPY --from=enb-build \ COPY --from=enb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index 703f4c67b5e1748a9405f5e348522bc659c40b5b..6a1b447a6253941542614a0e49d1f994d727e221 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -64,7 +64,6 @@ COPY --from=gnb-build \ COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.gNB.rhel8.2.oc4-4 b/docker/Dockerfile.gNB.rhel8.2.oc4-4 index 1e1eba016e34c503f9b87ae3c26f5cbf2df21430..6c88d3ad8e6fa09b73cd561060bd37145838e45a 100644 --- a/docker/Dockerfile.gNB.rhel8.2.oc4-4 +++ b/docker/Dockerfile.gNB.rhel8.2.oc4-4 @@ -65,7 +65,6 @@ COPY --from=gnb-build /oai-ran/targets/bin/nr-softmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=gnb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=gnb-build /oai-ran/targets/bin/libcoding.so . @@ -102,7 +101,6 @@ RUN ldconfig #debug RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index 24e4bcbc7c16762ea0787a9109934dfc2d517d4f..6f990db833575f21f519d1cc6f909c11a636e299 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -68,7 +68,6 @@ COPY --from=gnb-build \ COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.lteRU.rhel8.2 b/docker/Dockerfile.lteRU.rhel8.2 index 5addbca65565be888cb3fc07772c8e97ba23fd94..b41aee36dcac74969c1cc76fbbbc3db9202fa1a9 100644 --- a/docker/Dockerfile.lteRU.rhel8.2 +++ b/docker/Dockerfile.lteRU.rhel8.2 @@ -59,7 +59,6 @@ COPY --from=ru-build \ COPY --from=ru-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \ diff --git a/docker/Dockerfile.lteRU.ubuntu18 b/docker/Dockerfile.lteRU.ubuntu18 index 1f1c903a159fc19a3decf88f9f54633bef231635..1810afb621551a6f12e03869f06ff5780320ca93 100644 --- a/docker/Dockerfile.lteRU.ubuntu18 +++ b/docker/Dockerfile.lteRU.ubuntu18 @@ -64,7 +64,6 @@ COPY --from=ru-build \ COPY --from=ru-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libparams_libconfig.so \ diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index f547558bdb7cab32f41da185f9ee4ca79de6a788..cc1be3d41d5c68e93be5298f89401db25cf59ca3 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -66,7 +66,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 index 1339d18de62c244d7db97b6bdd5bf3a292e1d1ca..cc492882f53d49f6cb9d4b9bbda8ba138b134d97 100644 --- a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 +++ b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 @@ -68,7 +68,6 @@ COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . WORKDIR /usr/local/lib/ COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/libcoding.so . @@ -105,7 +104,6 @@ RUN ldd /opt/oai-lte-ue/bin/conf2uedata RUN ldd /opt/oai-lte-ue/bin/nvram RUN ldd /opt/oai-lte-ue/bin/usim RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index a5bf4cfe9441c5fa0d4c9c9b2fefb4bf6db4de1e..292ac37e5f0f09520fbfb7fa2cda5ede1ca0291c 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -73,7 +73,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index cbc8d8c65fd87db590233a6012b59def69bbc04e..d38e81bd71eec16ce5782c29ff2a21a8dfc3ad8e 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -66,7 +66,6 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/nr-ue-sim.conf . COPY --from=nr-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 index d900fff998d633eccaa0685dc71bad20820de92a..2d018c96af0232105340a01e1064c30c19ade449 100644 --- a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 +++ b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 @@ -64,7 +64,6 @@ COPY --from=nr-ue-build /oai-ran/targets/bin/nr-uesoftmodem.Rel15 . WORKDIR /usr/local/lib/ COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . COPY --from=nr-ue-build /oai-ran/targets/bin/libcoding.so . @@ -100,7 +99,6 @@ COPY --from=nr-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 RUN ldconfig RUN ldd /opt/oai-nr-ue/bin/nr-uesoftmodem.Rel15 RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 RUN ldd /usr/local/lib/librfsimulator.so.Rel15 RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 RUN ldd /usr/local/lib/libcoding.so diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index 126f268e000e24bdf552dbe27482d4573eec8379..0fa219296b7b7e52327b46baf190c630ec5a5b0f 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -71,7 +71,6 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/nr-ue-sim.conf . COPY --from=nr-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ - /oai-ran/cmake_targets/ran_build/build/libtcp_bridge_oai.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ /oai-ran/cmake_targets/ran_build/build/liboai_usrpdevif.so \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index fa0c3a1f63a15e40fe9b3c0db9fec46fc7faba24..4793ef4e95fc7a0e78d280ee0c07bb93ac95f71f 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -177,15 +177,14 @@ void rx_func(void *param) { void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); int j; for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++) - if (gNB->ulsch[j][0]->rnti == rnti_to_remove[i]) { - gNB->ulsch[j][0]->rnti = 0; - gNB->ulsch[j][0]->harq_mask = 0; - //clean_gNB_ulsch(gNB->ulsch[j][0]); + if (gNB->ulsch[j]->rnti == rnti_to_remove[i]) { + gNB->ulsch[j]->rnti = 0; + gNB->ulsch[j]->harq_mask = 0; int h; for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) { - gNB->ulsch[j][0]->harq_processes[h]->status = SCH_IDLE; - gNB->ulsch[j][0]->harq_processes[h]->round = 0; - gNB->ulsch[j][0]->harq_processes[h]->handled = 0; + gNB->ulsch[j]->harq_processes[h]->status = SCH_IDLE; + gNB->ulsch[j]->harq_processes[h]->round = 0; + gNB->ulsch[j]->harq_processes[h]->handled = 0; } up_removed++; } @@ -210,7 +209,6 @@ void rx_func(void *param) { if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); // RX processing - int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { // UE-specific RX processing for subframe n @@ -244,7 +242,8 @@ void rx_func(void *param) { gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); pthread_mutex_unlock(&gNB->UL_INFO_mutex); stop_meas(&gNB->ul_indication_stats); - + + int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx); if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { notifiedFIFO_elt_t *res; processingData_L1tx_t *syncMsg; @@ -256,8 +255,17 @@ void rx_func(void *param) { syncMsg->timestamp_tx = info->timestamp_tx; res->key = slot_tx; pushTpool(gNB->threadPool, res); + } else if (get_softmodem_params()->continuous_tx) { + notifiedFIFO_elt_t *res = pullTpool(gNB->L1_tx_free, gNB->threadPool); + processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); + syncMsg->gNB = gNB; + syncMsg->timestamp_tx = info->timestamp_tx; + syncMsg->frame = frame_tx; + syncMsg->slot = slot_tx; + res->key = slot_tx; + pushNotifiedFIFO(gNB->L1_tx_out, res); } - + #if 0 LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now, @@ -395,7 +403,11 @@ void *tx_reorder_thread(void* param) { syncMsgRU.slot_tx = syncMsgL1->slot; syncMsgRU.timestamp_tx = syncMsgL1->timestamp_tx; syncMsgRU.ru = gNB->RU_list[0]; - next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx); + if (get_softmodem_params()->continuous_tx) { + int slots_per_frame = gNB->frame_parms.slots_per_frame; + next_tx_slot = (syncMsgRU.slot_tx + 1) % slots_per_frame; + } else + next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx); pushNotifiedFIFO(gNB->L1_tx_free, resL1); if (resL1==resL1Reserve) resL1Reserve=NULL; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 08decf0f679a6c15d1f9e51a56a50951dfeb3143..45ef0f9bafa2f256e212db62d7bc537d5cb48bea 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -703,46 +703,53 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { nfapi_nr_config_request_scf_t *cfg = &ru->config; void *txp[ru->nb_tx]; unsigned int txs; - int i,txsymb=fp->symbols_per_slot; + int i; T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T_INT(0), T_BUFFER(&ru->common.txdata[0][fp->get_samples_slot_timestamp(slot,fp,0)], fp->samples_per_subframe * 4)); - int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame); - int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); - int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame); int sf_extension = 0; int siglen=fp->get_samples_per_slot(slot,fp); - int flags=1; - - //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); - if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT || IS_SOFTMODEM_RFSIM) { - if (cfg->cell_config.frame_duplex_type.value == TDD) { - if(slot_type == NR_MIXED_SLOT) { - txsymb = 0; - - for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { - if (cfg->tdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 0) - txsymb++; - } + int flags = 0; - AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); + if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx) { + int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame); + if(slot_type == NR_MIXED_SLOT) { + int txsymb = 0; - if(slot%(fp->slots_per_subframe/2)) - siglen = txsymb * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - else - siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - - //+ ru->end_of_burst_delay; - flags = 3; // end of burst + for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { + if (cfg->tdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 0) + txsymb++; } - if (slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT) { + AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); + + if(slot%(fp->slots_per_subframe/2)) + siglen = txsymb * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + else + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + + //+ ru->end_of_burst_delay; + flags = 3; // end of burst + } else if (slot_type == NR_DOWNLINK_SLOT) { + int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); + int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame); + if (prevslot_type == NR_UPLINK_SLOT) { flags = 2; // start of burst sf_extension = ru->sf_extension; - } - if (slot_type == NR_DOWNLINK_SLOT && nextslot_type == NR_UPLINK_SLOT) + } else if (nextslot_type == NR_UPLINK_SLOT) { flags = 3; // end of burst + } else { + flags = 1; // middle of burst + } } + } else { // FDD + if (proc->first_tx == 1) { + flags = 2; // start of burst + } else { + flags = 1; // middle of burst + } + } + if (flags) { if (fp->freq_range==nr_FR2) { // the beam index is written in bits 8-10 of the flags // bit 11 enables the gpio programming diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 543be7a8b5eac91821cba05b9b30b9f150573b4c..3cc71b8b3a0f3ef9d577176e64ab1f404557fe3c 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -18,7 +18,8 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ -#define _GNU_SOURCE + +#define _GNU_SOURCE #include <pthread.h> #include <openair1/PHY/impl_defs_top.h> #include "executables/nr-uesoftmodem.h" @@ -1125,9 +1126,8 @@ void *UE_thread(void *arg) { } int flags = 0; - int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH; - if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { + if (openair0_cfg[0].duplex_mode == duplex_mode_TDD && !get_softmodem_params()->continuous_tx) { uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; int nrofUplinkSlots, nrofUplinkSymbols; @@ -1139,8 +1139,9 @@ void *UE_thread(void *arg) { nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; nrofUplinkSymbols = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; } - uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0); + int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH; + uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0); uint8_t first_tx_slot = tdd_period - num_UL_slots; if (slot_tx_usrp % tdd_period == first_tx_slot) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 76c21bb422043d1aa1e00111d366e0a21a6401ed..00f019c03ae82bb64ddd5c18ab897d1575150d71 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -373,7 +373,7 @@ void init_openair0(void) { static void init_pdcp(int ue_id) { uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); - /*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { + /*if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; }*/ diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 12c60e98fdf17446583e96da7ba9938dce09ff4e..c78fc70243c6e138f06e9a2cb89fc0be46e2c8c9 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -89,7 +89,7 @@ void get_common_options(uint32_t execmask) { uint32_t glog_level=0 ; uint32_t start_telnetsrv = 0, start_telnetclt = 0; uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0; - uint32_t rfsim = 0, basicsim = 0, do_forms = 0; + uint32_t rfsim = 0, do_forms = 0; char *logmem_filename = NULL; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; @@ -141,10 +141,6 @@ void get_common_options(uint32_t execmask) { set_softmodem_optmask(SOFTMODEM_RFSIM_BIT); } - if (basicsim) { - set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT); - } - if (do_forms) { set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); } diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 1f73720e703a7017f886278b0c3c7c09d06e327d..48ce73149f1612e04412ace6737abda0f0b40a6c 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -93,12 +93,13 @@ extern "C" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NOS1 "Disable s1 interface\n" -#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" +#define CONFIG_HLP_RFSIM "Run in rf simulator mode\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" #define CONFIG_L1_EMULATOR "Run in L1 emulated mode (disable PHY layer)\n" +#define CONFIG_HLP_CONTINUOUS_TX "perform continuous transmission, even in TDD mode (to work around USRP issues)\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to eNodeB and UE */ @@ -126,6 +127,7 @@ extern "C" #define NODE_NUMBER softmodem_params.node_number #define NON_STOP softmodem_params.non_stop #define EMULATE_L1 softmodem_params.emulate_l1 +#define CONTINUOUS_TX softmodem_params.continuous_tx #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; @@ -154,7 +156,6 @@ extern int usrp_tx_thread; {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \ {"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \ {"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&rfsim, defintval:0, TYPE_INT, 0}, \ - {"basicsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&basicsim, 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}, \ {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ @@ -163,7 +164,8 @@ extern int usrp_tx_thread; {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ - {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0} \ + {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \ + {"continuous-tx", CONFIG_HLP_CONTINUOUS_TX,PARAMFLAG_BOOL, iptr:&CONTINUOUS_TX, defintval:0, TYPE_INT, 0}, \ } #define CONFIG_HLP_NSA "Enable NSA mode \n" @@ -201,7 +203,6 @@ extern int usrp_tx_thread; #define SOFTMODEM_NOKRNMOD_BIT (1<<1) #define SOFTMODEM_NONBIOT_BIT (1<<2) #define SOFTMODEM_RFSIM_BIT (1<<10) -#define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) #define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) @@ -218,7 +219,6 @@ extern int usrp_tx_thread; #define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT) #define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT) #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) -#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) #define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) @@ -254,6 +254,7 @@ typedef struct { uint16_t node_number; int non_stop; int emulate_l1; + int continuous_tx; } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index 58d649d0119b35edcd1781042acd9b52dc0cc354..41b2d4fe84c2b3a3b330edc6a262986d501a38a5 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -117,7 +117,7 @@ int test_ldpc(short No_iteration, sigma = 1.0/sqrt(2*SNR); opp_enabled=1; //short test_input[block_length]; - unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; + unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; //short *c; //padded codeword unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length]; memset(estimated_output, 0, sizeof(estimated_output)); diff --git a/openair1/PHY/CODING/nrLDPC_defs.h b/openair1/PHY/CODING/nrLDPC_defs.h index 0d7ff9ef9f834e9c8c5231f65e24f9e96da408a9..a6fb44cb0dd40bfd1b0995043ec6893e91317dff 100644 --- a/openair1/PHY/CODING/nrLDPC_defs.h +++ b/openair1/PHY/CODING/nrLDPC_defs.h @@ -57,7 +57,7 @@ typedef struct { /// Number of "Filler" bits uint32_t F; /// LDPC-code outputs - uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]; } encoder_implemparams_t; #define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL} typedef void(*nrLDPC_initcallfunc_t)(t_nrLDPC_dec_params *p_decParams, int8_t *p_llr, int8_t *p_out); diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c index 0eede23766956fd83a6789f55c842fc4d58ebfe3..281e61cda523fc3c9621f81c4d2f1ab183f0c5a5 100644 --- a/openair1/PHY/CODING/nr_segmentation.c +++ b/openair1/PHY/CODING/nr_segmentation.c @@ -63,11 +63,6 @@ int32_t nr_segmentation(unsigned char *input_buffer, #endif } - if ((*C)>MAX_NUM_NR_DLSCH_SEGMENTS) { - LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); - return(-1); - } - // Find K+ Kprime = Bprime/(*C); diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c index 504c8fa80a0f284d732d549c3d6d2af6c03d7d12..5b661d7c2df82d6f3fda08fc1add7275211fcde1 100644 --- a/openair1/PHY/INIT/lte_param_init.c +++ b/openair1/PHY/INIT/lte_param_init.c @@ -151,11 +151,5 @@ void lte_param_init(PHY_VARS_eNB **eNBp, else if (eNB->frame_parms.N_RB_DL == 25) ru->N_TA_offset = 624/4; } else ru->N_TA_offset=0; - if (IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - UE->N_TA_offset = 0; - printf("Done lte_param_init\n"); } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index c41af5fb22b2731277b39881f7a05da59f38c44d..9a3a888359413f4dae45fde585e817f527a2aede 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -117,12 +117,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->bad_pucch = 0; + // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; + for (int slot=0; slot<fp->slots_per_frame; slot++) { pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t)); LOG_D(PHY,"pdcch_dmrs[%d][%d] %p\n",slot,symb,pdcch_dmrs[slot][symb]); AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } @@ -136,16 +139,19 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->nr_gold_pdsch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; for (int slot=0; slot<fp->slots_per_frame; slot++) { pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *)); AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + for (int q=0; q<nb_codewords; q++) { + pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); } } @@ -158,6 +164,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs; + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for(int nscid=0; nscid<2; nscid++) { pusch_dmrs[nscid] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); AssertFatal(pusch_dmrs[nscid]!=NULL, "NR init: pusch_dmrs for nscid %d - malloc failed\n", nscid); @@ -167,7 +175,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, AssertFatal(pusch_dmrs[nscid][slot]!=NULL, "NR init: pusch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pusch_dmrs[nscid][slot][symb]!=NULL, "NR init: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } } @@ -178,6 +186,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, nr_gold_pusch(gNB, &Nid_pusch[0]); // CSI RS init + // ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32) + int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1; for (int id=0; id<NUMBER_OF_NR_CSIRS_MAX; id++) { gNB->nr_csi_rs_info[id] = (nr_csi_rs_info_t *)malloc16_clear(sizeof(nr_csi_rs_info_t)); gNB->nr_csi_rs_info[id]->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); @@ -186,7 +196,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t)); AssertFatal(gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb); } } @@ -195,6 +205,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) { gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); + gNB->nr_srs_info[id]->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t)); gNB->nr_srs_info[id]->srs_generated_signal = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); gNB->nr_srs_info[id]->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t)); gNB->nr_srs_info[id]->srs_received_signal = (int32_t **)malloc16(Prx*sizeof(int32_t*)); @@ -313,9 +324,10 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(pdcch_dmrs); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) + for (int q = 0; q < nb_codewords; q++) free_and_zero(pdsch_dmrs[slot][symb][q]); free_and_zero(pdsch_dmrs[slot][symb]); } @@ -353,6 +365,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]); free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]); } + free_and_zero(gNB->nr_srs_info[id]->sc_list); free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal); free_and_zero(gNB->nr_srs_info[id]->noise_power); free_and_zero(gNB->nr_srs_info[id]->srs_received_signal); @@ -561,9 +574,10 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) { uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; msg->num_pdsch_slot = 0; + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) { LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max); - for (int j=0; j<2; j++) { + for (int j=0; j<num_cw; j++) { msg->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size); AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i); } @@ -575,9 +589,10 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) - for (int j=0; j<2; j++) - free_gNB_dlsch(&msg->dlsch[i][j], grid_size); + for (int j=0; j<num_cw; j++) + free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp); } void init_nr_transport(PHY_VARS_gNB *gNB) { @@ -602,22 +617,16 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); - for (int j=0; j<2; j++) { - // ULSCH for data - gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL); - - if (!gNB->ulsch[i][j]) { - LOG_E(PHY,"Can't get gNB ulsch structures\n"); - exit(-1); - } + gNB->ulsch[i] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL); + if (!gNB->ulsch[i]) { + LOG_E(PHY,"Can't get gNB ulsch structures\n"); + exit(-1); } - } gNB->rx_total_gain_dB=130; - //fp->pucch_config_common.deltaPUCCH_Shift = 1; } @@ -632,6 +641,5 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) free_gNB_srs(gNB->srs[i]); for (int i=0; i<gNB->number_of_nr_ulsch_max; i++) - for (int j=0; j<2; j++) - free_gNB_ulsch(&gNB->ulsch[i][j], fp->N_RB_UL); + free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); } diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 1a4a6c4afcf7e846c45010a75b9f396ebf56d864..83b2df2cedc364ef167dceafd0f073ceb4a334b0 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -57,6 +57,7 @@ extern uint16_t beta_cqi[16]; */ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, const NR_DL_FRAME_PARMS *const fp) { + AssertFatal( pdsch, "pdsch==0" ); pdsch->pmi_ext = (uint8_t *)malloc16_clear( fp->N_RB_DL ); pdsch->llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); @@ -154,21 +155,6 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp free_and_zero(pdsch->dl_ch_ptrs_estimates_ext); } -void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch, - const NR_DL_FRAME_PARMS *const fp) { - AssertFatal( pusch, "pusch==0" ); - - for (int i=0; i<NR_MAX_NB_LAYERS; i++) { - pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(NR_MAX_PUSCH_ENCODED_LENGTH*sizeof(int32_t)); - } -} - -void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch) -{ - for (int i = 0; i < NR_MAX_NB_LAYERS; i++) - free_and_zero(pusch->txdataF_layers[i]); -} - int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) { // create shortcuts @@ -183,8 +169,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) int i,j,k,l,slot,symb,q; int gNB_id; int th_id; - uint32_t ****pusch_dmrs; + LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx); + phy_init_nr_top(ue); // many memory allocation sizes are hard coded AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); @@ -212,15 +199,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // init NR modulation lookup tables nr_generate_modulation_table(); - /////////////////////////PUSCH init///////////////////////// - /////////// - for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - ue->pusch_vars[th_id][gNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH)); - phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][gNB_id], fp ); - } - } - /////////////////////////PUCCH init///////////////////////// /////////// for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { @@ -236,21 +214,21 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) /////////////////////////PUSCH DMRS init///////////////////////// /////////// - ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); - pusch_dmrs = ue->nr_gold_pusch_dmrs; + + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; + + ue->nr_gold_pusch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); + uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs; for (slot=0; slot<fp->slots_per_frame; slot++) { - pusch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); + pusch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pusch_dmrs[slot]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d - malloc failed\n", slot); for (symb=0; symb<fp->symbols_per_slot; symb++) { - pusch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pusch_dmrs[slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pusch_dmrs[slot][symb]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pusch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); - AssertFatal(pusch_dmrs[slot][symb][q]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); - } } } @@ -299,6 +277,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } } + // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; //PDCCH DMRS init (gNB offset = 0) ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0]; @@ -309,11 +289,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } } + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; + //PDSCH DMRS init (eNB offset = 0) ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0]; @@ -322,12 +305,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *)); AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + for (int q=0; q<nb_codewords; q++) { + pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); } } @@ -353,6 +337,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) csirs_vars[gNB_id]->active = false; srs_vars[gNB_id]->active = false; + // ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32) + int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1; ue->nr_csi_rs_info = (nr_csi_rs_info_t *)malloc16_clear(sizeof(nr_csi_rs_info_t)); ue->nr_csi_rs_info->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); AssertFatal(ue->nr_csi_rs_info->nr_gold_csi_rs!=NULL, "NR init: csi reference signal malloc failed\n"); @@ -360,7 +346,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->nr_csi_rs_info->nr_gold_csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(ue->nr_csi_rs_info->nr_gold_csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - ue->nr_csi_rs_info->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + ue->nr_csi_rs_info->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t)); AssertFatal(ue->nr_csi_rs_info->nr_gold_csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb); } } @@ -383,6 +369,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); + ue->nr_srs_info->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t)); ue->nr_srs_info->srs_generated_signal = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) ); ue->nr_srs_info->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t)); ue->nr_srs_info->srs_received_signal = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -519,16 +506,12 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - phy_term_nr_ue_PUSCH(ue->pusch_vars[th_id][gNB_id]); - free_and_zero(ue->pusch_vars[th_id][gNB_id]); free_and_zero(ue->pucch_vars[th_id][gNB_id]); } } for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) - free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb][q]); free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb]); } free_and_zero(ue->nr_gold_pusch_dmrs[slot]); @@ -562,9 +545,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } free_and_zero(ue->nr_gold_pdcch[0]); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int slot=0; slot<fp->slots_per_frame; slot++) { for (int symb=0; symb<fp->symbols_per_slot; symb++) { - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) + for (int q=0; q<nb_codewords; q++) free_and_zero(ue->nr_gold_pdsch[0][slot][symb][q]); free_and_zero(ue->nr_gold_pdsch[0][slot][symb]); } @@ -672,6 +656,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]); free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]); } + free_and_zero(ue->nr_srs_info->sc_list); free_and_zero(ue->nr_srs_info->srs_generated_signal); free_and_zero(ue->nr_srs_info->noise_power); free_and_zero(ue->nr_srs_info->srs_received_signal); @@ -709,7 +694,8 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) for (int j = 0; j < 2; j++) { for (int k = 0; k < RX_NB_TH_MAX; k++) { free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL); - free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL); + if (j==0) + free_nr_ue_ulsch(&ue->ulsch[k][i], N_RB_DL); } } @@ -720,15 +706,19 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL); } -void init_nr_ue_transport(PHY_VARS_NR_UE *ue) -{ +void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { + + int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1; + for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { - for (int j=0; j<2; j++) { + for (int j=0; j<num_codeword; j++) { for (int k=0; k<RX_NB_TH_MAX; k++) { AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]); - AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n"); - LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]); + if (j==0) { + AssertFatal((ue->ulsch[k][i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n"); + LOG_D(PHY,"ulsch[%d][%d] => %p\n",k,i,ue->ulsch[k][i]); + } } } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 35bc28d9c111f67aada20fa34a9984b65b04d2af..757a8d965f982119751d6fcd61ce337944dd6cfa 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -253,7 +253,6 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp); - if (Ncp == NFAPI_CP_EXTENDED) AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu); diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c index 9ebd841430927e1c165d14234099948f37f0793b..ce524ef611c3e9cf98528166d7d01d6e9a864858 100644 --- a/openair1/PHY/LTE_TRANSPORT/pss.c +++ b/openair1/PHY/LTE_TRANSPORT/pss.c @@ -72,10 +72,6 @@ int generate_pss(int32_t **txdataF, a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15; //printf("[PSS] amp=%d, a=%d\n",amp,a); - if (IS_SOFTMODEM_BASICSIM) - /* a hack to remove at some point (the UE doesn't synch with 100 RBs) */ - a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15; - Nsymb = (frame_parms->Ncp==NORMAL)?14:12; for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c index ba904629a1ccd34cc46c012b30d1bdf8b61370d0..ff7affe1b3a2855d5db9faf8785c364b533f63f9 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c @@ -557,11 +557,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) { ue->measurements.rx_power_avg_dB[0] = dB_fixed(ue->measurements.rx_power_avg[0]); LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] ); - if (IS_SOFTMODEM_BASICSIM ) - phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); - } else { - if (IS_SOFTMODEM_BASICSIM ) - phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); } return ret; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 929f63e9fc0092f56ac42203f7a8e5d1d54676b8..82120dc3c333833eb338083596b2758a422a8b17 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -81,29 +81,20 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 int i, prach_len; uint16_t first_nonzero_root_idx=0; - if ( !(IS_SOFTMODEM_BASICSIM ) ) { - prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); + prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); #ifdef PRACH_DEBUG - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); + LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, + prach_start, + ue->rx_offset, + ue->hw_timing_advance, + ue->N_TA_offset); #endif - if (prach_start<0) - prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - - if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - } else { //normal case (simulation) - prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset; - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); - } + if (prach_start<0) + prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); + + if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); // First compute physical root sequence if (restricted_set == 0) { @@ -476,40 +467,32 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 AssertFatal(prach_fmt<4, "prach_fmt4 not fully implemented" ); - if (!(IS_SOFTMODEM_BASICSIM ) ) { - int j; - int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; - LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); + int j; + int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; + LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); - for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { - ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; - ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; - } + for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { + ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; + ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; + } - for (i=0; i<overflow; i++,j++) { - ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; - ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; - } + for (i=0; i<overflow; i++,j++) { + ((int16_t *)ue->common_vars.txdata[0])[2*i] = prach[2*j]; + ((int16_t *)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]; + } #if defined(EXMIMO) - // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on - for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) { - if (k<0) - ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else - ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; - } - -#endif - } else { // simulators - for (i=0; i<prach_len; i++) { - ((int16_t *)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i]; - ((int16_t *)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1]; - } + // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on + for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) { + if (k<0) + ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else + ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; } +#endif #if defined(PRACH_WRITE_OUTPUT_DEBUG) LOG_M("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1); diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index c81a88ff3075bd6071a8cc02b5230f29f51de7af..4cb3185b67ef5a99eeb624bcf57616220f6329f1 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -320,98 +320,16 @@ void nr_layer_mapping(int16_t **mod_symbs, } } -void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, +void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, uint16_t n_symbs, - int16_t **tx_layers) -{ - int16_t *mod_symbs; - - switch (n_layers) { - - case 1: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - for (int i=0; i<n_symbs; i++) { - tx_layers[0][i<<1] = (mod_symbs[i<<1]*AMP)>>15; - tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15; - } - break; - - case 2: - case 3: - case 4: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs/n_layers; i++) { - for (int l=0; l<n_layers; l++) { - tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; - } - } - break; - - case 5: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs>>1; i++) - for (int l=0; l<2; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<1)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<1)+l)<<1)+1]*AMP)>>15; - } - - mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; - - for (int i=0; i<n_symbs/3; i++) - for (int l=2; l<5; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - break; - - case 6: - for (int q=0; q<2; q++) { - mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; + int16_t **tx_layers) { - for (int i=0; i<n_symbs/3; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - } - break; - - case 7: - mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; - - for (int i=0; i<n_symbs/3; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs/4; i++) - for (int l=3; l<7; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; - } - break; - - case 8: - for (int q=0; q<2; q++) { - mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; - - for (int i=0; i<n_symbs>>2; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; - } - } - break; - - default: - AssertFatal(0, "Invalid number of layers %d\n", n_layers); + for (int i=0; i<n_symbs/n_layers; i++) { + for (int l=0; l<n_layers; l++) { + tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15; + tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; + } } } diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 75541a13615ce851db32f45e127c7285e5db971b..db15e3d9efc5fac5b145e82d5bca19e6735a61a1 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -66,7 +66,7 @@ void nr_layer_mapping(int16_t **mod_symbs, @param[out] tx_layers, modulated symbols for each layer */ -void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, +void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, uint16_t n_symbs, int16_t **tx_layers); diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index cfb5a2e56ebb799de3d119e54a12714cb51b18bb..f4761489f578f7828c89ea0405b9eb78cfd680a8 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -184,7 +184,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; int ch_offset = fp->ofdm_symbol_size * symbol; - int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size; + int N_RB_UL = gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu.rb_size; rx_power_tot[ulsch_id] = 0; diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index f059283440229b97ed1a0f0a8242f4f66c99ba0e..14f62b80337a80ff9a98503b5cb8fe48039b57ee 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -60,6 +60,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) uint8_t reset; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) { @@ -67,7 +68,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid<<1)); LOG_D(PHY,"PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n",slot,symb,Nid,x2); - for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<pdcch_dmrs_init_length; n++) { pdcch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -81,11 +82,12 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) { uint32_t x1, x2; - uint8_t reset, q; + uint8_t reset; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; - - uint16_t N_n_scid[NR_MAX_NB_CODEWORDS]={Nid, Nid}; // Not correct, appropriate scrambling IDs have to be updated to support DCI 1_1 + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + uint16_t N_n_scid[2]={Nid, Nid}; uint8_t n_scid=0; // again works only for 1_0 for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { @@ -93,13 +95,13 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); LOG_D(PHY,"PDSCH DMRS slot %d, symb %d x2 %x, N_n_scid %d,n_scid %d\n",slot,symb,x2,N_n_scid[n_scid],n_scid); - for (uint32_t n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<pdsch_dmrs_init_length; n++) { pdsch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } - for (q = 1; q < NR_MAX_NB_CODEWORDS; q++) - memcpy(pdsch_dmrs[slot][symb][q],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD); + if(nb_codewords>1) + memcpy(pdsch_dmrs[slot][symb][1],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*pdsch_dmrs_init_length); } } } @@ -113,6 +115,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { unsigned int nid; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; unsigned short l; + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for (nscid=0; nscid<2; nscid++) { nid = Nid[nscid]; @@ -122,7 +125,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { x2 = ((1<<17) * (fp->symbols_per_slot*ns+l+1) * ((nid<<1)+1) +((nid<<1)+nscid)); LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n",ns,l,x2); - for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (n=0; n<pusch_dmrs_init_length; n++) { gNB->nr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index e949faeaf0be344296f6288f8f81ac53d4986004..932cdba538a2d8c34f7d1a42ce64aaa5a94ecffe 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -57,6 +57,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, unsigned char ns,l; unsigned int n,x1,x2,x2tmp0; uint8_t reset; + int pdcch_dmrs_init_length = (((ue->frame_parms.N_RB_DL<<1)*3)>>5)+1; for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { @@ -66,7 +67,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2 = (x2tmp0+(nid<<1))%(1U<<31); //cinit - for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (n=0; n<pdcch_dmrs_init_length; n++) { ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -77,28 +78,28 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue, unsigned short *n_idDMRS) { - unsigned char l; - unsigned int n,x1,x2,x2tmp0,ns; - int nscid; + + unsigned int x1,x2,x2tmp0; unsigned int nid; uint8_t reset; - + int pdsch_dmrs_init_length = ((ue->frame_parms.N_RB_DL*12)>>5)+1; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; /// to be updated from higher layer //unsigned short lbar = 0; - for (nscid=0; nscid<2; nscid++) { - for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { + for (int nscid=0; nscid<nb_codewords; nscid++) { + for (int ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { nid = n_idDMRS[nscid]; - for (l=0; l<ue->frame_parms.symbols_per_slot; l++) { + for (int l=0; l<ue->frame_parms.symbols_per_slot; l++) { reset = 1; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2 = (x2tmp0+(nid<<1)+nscid)%(1U<<31); //cinit LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (int n=0; n<pdsch_dmrs_init_length; n++) { ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -112,9 +113,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, uint8_t n_scid) { uint32_t x1, x2, n; - uint8_t reset, slot, symb, q; + uint8_t reset, slot, symb; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; - uint32_t ****pusch_dmrs = ue->nr_gold_pusch_dmrs; + uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs; + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for (slot=0; slot<fp->slots_per_frame; slot++) { @@ -123,13 +125,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); - for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) { - pusch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset); + for (n=0; n<pusch_dmrs_init_length; n++) { + pusch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } - - for (q = 1; q < NR_MAX_NB_CODEWORDS; q++) - memcpy(pusch_dmrs[slot][symb][q],pusch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD); } } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index b1688e25ec7cae17ad8d969223c694aa854da699..1aa082e90e74dbfd0714f6658b70b061ac5c5eae 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -30,11 +30,12 @@ void nr_init_csi_rs(NR_DL_FRAME_PARMS *fp, uint32_t ***csi_rs, uint32_t Nid) { uint32_t x1, x2; uint8_t reset; + int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1; for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) { reset = 1; x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); - for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<csi_dmrs_init_length; n++) { csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -69,7 +70,9 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, int dataF_offset = slot*frame_parms.samples_per_slot_wCP; uint32_t **nr_gold_csi_rs = nr_csi_rs_info->nr_gold_csi_rs[slot]; - int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));; + //*8(max allocation per RB)*2(QPSK)) + int csi_rs_length = frame_parms.N_RB_DL<<4; + int16_t mod_csi[frame_parms.symbols_per_slot][csi_rs_length>>1] __attribute__((aligned(16))); uint16_t b = csi_params->freq_domain; uint16_t n, p, k, l, mprime, na, kpn; uint8_t size, ports, kprime, lprime, i, gs; @@ -92,7 +95,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, for (uint8_t symb=0; symb<frame_parms.symbols_per_slot; symb++) { reset = 1; x2 = ((1<<10) * (frame_parms.symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); - for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<(csi_rs_length>>5)+1; n++) { nr_gold_csi_rs[symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -642,7 +645,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, #endif } } - } + } } } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 1a573d5c69e249030eaa6b4a2c3c584c9b8647bc..129301a86717253000196432ebb445659188e1e9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -79,10 +79,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; - uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs; int16_t **tx_layers = (int16_t**)dlsch->txdataF; - int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding; int8_t Wf[2], Wt[2], l0, l_prime, l_overline, delta; uint8_t dmrs_Type = rel15->dmrsConfigType; int nb_re_dmrs; @@ -100,6 +98,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; + uint32_t scrambled_output[rel15->NrOfCodewords][(encoded_length>>5)+1]; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /* PTRS */ @@ -121,8 +120,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, /// CRC, coding, interleaving and rate matching AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); - unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32))); - bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); + unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(32))); + bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers); start_meas(dlsch_encoding_stats); if (nr_dlsch_encoding(gNB, @@ -147,20 +146,18 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } printf("\n"); #endif - - - + /// scrambling start_meas(dlsch_scrambling_stats); - for (int q=0; q<rel15->NrOfCodewords; q++) - memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t)); - for (int q=0; q<rel15->NrOfCodewords; q++) + for (int q=0; q<rel15->NrOfCodewords; q++) { + memset((void*)scrambled_output[q], 0, ((encoded_length>>5)+1)*sizeof(uint32_t)); nr_pdsch_codeword_scrambling(output, encoded_length, q, rel15->dataScramblingId, rel15->rnti, scrambled_output[q]); + } stop_meas(dlsch_scrambling_stats); #ifdef DEBUG_DLSCH @@ -220,6 +217,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, start_sc -= frame_parms->ofdm_symbol_size; int txdataF_offset = slot*frame_parms->samples_per_slot_wCP; + int16_t **txdataF_precoding = (int16_t **)malloc16(rel15->nrOfLayers*sizeof(int16_t *)); + for (int layer = 0; layer<rel15->nrOfLayers; layer++) + txdataF_precoding[layer] = (int16_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int16_t)); #ifdef DEBUG_DLSCH_MAPPING printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", @@ -297,7 +297,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos); if(ptrs_symbol) { /* PTRS QPSK Modulation for each OFDM symbol in a slot */ - printf("Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); + LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); nr_modulation(pdsch_dmrs[l][0], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); } } @@ -462,14 +462,34 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, pmi = 0;//no precoding if (pmi == 0) {//unitary Precoding - if(ap<rel15->nrOfLayers) - memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], - (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], - NR_NB_SC_PER_RB*sizeof(int32_t)); - else - memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], - 0, - NR_NB_SC_PER_RB*sizeof(int32_t)); + if (k + NR_NB_SC_PER_RB <= frame_parms->ofdm_symbol_size) { // RB does not cross DC + if(ap<rel15->nrOfLayers) + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], + NR_NB_SC_PER_RB*sizeof(int32_t)); + else + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + 0, + NR_NB_SC_PER_RB*sizeof(int32_t)); + } else { // RB does cross DC + int neg_length = frame_parms->ofdm_symbol_size - k; + int pos_length = NR_NB_SC_PER_RB - neg_length; + if (ap<rel15->nrOfLayers) { + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)], + neg_length*sizeof(int32_t)); + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size)], + pos_length*sizeof(int32_t)); + } else { + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + 0, + neg_length*sizeof(int32_t)); + memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset], + 0, + pos_length*sizeof(int32_t)); + } + } k += NR_NB_SC_PER_RB; if (k >= frame_parms->ofdm_symbol_size) { k -= frame_parms->ofdm_symbol_size; @@ -540,6 +560,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, else { LOG_D(PHY,"beam index for PDSCH allocation already taken\n"); } + for (int layer = 0; layer<rel15->nrOfLayers; layer++) + free16(txdataF_precoding[layer],2*14*frame_parms->ofdm_symbol_size); + free16(txdataF_precoding,rel15->nrOfLayers); }// dlsch loop } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 77db12672f33952564a0c791fdb09d4a40221b40..28676b49f26ae9f51bbf2e720c6c9f39e56825f5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -68,7 +68,6 @@ void nr_fill_dlsch(processingData_L1tx_t *msgTx, void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot); -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index cdf0e6c1527b0afbc354a37c261a84e9ac4fc2e4..229f59032e0aaebb90ad5d8aec7a711310f36a45 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -50,10 +50,14 @@ //#define DEBUG_DLSCH_FREE 1 -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) { - int r; +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, + uint16_t N_RB, + const NR_DL_FRAME_PARMS* frame_parms) { + NR_gNB_DLSCH_t *dlsch = *dlschptr; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; if (N_RB != 273) { a_segments = a_segments*N_RB; @@ -65,26 +69,30 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) { free16(harq->b, a_segments * 1056); harq->b = NULL; } - for (r = 0; r < a_segments; r++) { + for (int r = 0; r < a_segments; r++) { free(harq->c[r]); harq->c[r] = NULL; } + free(harq->c); free(harq->pdu); for (int aa = 0; aa < 64; aa++) free(dlsch->calib_dl_ch_estimates[aa]); free(dlsch->calib_dl_ch_estimates); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + for (int q=0; q<nb_codewords; q++) free(dlsch->mod_symbs[q]); + free(dlsch->mod_symbs); - for (int layer = 0; layer < NR_MAX_NB_LAYERS; layer++) { - free(dlsch->txdataF_precoding[layer]); + for (int layer = 0; layer < max_layers; layer++) { free(dlsch->txdataF[layer]); for (int aa = 0; aa < 64; aa++) free(dlsch->ue_spec_bf_weights[layer][aa]); free(dlsch->ue_spec_bf_weights[layer]); } + free(dlsch->txdataF); + free(dlsch->ue_spec_bf_weights); free(dlsch); *dlschptr = NULL; @@ -96,9 +104,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint32_t Nsoft, uint8_t abstraction_flag, uint16_t N_RB) { - unsigned char i,r,aa,layer; - int re; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated if (N_RB != 273) { a_segments = a_segments*N_RB; @@ -114,31 +122,36 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, dlsch->Mlimit = 4; dlsch->Nsoft = Nsoft; - for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) { + int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer + + dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *)); + + dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **)); + for (int layer=0; layer<max_layers; layer++) { dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *)); - for (aa=0; aa<64; aa++) { + for (int aa=0; aa<64; aa++) { dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); - for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { + for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; } } - - dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH - dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t)); + dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t)); } - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) - dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t)); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + dlsch->mod_symbs = (int32_t **)malloc16(nb_codewords*sizeof(int32_t *)); + for (int q=0; q<nb_codewords; q++) + dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t)); dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64*sizeof(int32_t *)); - for (aa=0; aa<64; aa++) { + for (int aa=0; aa<64; aa++) { dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); } - for (i=0; i<20; i++) { + for (int i=0; i<20; i++) { dlsch->harq_ids[0][i] = 0; dlsch->harq_ids[1][i] = 0; } @@ -153,7 +166,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3); bzero(harq->b, dlsch_bytes); - for (r = 0; r < a_segments; r++) { + harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); + for (int r = 0; r < a_segments; r++) { // account for filler in first segment and CRCs for multiple segment case // [hna] 8448 is the maximum CB size in NR // 68*348 = 68*(maximum size of Zc) @@ -316,6 +330,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, stats->current_Qm = rel15->qamModOrder[0]; } + int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056; if (A > 3824) { // Add 24-bit crc (polynomial A) to payload crc = crc24a(a,A)>>8; @@ -326,11 +341,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]); harq->B = A+24; // harq->b = a; - AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES, + AssertFatal((A / 8) + 4 <= max_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, - MAX_NR_DLSCH_PAYLOAD_BYTES); + max_bytes); memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes? } else { // Add 16-bit crc (polynomial A) to payload @@ -341,11 +356,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]); harq->B = A+16; // harq->b = a; - AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES, + AssertFatal((A / 8) + 3 <= max_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, - MAX_NR_DLSCH_PAYLOAD_BYTES); + max_bytes); memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc } @@ -363,6 +378,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG); stop_meas(dlsch_segmentation_stats); + if (impp.n_segments>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",impp.n_segments,harq->B); + return(-1); + } + for (int r=0; r<impp.n_segments; r++) { //d_tmp[r] = &harq->d[r][0]; //channel_input[r] = &harq->d[r][0]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c index b68ad2d89f9b86259bc613ba9fb315af140424f8..4bbecfd994d4ffd0dd180a5634d87f15084fd460 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c +++ b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c @@ -40,7 +40,7 @@ void nr_codeword_scrambling(uint8_t *in, __m256i c = ((__m256i*)in)[i]; uint32_t in32 = _mm256_movemask_epi8(_mm256_slli_epi16(c,7)); out[i]=(in32^s); - //printf("in[%d] %x => %x\n",i,in32,out[i]); + LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]); s=lte_gold_generic(&x1, &x2, 0); } #elif defined(__SSE4__) diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 19e87604f2f238bf0c1c8d07beeef5b2cf6af97c..68e37e49f1658c9c80c454a55b599aaed6a7b1dd 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -106,7 +106,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag, uint16_t N_RB); -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB); +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, const NR_DL_FRAME_PARMS* frame_parms); /** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs - RB extraction (signal and channel estimates) @@ -146,7 +146,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, - NR_gNB_ULSCH_t **ulsch_gNB, + NR_gNB_ULSCH_t *ulsch_gNB, uint8_t symbol, uint8_t start_symbol, uint16_t nb_rb, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index 1cb503489bbdcf28d10c1c07e34662e9f3537930..3e3137739e2d620339619ab17414cf2a17b05a35 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -42,15 +42,14 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { AssertFatal(gNB!=NULL,"gNB is null\n"); for (i=0; i<gNB->number_of_nr_ulsch_max; i++) { AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i); - AssertFatal(gNB->ulsch[i][0]!=NULL,"gNB->ulsch[%d][0] is null\n",i); - LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i][0]->harq_mask,gNB->ulsch[i][0]->rnti,first_free_index); - if ((gNB->ulsch[i][0]->harq_mask >0) && - (gNB->ulsch[i][0]->rnti==rnti)) return i; - else if ((gNB->ulsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; + LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i]->harq_mask,gNB->ulsch[i]->rnti,first_free_index); + if ((gNB->ulsch[i]->harq_mask >0) && + (gNB->ulsch[i]->rnti==rnti)) return i; + else if ((gNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; } if (type == SEARCH_EXIST) return -1; if (first_free_index != -1) - gNB->ulsch[first_free_index][0]->rnti = 0; + gNB->ulsch[first_free_index]->rnti = 0; return first_free_index; } @@ -64,7 +63,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, AssertFatal( (ulsch_id>=0) && (ulsch_id<gNB->number_of_nr_ulsch_max), "illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id); - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id]; int harq_pid = ulsch_pdu->pusch_data.harq_process_id; ulsch->rnti = ulsch_pdu->rnti; //ulsch->rnti_type; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index e9ed278bb1ec0aacfc9a0968d681ccb51c901111..49c1b898cc7372c8a7eb94a0b4dfac9b7b616966 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -175,7 +175,7 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) //t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS]; ulsch->harq_processes[i]->Z=0; /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) - //int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; + //int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448]; ulsch->harq_processes[i]->E=0; @@ -406,7 +406,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, #endif - NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id]; NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; @@ -532,6 +532,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, &harq_process->F, p_decParams->BG); + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*n_layers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } + + #ifdef DEBUG_ULSCH_DECODING printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z); if (!frame%100) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 681a9eae16b11946a8aa0d85722e68f275caab47..355830c07829b8f0b49f853d51c0b04ee71ddcf9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -356,7 +356,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, if (is_dmrs_symbol == 0) { // //rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]); - if (start_re + nb_re_pusch < frame_parms->ofdm_symbol_size) { + if (start_re + nb_re_pusch <= frame_parms->ofdm_symbol_size) { memcpy1((void*)rxF_ext, (void*)&rxF[start_re*2], nb_re_pusch*sizeof(int32_t)); @@ -403,7 +403,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, - NR_gNB_ULSCH_t **ulsch_gNB, + NR_gNB_ULSCH_t *ulsch_gNB, uint8_t symbol, uint8_t is_dmrs_symbol, unsigned short nb_rb, @@ -418,7 +418,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, // Determine scaling amplitude based the symbol - ch_amp = 1024*8; //((pilots) ? (ulsch_gNB[0]->sqrt_rho_b) : (ulsch_gNB[0]->sqrt_rho_a)); + ch_amp = 1024*8; //((pilots) ? (ulsch_gNB->sqrt_rho_b) : (ulsch_gNB->sqrt_rho_a)); LOG_D(PHY,"Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, is_dmrs_symbol, nb_rb, frame_parms->Ncp, symbol); // printf("Scaling PUSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); @@ -1177,7 +1177,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, int avgs = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu; int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers]; gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 35e512ea980ef52ee95a55516310186934181ed6..b9e2f4532ddac0bf55f6751a66a72c815dc9313c 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -457,7 +457,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 96709b91a19f4b3ccfb159056ede9d8df00e81ab..30836ded01426a2645122656dd43ffa4c1f8564c 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -534,8 +534,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; - //for (int i= 0; i<8; i++) - //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -548,6 +552,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -560,23 +570,22 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ch, dl_ch, 16); - -#ifdef DEBUG_PDCCH +#ifdef DEBUG_PDCCH for (int m =0; m<12; m++) printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]); -#endif +#endif + dl_ch += 24; + pil += 2; rxF += 8; - dl_ch += 24; - k += 12; - - + k += 4; for (pilot_cnt=3; pilot_cnt<(3*nb_rb_coreset); pilot_cnt += 3) { - if (k >= ue->frame_parms.ofdm_symbol_size){ - k-=ue->frame_parms.ofdm_symbol_size; - rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)];} + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -593,6 +602,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -605,6 +620,12 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, 16); pil += 2; rxF += 8; + k += 4; + + if (k >= ue->frame_parms.ofdm_symbol_size) { + k -= ue->frame_parms.ofdm_symbol_size; + rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; + } ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -617,11 +638,15 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ch, dl_ch, 16); - pil += 2; - rxF += 8; +#ifdef DEBUG_PDCCH + for (int m =0; m<12; m++) + printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]); +#endif dl_ch += 24; - k += 12; + pil += 2; + rxF += 8; + k += 4; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 5e18f6cc6d799ea0e7f608e0d93601e525fb3ad8..b5cc765be4443a8086bfbb58aa1016b8d7dfd786 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -61,12 +61,8 @@ char nr_dci_format_string[8][30] = { //#define NR_LTE_PDCCH_DCI_SWITCH //#define NR_PDCCH_DCI_DEBUG // activates NR_PDCCH_DCI_DEBUG logs #ifdef NR_PDCCH_DCI_DEBUG -#define LOG_DNL(a, ...) printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) -#define LOG_DD(a, ...) printf("\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) -#define LOG_DDD(a, ...) printf("\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) +#define LOG_DDD(a, ...) printf("<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ ) #else -#define LOG_DNL(a...) -#define LOG_DD(a...) #define LOG_DDD(a...) #endif #define NR_NBR_CORESET_ACT_BWP 3 // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0) @@ -371,11 +367,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, uint8_t i, j, aarx; int32_t *dl_ch0, *dl_ch0_ext, *rxF, *rxF_ext; -#ifdef DEBUG_DCI_DECODING - uint8_t symbol_mod = (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol; - LOG_I(PHY, "extract_rbs_single: symbol_mod %d\n",symbol_mod); -#endif - for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { dl_ch0 = &dl_ch_estimates[aarx][frame_parms->ofdm_symbol_size*symbol]; LOG_DDD("dl_ch0 = &dl_ch_estimates[aarx = (%d)][0]\n",aarx); @@ -397,9 +388,9 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, * 1.2 The RB is >= than the N_RB_DL/2 -> IQ symbols are in the first half of the rxdataF (from element 0) * 2. Number of RBs in the system bandwidth is odd * (particular case when the RB with DC as it is treated differently: it is situated in symbol borders of rxdataF) - * 2.1 The RB is <= than the N_RB_DL/2 -> IQ symbols are in the second half of the rxdataF (from first_carrier_offset) - * 2.2 The RB is > than the N_RB_DL/2+1 -> IQ symbols are in the first half of the rxdataF (from element 0 + 2nd half RB containing DC) - * 2.3 The RB is == N_RB_DL/2+1 -> IQ symbols are in the lower border of the rxdataF for first 6 IQ element and the upper border of the rxdataF for the last 6 IQ elements + * 2.1 The RB is < than the N_RB_DL/2 -> IQ symbols are in the second half of the rxdataF (from first_carrier_offset) + * 2.2 The RB is > than the N_RB_DL/2 -> IQ symbols are in the first half of the rxdataF (from element 0 + 2nd half RB containing DC) + * 2.3 The RB is == N_RB_DL/2 -> IQ symbols are in the upper border of the rxdataF for first 6 IQ element and the lower border of the rxdataF for the last 6 IQ elements * If the first RB containing PDCCH within the UE BWP and within the CORESET is higher than half of the system bandwidth (N_RB_DL), * then the IQ symbol is going to be found at the position 0+c_rb-N_RB_DL/2 in rxdataF and * we have to point the pointer at (1+c_rb-N_RB_DL/2) in rxdataF @@ -429,64 +420,65 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if (((c_rb + n_BWP_start) >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC) // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol - LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); - //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol - //#ifdef NR_PDCCH_DCI_DEBUG - // LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - // c_rb,aarx,(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); - //#endif + rxF = &rxdataF[aarx][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size]; + LOG_DDD("in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // number of RBs is odd and c_rb is higher than half system bandwidth + 1 // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(12*(c_rb + n_BWP_start - (frame_parms->N_RB_DL>>1)) - 6 + symbol * frame_parms->ofdm_symbol_size)); } if (((c_rb + n_BWP_start) == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC) // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table) - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", - c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); -#endif + rxF = &rxdataF[aarx][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size]; + LOG_DDD("in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(frame_parms->first_carrier_offset + 12 * (c_rb + n_BWP_start) + symbol * frame_parms->ofdm_symbol_size)); j = 0; for (i = 0; i < 6; i++) { //treating first part of the RB note that i=5 would correspond to DC. We treat it in NR if ((i != 1) && (i != 5)) { dl_ch0_ext[j] = dl_ch0[i]; - rxF_ext[j++] = rxF[i]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); + rxF_ext[j] = rxF[i]; + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i], *(1 + (short *) &rxF[i])); + j++; + } else { + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i], *(1 + (short *) &rxF[i])); } } // then we point at the begining of the symbol part of rxdataF do process second part of RB - rxF = &rxdataF[aarx][((symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n", - c_rb,aarx,(symbol * (frame_parms->ofdm_symbol_size))); -#endif + rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; // we point at the 1st part of the rxdataF in symbol + LOG_DDD("in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][symbol * frame_parms->ofdm_symbol_size = (%d)]\n", + c_rb,aarx,(symbol * frame_parms->ofdm_symbol_size)); for (; i < 12; i++) { if ((i != 9)) { dl_ch0_ext[j] = dl_ch0[i]; - rxF_ext[j++] = rxF[(1 + i - 6)]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); + rxF_ext[j] = rxF[i - 6]; + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i-6], *(1 + (short *) &rxF[i-6])); + j++; + } else { + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, + *(short *) &rxF[i-6], *(1 + (short *) &rxF[i-6])); } } @@ -494,32 +486,21 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS; rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS; dl_ch0 += 12; - //rxF += 7; - //c_rb++; - //n_BWP_start++; // We have to increment this variable here to be consequent in the for loop afterwards - //} } else { // treatment of any RB that does not contain the DC j = 0; for (i = 0; i < 12; i++) { if ((i != 1) && (i != 5) && (i != 9)) { rxF_ext[j] = rxF[i]; -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n", c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i, *(short *) &rxF[i], *(1 + (short *) &rxF[i])); -#endif dl_ch0_ext[j] = dl_ch0[i]; - - //LOG_DDD("ch %d => dl_ch0(%d,%d)\n", i, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i])); - //printf("\t-> dl_ch0[%d] => dl_ch0_ext[%d](%d,%d)\n", i,j, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i])); j++; } else { -#ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", + LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n", c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i, *(short *) &rxF[i], *(1 + (short *) &rxF[i])); -#endif } } @@ -527,8 +508,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, dl_ch0_ext += NBR_RE_PER_RB_WITHOUT_DMRS; rxF_ext += NBR_RE_PER_RB_WITHOUT_DMRS; dl_ch0 += 12; - //rxF += 12; - //} } } } @@ -783,7 +762,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, rel15->CCE, rel15->L); - LOG_D(PHY,"we end nr_pdcch_unscrambling()\n"); + LOG_D(PHY,"we end nr_pdcch_demapping_deinterleaving()\n"); LOG_D(PHY,"Ending nr_rx_pdcch() function\n"); return (0); @@ -883,8 +862,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, int dci_length = rel15->dci_length_options[k]; uint64_t dci_estimation[2]= {0}; - LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", - j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); + LOG_D(PHY, "(%i.%i) Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", + proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]); nr_pdcch_unscrambling(&pdcch_vars->e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); @@ -892,7 +871,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx]; for (int index_z = 0; index_z < L*6; index_z++){ for (int i=0; i<9; i++) { - LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); + LOG_I(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[9*index_z + i],*(1 + (int16_t *) &z[9*index_z + i])); } } #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index a9b8ce2e557c158b0fdc6ec6e44d068a1211201e..54b7c34608511829402c6fab9abbde35ff06add2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -79,9 +79,11 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) { free(params); } + void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { - int i,r; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; + NR_UE_DLSCH_t *dlsch=*dlschptr; if (dlsch) { @@ -90,36 +92,23 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { a_segments = a_segments/273 +1; } - for (i=0; i<dlsch->Mdlharq; i++) { + for (int i=0; i<dlsch->Mdlharq; i++) { if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]->b) { free16(dlsch->harq_processes[i]->b,a_segments*1056); dlsch->harq_processes[i]->b = NULL; } - for (r=0; r<a_segments; r++) { + for (int r=0; r<a_segments; r++) { free16(dlsch->harq_processes[i]->c[r],1056); dlsch->harq_processes[i]->c[r] = NULL; + free16(dlsch->harq_processes[i]->d[r],5*8448); + dlsch->harq_processes[i]->d[r] = NULL; + nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]); } - - for (r=0; r<a_segments; r++) - if (dlsch->harq_processes[i]->d[r]) { - free16(dlsch->harq_processes[i]->d[r],(5*8448)*sizeof(short)); - dlsch->harq_processes[i]->d[r] = NULL; - } - - for (r=0; r<a_segments; r++) - if (dlsch->harq_processes[i]->w[r]) { - free16(dlsch->harq_processes[i]->w[r],(5*8448)*sizeof(short)); - dlsch->harq_processes[i]->w[r] = NULL; - } - - for (r=0; r<a_segments; r++) { - if (dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]) { - nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]); - dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL; - } - } + free16(dlsch->harq_processes[i]->c,a_segments); + free16(dlsch->harq_processes[i]->d,a_segments); + free16(dlsch->harq_processes[i]->p_nrLDPC_procBuf,a_segments); free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t)); dlsch->harq_processes[i] = NULL; @@ -131,10 +120,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { } } + NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL) { + NR_UE_DLSCH_t *dlsch; - uint8_t exit_flag = 0,i,r; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + uint8_t exit_flag = 0; + + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated if (N_RB_DL != 273) { a_segments = a_segments*N_RB_DL; @@ -153,7 +145,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->Mlimit = 4; dlsch->max_ldpc_iterations = max_ldpc_iterations; - for (i=0; i<Mdlharq; i++) { + for (int i=0; i<Mdlharq; i++) { dlsch->harq_processes[i] = (NR_DL_UE_HARQ_t *)malloc16(sizeof(NR_DL_UE_HARQ_t)); if (dlsch->harq_processes[i]) { @@ -167,26 +159,17 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint else exit_flag=3; - for (r=0; r<a_segments; r++) { + dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); + dlsch->harq_processes[i]->d = (int16_t **)malloc16(a_segments*sizeof(int16_t *)); + dlsch->harq_processes[i]->p_nrLDPC_procBuf = (t_nrLDPC_procBuf **)malloc16(a_segments*sizeof(t_nrLDPC_procBuf *)); + for (int r=0; r<a_segments; r++) { dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem(); dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056); - + dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); - else - exit_flag=2; - - dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short)); - if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short)); - else - exit_flag=2; - - dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short)); - - if (dlsch->harq_processes[i]->w[r]) - memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short)); + memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; } @@ -320,11 +303,16 @@ void nr_processDLSegment(void* arg) { t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; + + int16_t w[5*8448]; + memset(w,0,(5*8448)*sizeof(short)); + start_meas(&rdata->ts_deinterleave); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); nr_deinterleaving_ldpc(E, Qm, - harq_process->w[r], // [hna] w is e + w, // [hna] w is e dlsch_llr+r_offset); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT); stop_meas(&rdata->ts_deinterleave); @@ -346,7 +334,7 @@ void nr_processDLSegment(void* arg) { p_decoderParms->BG, p_decoderParms->Z, harq_process->d[r], - harq_process->w[r], + w, harq_process->C, harq_process->rvidx, (harq_process->first_rx==1)?1:0, @@ -578,6 +566,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, &harq_process->F, p_decParams->BG); + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); } @@ -593,7 +586,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, p_decParams->numMaxIter = dlsch->max_ldpc_iterations; p_decParams->outMode= 0; r_offset = 0; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl; //number of segments to be allocated if (nb_rb != 273) { a_segments = a_segments*nb_rb; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 75517b7a6f519a94cb4d9a0e7769cd413b123097..bbb4a1e03a52196ff1fc98551f1c79a4dfa6c96a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -202,7 +202,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars = ue->pdsch_vars[proc->thread_id]; dlsch = ue->dlsch[proc->thread_id][gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; - dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; + if (NR_MAX_NB_LAYERS>4) + dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; beamforming_mode = ue->transmission_mode[gNB_id] < 7 ? 0 :ue->transmission_mode[gNB_id]; break; @@ -647,28 +648,29 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, // Please keep it: useful for debugging #ifdef DEBUG_PDSCH_RX - char filename[40]; + char filename[50]; uint8_t aa = 0; - snprintf(filename, 40, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); write_output(filename, "rxdataF0", &common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - snprintf(filename, 40, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "dl_ch_estimates", &pdsch_vars[gNB_id]->dl_ch_estimates[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - snprintf(filename, 40, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "rxdataF_ext", &pdsch_vars[gNB_id]->rxdataF_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - snprintf(filename, 40, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "dl_ch_estimates_ext00", &pdsch_vars[gNB_id]->dl_ch_estimates_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - snprintf(filename, 40, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); + snprintf(filename, 50, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "rxdataF_comp00", &pdsch_vars[gNB_id]->rxdataF_comp0[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - +/* for (int i=0; i < 2; i++){ - snprintf(filename, 40, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); + snprintf(filename, 50, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); write_output(filename,"llr", &pdsch_vars[gNB_id]->llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm), 1, 0); } +*/ #endif #if T_TRACER @@ -888,9 +890,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",(int16_t*)&rxdataF128[1]); - //print_shorts("ch:",(int16_t*)&dl_ch128[1]); - //print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); +#ifdef DEBUG_DLSCH_DEMOD + print_shorts("rx:",(int16_t*)&rxdataF128[1]); + print_shorts("ch:",(int16_t*)&dl_ch128[1]); + print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); +#endif // multiply by conjugated channel mmtmpD0 = _mm_madd_epi16(dl_ch128[2],rxdataF128[2]); @@ -906,9 +910,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - //print_shorts("rx:",(int16_t*)&rxdataF128[2]); - //print_shorts("ch:",(int16_t*)&dl_ch128[2]); - //print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); +#ifdef DEBUG_DLSCH_DEMOD + print_shorts("rx:",(int16_t*)&rxdataF128[2]); + print_shorts("ch:",(int16_t*)&dl_ch128[2]); + print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); +#endif dl_ch128+=3; dl_ch_mag128+=3; @@ -1993,87 +1999,88 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, NR_DL_FRAME_PARMS *frame_parms, uint16_t dlDmrsSymbPos) { - - unsigned short k,rb; - unsigned char nushift,i,aarx; - int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; - - int8_t validDmrsEst = 0; //store last DMRS Symbol index - - unsigned char j=0; - - if (config_type==NFAPI_NR_DMRS_TYPE1) { + if (config_type == NFAPI_NR_DMRS_TYPE1) { AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); - nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 - } else { AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); - nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 - } - - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + } - k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; + const unsigned short start_re = (frame_parms->first_carrier_offset + start_rb * NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size; + const int8_t validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos, symbol); - validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); + for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { - dl_ch0 = &dl_ch_estimates[aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))]; + int32_t *dl_ch0 = &dl_ch_estimates[aarx][validDmrsEst * frame_parms->ofdm_symbol_size]; + int32_t *dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol * nb_rb_pdsch * NR_NB_SC_PER_RB]; + int32_t *rxF_ext = &rxdataF_ext[aarx][symbol * nb_rb_pdsch * NR_NB_SC_PER_RB]; + int32_t *rxF = &rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size]; - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; + if (pilots == 0) { //data symbol only + if (start_re + nb_rb_pdsch * NR_NB_SC_PER_RB <= frame_parms->ofdm_symbol_size) { + memcpy((void*)rxF_ext, (void*)&rxF[start_re], nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); + } else { + int neg_length = frame_parms->ofdm_symbol_size - start_re; + int pos_length = nb_rb_pdsch * NR_NB_SC_PER_RB - neg_length; - rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; - - for (rb = 0; rb < nb_rb_pdsch; rb++) { - if (k>=frame_parms->ofdm_symbol_size) { - k = k-frame_parms->ofdm_symbol_size; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; + memcpy((void*)rxF_ext, (void*)&rxF[start_re], neg_length * sizeof(int32_t)); + memcpy((void*)&rxF_ext[neg_length], (void*)rxF, pos_length * sizeof(int32_t)); } - if (pilots==0) { - memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); - memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); - dl_ch0_ext+=12; - rxF_ext+=12; - } else {//the symbol contains DMRS - j=0; - if (config_type==NFAPI_NR_DMRS_TYPE1){ - if (nushift == 0) {//data is multiplexed - for (i = (1-nushift); i<12; i+=2) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - dl_ch0_ext+=6; - rxF_ext+=6; - } - } else {//NFAPI_NR_DMRS_TYPE2 - for (i = (2+nushift); i<6; i++) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - for (i = (8+nushift); i<12; i++) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - dl_ch0_ext+= j; - rxF_ext+= j; + memcpy((void*)dl_ch0_ext, (void*)dl_ch0, nb_rb_pdsch * NR_NB_SC_PER_RB * sizeof(int32_t)); + } + else if (config_type == NFAPI_NR_DMRS_TYPE1){ + if (n_dmrs_cdm_groups == 1) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 6*nb_rb_pdsch; j += 3) { + rxF_ext[j] = rxF[k+1]; + rxF_ext[j+1] = rxF[k+3]; + rxF_ext[j+2] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[1]; + dl_ch0_ext[j+1] = dl_ch0[3]; + dl_ch0_ext[j+2] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; } } - - dl_ch0+=12; - rxF+=12; - k+=12; - if (k>=frame_parms->ofdm_symbol_size) { - k = k-(frame_parms->ofdm_symbol_size); - rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))]; + } + else {//NFAPI_NR_DMRS_TYPE2 + if (n_dmrs_cdm_groups == 1) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 8*nb_rb_pdsch; j += 4) { + rxF_ext[j] = rxF[k+2]; + rxF_ext[j+1] = rxF[k+3]; + rxF_ext[j+2] = rxF[k+4]; + rxF_ext[j+3] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[2]; + dl_ch0_ext[j+1] = dl_ch0[3]; + dl_ch0_ext[j+2] = dl_ch0[4]; + dl_ch0_ext[j+3] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; + } + } + else if (n_dmrs_cdm_groups == 2) { //data is multiplexed + unsigned short k = start_re; + for (unsigned short j = 0; j < 4*nb_rb_pdsch; j += 2) { + rxF_ext[j] = rxF[k+4]; + rxF_ext[j+1] = rxF[k+5]; + dl_ch0_ext[j] = dl_ch0[4]; + dl_ch0_ext[j+1] = dl_ch0[5]; + dl_ch0 += 6; + k += 6; + if (k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; + } } } } - return(nb_rb_pdsch); + + return nb_rb_pdsch; } unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index caf3a19d855c04a474689198d941283a6f71d8c6..f76119250f5164a8c2859ce0a7bc926fe9fc283a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -88,9 +88,9 @@ typedef struct { /// LDPC-code outputs uint8_t *d[MAX_NUM_NR_ULSCH_SEGMENTS]; /// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17) - uint8_t *e; + uint8_t *e; /// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30) - uint8_t *f; + uint8_t *f; /// Number of code segments uint32_t C; /// Number of bits in code segments @@ -122,55 +122,15 @@ typedef struct { typedef struct { /// SRS active flag uint8_t srs_active; -//#if defined(UPGRADE_RAT_NR) -#if 1 // Pointers to HARQ processes for the ULSCH NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES]; int harq_process_id[NR_MAX_SLOTS_PER_FRAME]; // UL number of harq processes uint8_t number_harq_processes_for_pusch; -#endif - /* - /// Pointer to CQI data (+1 for 8 bits crc) - uint8_t o[1+MAX_CQI_BYTES]; - /// Length of CQI data (bits) - uint8_t O; - /// Format of CQI data - UCI_format_t uci_format; - /// Rank information - uint8_t o_RI[2]; - /// Length of rank information (bits) - uint8_t O_RI; - /// Pointer to ACK - uint8_t o_ACK[4]; - */ /// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37) uint8_t O_CQI_MIN; /// ACK/NAK Bundling flag uint8_t bundling; - /// Concatenated "g"-sequences (for definition see 36-212 V15.4.0 2018-12, p.31) - uint8_t g[MAX_NUM_NR_CHANNEL_BITS] __attribute__ ((aligned(32))); - /// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) - uint8_t h[MAX_NUM_NR_CHANNEL_BITS]; - /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS]; - /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - int32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) - int32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - /* - /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) - uint8_t q[MAX_CQI_PAYLOAD]; - - /// coded and interleaved CQI bits - uint8_t o_w[(MAX_CQI_BITS+8)*3]; - /// coded CQI bits - uint8_t o_d[96+((MAX_CQI_BITS+8)*3)]; - /// coded ACK bits - uint8_t q_ACK[MAX_ACK_PAYLOAD]; - /// coded RI bits - uint8_t q_RI[MAX_RI_PAYLOAD]; - */ /// beta_offset_cqi times 8 uint16_t beta_offset_cqi_times8; /// beta_offset_ri times 8 @@ -219,7 +179,9 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t **c; + /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + int16_t **d; /// Index of current HARQ round for this DLSCH uint8_t round; /// MCS table for this DLSCH @@ -234,14 +196,8 @@ typedef struct { uint8_t rvidx; /// MIMO mode for this DLSCH MIMO_nrmode_t mimo_mode; - /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *w[MAX_NUM_NR_DLSCH_SEGMENTS]; - /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - //double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; - /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; /// LDPC processing buffers - t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_DLSCH_SEGMENTS]; + t_nrLDPC_procBuf **p_nrLDPC_procBuf; /// Number of code segments uint32_t C; /// Number of bits in code segments diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c index 6530dd9512c6d78fe23175e3e0a39d27f8e39e10..d3f362b90cc4aeb2c5af6773e1ac92241001b240 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ue_rf_helpers.c @@ -86,16 +86,17 @@ void nr_rf_card_config_freq(openair0_config_t *openair0_cfg, uint8_t cc_id = 0; PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id]; int rf_chain = ue->rf_map.chain; + double freq_scale = (double)(dl_carrier + freq_offset) / dl_carrier; for (int i = rf_chain; i < rf_chain + 4; i++) { if (i < openair0_cfg->rx_num_channels) - openair0_cfg->rx_freq[i + rf_chain] = dl_carrier + freq_offset; + openair0_cfg->rx_freq[i + rf_chain] = dl_carrier * freq_scale; else openair0_cfg->rx_freq[i] = 0.0; if (i<openair0_cfg->tx_num_channels) - openair0_cfg->tx_freq[i] = ul_carrier + freq_offset; + openair0_cfg->tx_freq[i] = ul_carrier * freq_scale; else openair0_cfg->tx_freq[i] = 0.0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 0ab4c94b963d604549c89dfcf2dfe35aa0c71fb1..87ba2090e7c1997209b2008939595a615ef1b158 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -174,43 +174,23 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, unsigned int G) { start_meas(&ue->ulsch_encoding_stats); -/////////////////////////parameters and variables declaration///////////////////////// -/////////// - - unsigned int crc; - NR_UL_UE_HARQ_t *harq_process; - uint16_t nb_rb ; - uint32_t A, F; - uint32_t *pz; - uint8_t mod_order; - uint16_t Kr,r; - uint32_t r_offset; - uint32_t E,Kb; - uint8_t Ilbrm; - uint32_t Tbslbrm; - uint16_t R; - float Coderate; - -/////////// -/////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////parameters and variables initialization///////////////////////// /////////// - crc = 1; - harq_process = ulsch->harq_processes[harq_pid]; - nb_rb = harq_process->pusch_pdu.rb_size; - A = harq_process->pusch_pdu.pusch_data.tb_size*8; - pz = &harq_process->Z; - mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); - R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); - Kr=0; - r_offset=0; - F=0; - Ilbrm = 0; - Tbslbrm = 950984; //max tbs - Coderate = 0.0; + unsigned int crc = 1; + NR_UL_UE_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; + uint16_t nb_rb = harq_process->pusch_pdu.rb_size; + uint32_t A = harq_process->pusch_pdu.pusch_data.tb_size*8; + uint32_t *pz = &harq_process->Z; + uint8_t mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + uint16_t R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + uint16_t Kr=0; + uint32_t r_offset=0; + uint32_t F=0; + uint8_t Ilbrm = 0; + uint32_t Tbslbrm = 950984; //max tbs + float Coderate = 0.0; /////////// ///////////////////////////////////////////////////////////////////////////////////////// @@ -286,14 +266,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN); start_meas(&ue->ulsch_segmentation_stats); - Kb=nr_segmentation(harq_process->b, - harq_process->c, - harq_process->B, - &harq_process->C, - &harq_process->K, - pz, - &harq_process->F, - harq_process->BG); + uint32_t Kb=nr_segmentation(harq_process->b, + harq_process->c, + harq_process->B, + &harq_process->C, + &harq_process->K, + pz, + &harq_process->F, + harq_process->BG); + + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->pusch_pdu.nrOfLayers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } stop_meas(&ue->ulsch_segmentation_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT); @@ -310,7 +295,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, //printf("segment Z %d k %d Kr %d BG %d\n", *pz,harq_process->K,Kr,BG); //start_meas(te_stats); - for (r=0; r<harq_process->C; r++) { + for (int r=0; r<harq_process->C; r++) { //channel_input[r] = &harq_process->d[r][0]; #ifdef DEBUG_ULSCH_CODING printf("Encoder: B %d F %d \n",harq_process->B, harq_process->F); @@ -345,8 +330,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN); start_meas(&ue->ulsch_ldpc_encoding_stats); - for(int j = 0; j < (harq_process->C/8 + 1); j++) - { + for(int j = 0; j < (harq_process->C/8 + 1); j++) { impp.macro_num = j; nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,harq_process->BG,&impp); } @@ -369,14 +353,13 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, F = harq_process->F; Kr = harq_process->K; - for (r=0; r<harq_process->C; r++) { // looping over C segments - + for (int r=0; r<harq_process->C; r++) { // looping over C segments if (harq_process->F>0) { - for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) { - harq_process->d[r][k] = NR_NULL; - //if (k<(Kr-F+8)) - //printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]); - } + for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) { + harq_process->d[r][k] = NR_NULL; + //if (k<(Kr-F+8)) + //printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]); + } } @@ -391,7 +374,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ///////////////////////// d---->| Rate matching bit selection |---->e ///////////////////////// /////////// - E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); + uint32_t E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers); @@ -434,9 +417,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, start_meas(&ue->ulsch_interleaving_stats); nr_interleaving_ldpc(E, - mod_order, - harq_process->e+r_offset, - harq_process->f+r_offset); + mod_order, + harq_process->e+r_offset, + harq_process->f+r_offset); stop_meas(&ue->ulsch_interleaving_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT); @@ -458,8 +441,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, } - memcpy(ulsch->g,harq_process->f,G); // g is the concatenated code block - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); stop_meas(&ue->ulsch_encoding_stats); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 41cf9c2ffaa248f9fe0b4bbe8ab1455e841fef68..802cb55e03445dcd26ce7c17f3272022efb85c3f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -105,18 +105,15 @@ void nr_pusch_codeword_scrambling(uint8_t *in, } void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, - unsigned char harq_pid, - uint32_t frame, - uint8_t slot, - uint8_t thread_id, - int gNB_id) { + unsigned char harq_pid, + uint32_t frame, + uint8_t slot, + uint8_t thread_id, + int gNB_id) { LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot); uint32_t available_bits; - uint8_t cwd_index, l; - uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; - int16_t **tx_layers; int32_t **txdataF; int8_t Wf[2], Wt[2]; int l_prime[2], delta; @@ -125,102 +122,100 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int sample_offsetF, N_RE_prime; NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; - NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id]; - uint8_t num_of_codewords = 1; // tmp assumption int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig uint16_t number_dmrs_symbols = 0; - for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) { - - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index]; - NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; - nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu; - - int start_symbol = pusch_pdu->start_symbol_index; - uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos; - uint8_t number_of_symbols = pusch_pdu->nr_of_symbols; - uint8_t dmrs_type = pusch_pdu->dmrs_config_type; - uint16_t start_rb = pusch_pdu->rb_start; - uint16_t nb_rb = pusch_pdu->rb_size; - uint8_t Nl = pusch_pdu->nrOfLayers; - uint8_t mod_order = pusch_pdu->qam_mod_order; - uint16_t rnti = pusch_pdu->rnti; - uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; - uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; - - if (start_sc >= frame_parms->ofdm_symbol_size) - start_sc -= frame_parms->ofdm_symbol_size; - - ulsch_ue->Nid_cell = frame_parms->Nid_cell; - - for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) { - if((ul_dmrs_symb_pos >> i) & 0x01) - number_dmrs_symbols += 1; - } + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id]; + NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; + nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu; + + int start_symbol = pusch_pdu->start_symbol_index; + uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos; + uint8_t number_of_symbols = pusch_pdu->nr_of_symbols; + uint8_t dmrs_type = pusch_pdu->dmrs_config_type; + uint16_t start_rb = pusch_pdu->rb_start; + uint16_t nb_rb = pusch_pdu->rb_size; + uint8_t Nl = pusch_pdu->nrOfLayers; + uint8_t mod_order = pusch_pdu->qam_mod_order; + uint16_t rnti = pusch_pdu->rnti; + uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; + uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; + + if (start_sc >= frame_parms->ofdm_symbol_size) + start_sc -= frame_parms->ofdm_symbol_size; + + ulsch_ue->Nid_cell = frame_parms->Nid_cell; + + for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) { + if((ul_dmrs_symb_pos >> i) & 0x01) + number_dmrs_symbols += 1; + } - nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data; + nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data; - LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", - rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); + LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", + rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); - // TbD num_of_mod_symbols is set but never used - N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; - harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords; + // TbD num_of_mod_symbols is set but never used + N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; + harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb; - /////////////////////////ULSCH coding///////////////////////// - /////////// + /////////////////////////ULSCH coding///////////////////////// + /////////// - unsigned int G = nr_get_G(nb_rb, number_of_symbols, - nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); + unsigned int G = nr_get_G(nb_rb, number_of_symbols, + nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); - trace_NRpdu(DIRECTION_UPLINK, - ulsch_ue->harq_processes[harq_pid]->a, - ulsch_ue->harq_processes[harq_pid]->pusch_pdu.pusch_data.tb_size, - 0, WS_C_RNTI, rnti, frame, slot, 0, 0); - - if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1) - return; + trace_NRpdu(DIRECTION_UPLINK, + harq_process_ul_ue->a, + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size, + 0, WS_C_RNTI, rnti, frame, slot, 0, 0); + if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1) + return; - /////////// - //////////////////////////////////////////////////////////////////// - /////////////////////////ULSCH scrambling///////////////////////// - /////////// + /////////// + //////////////////////////////////////////////////////////////////// - available_bits = G; + /////////////////////////ULSCH scrambling///////////////////////// + /////////// - memset(scrambled_output[cwd_index], 0, ((available_bits>>5)+1)*sizeof(uint32_t)); + available_bits = G; + uint32_t scrambled_output[(available_bits>>5)+1]; + memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t)); - nr_pusch_codeword_scrambling(ulsch_ue->g, - available_bits, - ulsch_ue->Nid_cell, - rnti, - false, - scrambled_output[cwd_index]); // assume one codeword for the moment + nr_pusch_codeword_scrambling(harq_process_ul_ue->f, + available_bits, + ulsch_ue->Nid_cell, + rnti, + false, + scrambled_output); + ///////////// + ////////////////////////////////////////////////////////////////////////// - ///////////// - ////////////////////////////////////////////////////////////////////////// + /////////////////////////ULSCH modulation///////////////////////// + /////////// - /////////////////////////ULSCH modulation///////////////////////// - /////////// + int max_num_re = number_of_symbols*nb_rb*NR_NB_SC_PER_RB; + int32_t d_mod[max_num_re] __attribute__ ((aligned(16))); - nr_modulation(scrambled_output[cwd_index], // assume one codeword for the moment - available_bits, - mod_order, - (int16_t *)ulsch_ue->d_mod); + nr_modulation(scrambled_output, // assume one codeword for the moment + available_bits, + mod_order, + (int16_t *)d_mod); - /////////// - //////////////////////////////////////////////////////////////////////// + /////////// + //////////////////////////////////////////////////////////////////////// /////////////////////////DMRS Modulation///////////////////////// /////////// - uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; + uint32_t **pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16))); /////////// @@ -256,9 +251,11 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH layer mapping///////////////////////// /////////// - tx_layers = (int16_t **)pusch_ue->txdataF_layers; + int16_t **tx_layers = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *)); + for (int nl=0; nl<Nl; nl++) + tx_layers[nl] = (int16_t *)malloc16_clear((available_bits<<1)/mod_order*sizeof(int16_t)); - nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id], + nr_ue_layer_mapping((int16_t *)d_mod, Nl, available_bits/mod_order, tx_layers); @@ -276,13 +273,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t u = 0, v = 0; int16_t *dmrs_seq = NULL; + /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) + int32_t y[max_num_re] __attribute__ ((aligned(16))); + // if transform precoding is enbaled (value 0) if (pusch_pdu->transform_precoding == 0) { uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB; uint32_t y_offset = 0; uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2); - + // Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol); u = pusch_pdu->dfts_ofdm.low_papr_group_number; @@ -291,59 +291,54 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n"); AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated"); - + LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index); - for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { + for (int l = start_symbol; l < start_symbol + number_of_symbols; l++) { if((ul_dmrs_symb_pos >> l) & 0x01) /* In the symbol with DMRS no data would be transmitted CDM groups is 2*/ continue; - nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); + nr_dft(&y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); y_offset = y_offset + nb_re_pusch; LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset); - #ifdef DEBUG_PUSCH_MAPPING - printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n", - y_offset, nb_re_pusch, l, nb_rb); - #endif +#ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n", + y_offset, nb_re_pusch, l, nb_rb); +#endif } - #ifdef DEBUG_DFT_IDFT - int32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - int offset = 0; - printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); - - for (int ll = 0; ll < (available_bits/mod_order); ll++) { - debug_symbols[ll] = ulsch_ue->y[ll]; - } - - printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols); - for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) { +#ifdef DEBUG_DFT_IDFT + int32_t debug_symbols[max_num_re] __attribute__ ((aligned(16))); + int offset = 0; + printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); - nr_idft(&debug_symbols[offset], nb_re_pusch); - - offset = offset + nb_re_pusch; + for (int ll = 0; ll < (available_bits/mod_order); ll++) { + debug_symbols[ll] = y[ll]; + } - } - LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); - LOG_M("postDFT_all_symbols.m","UE_postDFT", ulsch_ue->y,number_of_symbols*nb_re_pusch,1,1); - LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); - LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); - #endif + printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols); + for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) { + nr_idft(&debug_symbols[offset], nb_re_pusch); + offset = offset + nb_re_pusch; + } + LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); + LOG_M("postDFT_all_symbols.m","UE_postDFT", y,number_of_symbols*nb_re_pusch,1,1); + LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); + LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); +#endif } else - memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); + memcpy(y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); - - /////////// - //////////////////////////////////////////////////////////////////////// - - + for (int nl = 0; nl < Nl; nl++) + free_and_zero(tx_layers[nl]); + free_and_zero(tx_layers); /////////////////////////ULSCH RE mapping///////////////////////// /////////// @@ -356,18 +351,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint16_t m = 0; - #ifdef DEBUG_PUSCH_MAPPING - printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u); - #endif - - +#ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u); +#endif // DMRS params for this ap get_Wt(Wt, ap, dmrs_type); get_Wf(Wf, ap, dmrs_type); delta = get_delta(ap, dmrs_type); - for (l=start_symbol; l<start_symbol+number_of_symbols; l++) { + for (int l=start_symbol; l<start_symbol+number_of_symbols; l++) { uint16_t k = start_sc; uint16_t n = 0; @@ -388,21 +381,18 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part // Perform this on gold sequence, not required when SC FDMA operation is done, - LOG_D(PHY,"DMRS in symbol %d\n",l); - nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - + LOG_D(PHY,"DMRS in symbol %d\n",l); + nr_modulation(pusch_dmrs[l], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // Qm = 2 as DMRS is QPSK modulated } else { dmrs_idx = 0; } - - } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { AssertFatal(pusch_pdu->transform_precoding == 1, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n"); if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) { is_ptrs_sym = 1; - nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs); + nr_modulation(pusch_dmrs[l], nb_rb, DMRS_MOD_ORDER, mod_ptrs); } } @@ -417,15 +407,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) is_dmrs = 1; } else if (is_ptrs_sym) { - is_ptrs = is_ptrs_subcarrier(k, - rnti, - ap, - dmrs_type, - K_ptrs, - nb_rb, - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, - start_sc, - frame_parms->ofdm_symbol_size); + is_ptrs = is_ptrs_subcarrier(k, + rnti, + ap, + dmrs_type, + K_ptrs, + nb_rb, + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_sc, + frame_parms->ofdm_symbol_size); } if (is_dmrs == 1) { @@ -434,19 +424,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15; - + } else { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; - } + } - #ifdef DEBUG_PUSCH_MAPPING - printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", - dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif +#ifdef DEBUG_PUSCH_MAPPING + printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", + dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); +#endif dmrs_idx++; @@ -463,14 +453,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k, start_sc, frame_parms->ofdm_symbol_size, cdm_grps_no_data, dmrs_type)) { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) y)[m<<1]; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) y)[(m<<1) + 1]; - #ifdef DEBUG_PUSCH_MAPPING +#ifdef DEBUG_PUSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif + m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); +#endif m++; @@ -486,10 +476,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } } } - } NR_UL_UE_HARQ_t *harq_process_ulsch=NULL; - harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]; + harq_process_ulsch = UE->ulsch[thread_id][gNB_id]->harq_processes[harq_pid]; harq_process_ulsch->status = SCH_IDLE; /////////// diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 6b18e55c4bc433933933adb87c4f11fb4f197916..0b20aa409ba69edc3f49b734f91248dc73c43e44 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -458,8 +458,6 @@ typedef struct RU_t_s { int emulate_rf; /// numerology index int numerology; - /// flag to indicate basicsim operation - int basicsim; /// flag to indicate the RU is in sync with a master reference int in_synch; /// timing offset diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 179f31c55ae3c78a8902d08fb6794ae4d7035be2..75aa328c8a985aa9d0b7cf08218aa470d7ac7b2d 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -89,7 +89,7 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t **c; /// Frame where current HARQ round was sent uint32_t frame; /// Subframe where current HARQ round was sent @@ -157,13 +157,11 @@ typedef struct { /// Pointers to variables related to DLSCH harq process NR_DL_gNB_HARQ_t harq_process; /// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding) - int32_t *txdataF[NR_MAX_NB_LAYERS]; - /// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding) - int32_t *txdataF_precoding[NR_MAX_NB_LAYERS]; + int32_t **txdataF; /// Modulated symbols buffer - int32_t *mod_symbs[NR_MAX_NB_CODEWORDS]; + int32_t **mod_symbs; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? - int32_t **ue_spec_bf_weights[NR_MAX_NB_LAYERS]; + int32_t ***ue_spec_bf_weights; /// dl channel estimates (estimated from ul channel estimates) int32_t **calib_dl_ch_estimates; /// Allocated RNTI (0 means DLSCH_t is not currently used) @@ -287,7 +285,7 @@ typedef struct { /// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1) uint32_t Z; /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) - int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; + int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448]; /// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) uint32_t E; /// Number of segments processed so far @@ -771,7 +769,7 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams - NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords] + NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times] NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p; NR_gNB_DLSCH_t *dlsch_PCH; /// statistics for DLSCH measurement collection diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 00a7f5a29493cc3bd77ca64fac36a282e5e1ff5f..6cdcfa2b2608f18f9916e2567f213e17b2071f11 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -225,11 +225,6 @@ typedef struct { } NR_UE_COMMON_PER_THREAD; -typedef struct { - /// TX buffers for multiple layers - int32_t *txdataF_layers[NR_MAX_NB_LAYERS]; - } NR_UE_PUSCH; - typedef struct { bool active[2]; fapi_nr_ul_config_pucch_pdu pucch_pdu[2]; @@ -797,10 +792,9 @@ typedef struct { NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PUCCH *pucch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads - NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words + NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_LAYERS>4 ? 2:1]; // two RxTx Threads + NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; @@ -844,7 +838,7 @@ typedef struct { uint16_t scramblingID_pdcch; /// PUSCH DMRS sequence - uint32_t ****nr_gold_pusch_dmrs; + uint32_t ***nr_gold_pusch_dmrs; uint32_t X_u[64][839]; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index cfe5e8b9df27cf12c9b0d6c23e580f5f1afb3dc8..87eed8c4fcfbf15466dbd00db14bb4812912ea35 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -44,8 +44,6 @@ #define MAX_NUM_SUBCARRIER_SPACING 5 -#define NR_MAX_NB_RB 275 - #define NR_NB_SC_PER_RB 12 #define NR_NB_REG_PER_CCE 6 @@ -67,22 +65,9 @@ #define NR_PBCH_DMRS_LENGTH 144 // in mod symbols #define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32) -/*These max values are for the gold sequences which are generated at init for the - * full carrier bandwidth*/ -#define NR_MAX_PDCCH_DMRS_INIT_LENGTH ((NR_MAX_NB_RB<<1)*3) // 3 symbols *2(QPSK) -#define NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD 52 // ceil(NR_MAX_PDCCH_DMRS_LENGTH/32) /*used for the resource mapping*/ #define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE) -#define NR_MAX_PDSCH_DMRS_LENGTH 3300 //275*6(k)*2(QPSK real+imag) -#define NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD 104 // ceil(NR_MAX_PDSCH_DMRS_LENGTH/32) - -#define NR_MAX_CSI_RS_LENGTH 4400 //275*8(max allocation per RB)*2(QPSK) -#define NR_MAX_CSI_RS_INIT_LENGTH_DWORD 138 // ceil(NR_MAX_CSI_RS_LENGTH/32) - -#define NR_MAX_PUSCH_DMRS_LENGTH NR_MAX_PDSCH_DMRS_LENGTH -#define NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD - #define NR_MAX_DCI_PAYLOAD_SIZE 64 #define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE) #define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32) @@ -93,25 +78,20 @@ #define NR_MAX_CSET_DURATION 3 #define NR_MAX_NB_RBG 18 -#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3) +#define NR_MAX_NB_LAYERS 4 // 8 #define NR_MAX_NB_PORTS 32 -#define NR_MAX_NB_CODEWORDS 2 #define NR_MAX_NB_HARQ_PROCESSES 16 -#define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!) -#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH + #define NR_MAX_PDSCH_TBS 3824 #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. -#define MAX_NUM_NR_DLSCH_SEGMENTS (NR_MAX_NB_LAYERS*34) -#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) +#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 34 #define MAX_NUM_NR_ULSCH_SEGMENTS 34 #define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056) #define MAX_NUM_NR_SRS_SYMBOLS 4 -#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB -#define MAX_NUM_NR_RE (14*273*12) #define NR_RX_NB_TH 1 #define NR_NB_TH_SLOT 2 @@ -254,7 +234,7 @@ typedef struct { typedef struct { uint16_t sc_list_length; - uint16_t sc_list[6 * NR_MAX_NB_RB]; + uint16_t *sc_list; uint8_t srs_generated_signal_bits; int32_t *srs_generated_signal; int32_t **srs_received_signal; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index ee1e0be49af41369d6a57fa79a29b14e99c63ca5..1a35f6ee683753181b82db2c3ce4951eafb1b194 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1938,6 +1938,8 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har pthread_mutex_unlock(&eNB->UL_INFO_mutex); } +#define packetError(ConD, fmt, args...) if (!(ConD)) { LOG_E(PHY, fmt, args); goodPacket=false; } + void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask) { if ( split73 == SPLIT73_DU ) { sendFs6Ulharq(fs6ULindicationHarq, UEid, eNB, uci, frame, subframe, harq_ack, tdd_mapping_mode, tdd_multiplexing_mask, 0, 0); @@ -1953,6 +1955,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in } pthread_mutex_lock(&eNB->UL_INFO_mutex); + bool goodPacket=true; nfapi_harq_indication_t *ind = &eNB->UL_INFO.harq_ind; nfapi_harq_indication_body_t *body = &ind->harq_indication_body; assert(eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU); @@ -1985,73 +1988,87 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = 1; - AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]); - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; - // release DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; + // release DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2; - AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n", harq_ack[0]); - AssertFatal (harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n", harq_ack[1]); - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; - pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; - // release DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); - } else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); + packetError (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n", harq_ack[0]); + packetError (harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n", harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; + pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; + // release DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } + } else + packetError(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); } else { // TDD - AssertFatal (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode); - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode; - LOG_D(PHY,"%s(eNB, uci_harq format %d, rnti:%04x, frame:%d, subframe:%d, tdd_mapping_mode:%d) harq_ack[0]:%d harq_ack[1]:%d\n", __FUNCTION__, uci->pucch_fmt,uci->rnti, frame, subframe, - tdd_mapping_mode,harq_ack[0],harq_ack[1]); - - switch (tdd_mapping_mode) { + packetError (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode; + LOG_D(PHY,"%s(eNB, uci_harq format %d, rnti:%04x, frame:%d, subframe:%d, tdd_mapping_mode:%d) harq_ack[0]:%d harq_ack[1]:%d\n", __FUNCTION__, uci->pucch_fmt,uci->rnti, frame, subframe, + tdd_mapping_mode,harq_ack[0],harq_ack[1]); + + switch (tdd_mapping_mode) { case 0: // bundling if (uci->pucch_fmt == pucch_format1a) { pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; LOG_D(PHY,"bundling, pucch1a, number of ack nack %d\n",pdu->harq_indication_tdd_rel13.number_of_ack_nack); - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); - pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; - // release all bundled DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; + // release all bundled DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); - AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; - pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); + packetError(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; + pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } } break; case 1: // multiplexing - AssertFatal (uci->pucch_fmt == pucch_format1b, "uci->pucch_format %d is not format1b\n", uci->pucch_fmt); - - if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1a) { - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); - pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError (uci->pucch_fmt == pucch_format1b, "uci->pucch_format %d is not format1b\n", uci->pucch_fmt); + if (goodPacket) { + if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1a) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) { - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); - AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); - pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; - pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); + packetError(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; + pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } } else { // num_pucch_resources (M) > 1 pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = uci->num_pucch_resources; @@ -2067,7 +2084,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in release_harq(eNB,DLSCH_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); } - break; + break; case 2: // special bundling (SR collision) pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; @@ -2117,16 +2134,23 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in } else { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0; } - + break; } break; + } + } } } //TDD - - eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++; - LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs); + + if (goodPacket) { + eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++; + LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs); + } else { + LOG_W(PHY,"discarded a PUCCH because the decoded values are impossible\n"); + } + pthread_mutex_unlock(&eNB->UL_INFO_mutex); } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 78c80ff101ad614bd35bf3ac90cff56c14538a2c..9582b66e5999093ec8fe436333587b9af9597e34 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -198,7 +198,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; NR_gNB_ULSCH_t *ulsch = rdata->ulsch; int r = rdata->segment_r; - nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id][0]->harq_processes[rdata->harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id]->harq_processes[rdata->harq_pid]->ulsch_pdu; bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter); ulsch_harq->processedSegments++; @@ -303,7 +303,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid) { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->ulsch_pdu; uint8_t l, number_dmrs_symbols = 0; uint32_t G; @@ -379,13 +379,13 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, pthread_mutex_lock(&gNB->UL_INFO_mutex); - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch); nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu; - // pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b; + // pdu->data = gNB->ulsch[ULSCH_id+1]->harq_processes[harq_pid]->b; int sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size @@ -548,7 +548,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) { - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; int harq_pid; NR_UL_gNB_HARQ_t *ulsch_harq; if ((ulsch) && @@ -708,7 +708,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) { - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; int harq_pid; int no_sig; NR_UL_gNB_HARQ_t *ulsch_harq; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 7430e5ecf981ebb21b19e9be191312f1f098420d..9af508b0e4180dbdc6625f94bbb291fa595b3708 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -280,7 +280,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ thread_id = scheduled_response->thread_id; NR_UE_DLSCH_t *dlsch0 = NULL; NR_UE_PDCCH *pdcch_vars = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0]; - NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0]; + NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0]; NR_UE_PUCCH *pucch_vars = PHY_vars_UE_g[module_id][cc_id]->pucch_vars[thread_id][0]; NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0]; NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0]; @@ -375,8 +375,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // pusch config pdu pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; - NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch0->harq_processes[current_harq_pid]; - harq_process_ul_ue->status = 0; + NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch->harq_processes[current_harq_pid]; if (harq_process_ul_ue){ @@ -384,7 +383,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); - ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; + ulsch->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; if (scheduled_response->tx_request) { for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) { @@ -392,15 +391,16 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) { LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid); memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length); - harq_process_ul_ue->status = ACTIVE; - ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more - pdu_done++; - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); break; } } } + harq_process_ul_ue->status = ACTIVE; + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; + LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); + } else { LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 4d92509d48e4985d31793b1eaf392c4a056d5742..4afe5f41d3b50a9611c2ffb9246ba59a39377038 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -123,7 +123,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i memset(ulsch,0,sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id][code_word_idx] = ulsch; + ue->ulsch[thread_id][gNB_id] = ulsch; } else { LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); @@ -148,7 +148,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i } for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) { - ue->ulsch[thread_id][gNB_id][code_word_idx]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; + ue->ulsch[thread_id][gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; } } @@ -167,7 +167,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx) { - NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id][code_word_idx]; + NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id]; for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) { @@ -178,7 +178,7 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, free16(ulsch, sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id][code_word_idx] = NULL; + ue->ulsch[thread_id][gNB_id] = NULL; } /******************************************************************* diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index eb8e1f85ca72899961283d161112249c122e0158..c077440c7c9d96852fb4ce85698bf64b188d8a9f 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -289,8 +289,9 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, start_meas(&ue->phy_proc_tx); if (ue->UE_mode[gNB_id] <= PUSCH){ - for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id][0]->number_harq_processes_for_pusch; harq_pid++) { - if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE) + + for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id]->number_harq_processes_for_pusch; harq_pid++) { + if (ue->ulsch[proc->thread_id][gNB_id]->harq_processes[harq_pid]->status == ACTIVE) nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); } } @@ -1626,13 +1627,17 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_procedures_stat[proc->thread_id]); + NR_UE_DLSCH_t *dlsch1 = NULL; + if (NR_MAX_NB_LAYERS>4) + dlsch1 = ue->dlsch[proc->thread_id][gNB_id][1]; + if (ret_pdsch >= 0) nr_ue_dlsch_procedures(ue, proc, gNB_id, PDSCH, ue->dlsch[proc->thread_id][gNB_id][0], - ue->dlsch[proc->thread_id][gNB_id][1], + dlsch1, &ue->dlsch_errors[gNB_id]); stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]); diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 4635f2b7412eea602cbf2e1714131c5f5854c048..b02f24e04eafcd5e77e64fd3e38f1433dfc060cf 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -1150,20 +1150,14 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, nsymb = (frame_parms->Ncp == 0) ? 14 : 12; - if (!IS_SOFTMODEM_BASICSIM) { - ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- - ue->hw_timing_advance- - ue->timing_advance- - ue->N_TA_offset+5); - - if(ulsch_start < 0) - 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); - } else { //this is the simulators case - ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance; - } + ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti + - ue->hw_timing_advance - ue->timing_advance - ue->N_TA_offset + 5; + + if(ulsch_start < 0) + 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); if (empty_subframe) { overflow = ulsch_start - 9*frame_parms->samples_per_tti; @@ -1181,8 +1175,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, } for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { - int *Buff = IS_SOFTMODEM_BASICSIM ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer; - + int *Buff = dummy_tx_buffer; if (frame_parms->Ncp == 1) { PHY_ofdm_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], Buff, @@ -1202,41 +1195,33 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, &ue->frame_parms); } - if (IS_SOFTMODEM_BASICSIM) { - apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],0); - apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],1); - } else { - apply_7_5_kHz(ue,dummy_tx_buffer,0); - apply_7_5_kHz(ue,dummy_tx_buffer,1); - } + apply_7_5_kHz(ue,dummy_tx_buffer,0); + apply_7_5_kHz(ue,dummy_tx_buffer,1); - if (!(IS_SOFTMODEM_BASICSIM) ) { - overflow = ulsch_start - 9*frame_parms->samples_per_tti; + overflow = ulsch_start - 9*frame_parms->samples_per_tti; - for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_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]; - } + for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_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]; + } - for (k=0; k<overflow; 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]; - } + for (k=0; k<overflow; 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]; + } #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) ; k<ulsch_start ; k++) { - if (k<0) - 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; - else - ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; - } - -#endif + // 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) ; k<ulsch_start ; k++) { + if (k<0) + 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; + else + ue->common_vars.txdata[aa][k] &= 0xFFFEFFFE; } +#endif /* only for debug @@ -1314,14 +1299,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue, ue->prach_resources[eNB_id]->ra_RNTI); ue->tx_total_RE[subframe_tx] = 96; - if (IS_SOFTMODEM_BASICSIM) { - 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); - } else { - ue->prach_vars[eNB_id]->amp = AMP; - } + ue->prach_vars[eNB_id]->amp = AMP; 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", @@ -1688,14 +1666,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ue->tx_total_RE[subframe_tx] = nb_rb*12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], - ue->tx_power_max_dBm, - ue->frame_parms.N_RB_UL, - nb_rb); - } + tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 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)); @@ -1765,17 +1739,13 @@ void ue_srs_procedures(PHY_VARS_UE *ue, Po_SRS = ue->tx_power_max_dBm; } - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; + 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 { - 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; - } + tx_amp = AMP; } 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, @@ -2008,14 +1978,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - 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); 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))); @@ -2089,14 +2055,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM) { - tx_amp = AMP; - } else { - 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); 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))); @@ -2344,9 +2306,6 @@ void ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6 // AGC VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_IN); - if (IS_SOFTMODEM_BASICSIM) - phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); eNB_id = 0; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index f3aae9a3f7b452cbbd034e1d649e6680a875ce8e..d6812dd541164c3fd056b75bb28561ffba9488d4 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -395,19 +395,6 @@ int main(int argc, char **argv) load_pbch_desc(pbch_file_fd); } - /* for (int k=0; k<2; k++) { - // Create transport channel structures for 2 transport blocks (MIMO) - for (i=0; i<2; i++) { - gNB->dlsch[k][i] = new_gNB_dlsch(Kmimo,8,Nsoft,0,frame_parms,gNB_config); - - if (!gNB->dlsch[k][i]) { - printf("Can't get eNB dlsch structures\n"); - exit(-1); - } - gNB->dlsch[k][i]->Nsoft = 10; - gNB->dlsch[k][i]->rnti = n_rnti+k; - } - }*/ //configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS)); @@ -420,10 +407,10 @@ int main(int argc, char **argv) //nr_init_frame_parms_ue(&UE->frame_parms); //init_nr_ue_transport(UE, 0); + int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1; for (int sf = 0; sf < 2; sf++) { - for (i = 0; i < 2; i++) { + for (i = 0; i < num_codeword; i++) { UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL); - if (!UE->dlsch[sf][0][i]) { printf("Can't get ue dlsch structures\n"); exit(-1); @@ -434,8 +421,8 @@ int main(int argc, char **argv) } unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; - processingData_L1tx_t msgDataTx; - init_DLSCH_struct(gNB, &msgDataTx); + processingData_L1tx_t msgDataTx; + init_DLSCH_struct(gNB, &msgDataTx); NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0]; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; //time_stats_t *rm_stats, *te_stats, *i_stats; @@ -642,8 +629,9 @@ int main(int argc, char **argv) free(RC.gNB[0]); free(RC.gNB); + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int sf = 0; sf < 2; sf++) - for (int i = 0; i < 2; i++) + for (int i = 0; i < num_cw; i++) free_nr_ue_dlsch(&UE->dlsch[sf][0][i], N_RB_DL); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index e797c010963940b6c59bbd6457808bbcfca9d306..c3ff79ab071ec316797df97d6354ab7c73185f5c 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -656,7 +656,7 @@ int main(int argc, char **argv) printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("-h This message\n"); - printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n"); + printf("-L <log level, 0(errors), 1(warning), 2(analysis), 3(info), 4(debug), 5(trace)>\n"); //printf("-p Use extended prefix mode\n"); //printf("-d Use TDD\n"); printf("-n Number of frames to simulate\n"); @@ -1110,7 +1110,7 @@ int main(int argc, char **argv) pdsch_pdu_rel15->dlDmrsSymbPos); ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, pdsch_pdu_rel15->StartSymbolIndex, pdsch_pdu_rel15->NrOfSymbols); ptrsRePerSymb = ((rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity); - printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); + LOG_D(PHY,"[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); } msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; @@ -1267,7 +1267,7 @@ int main(int argc, char **argv) available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers); if(pdu_bit_map & 0x1) { available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); - printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); + LOG_D(PHY,"[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); } /* @@ -1324,7 +1324,8 @@ int main(int argc, char **argv) printf("*****************************************\n"); printf("\n"); dump_pdsch_stats(stdout,gNB); - printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); + printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", + SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); printf("\n"); if (print_perf==1) { diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6cdf0b90cd65b030b4519c75386669464495922c..f6227e17697d15e5ec761294b82039caf2bd0a93 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -407,15 +407,10 @@ int main(int argc, char **argv) } for (sf = 0; sf < 2; sf++) { - for (i = 0; i < 2; i++) { - - UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8); - - if (!UE->ulsch[sf][0][i]) { - printf("Can't get ue ulsch structures.\n"); - exit(-1); - } - + UE->ulsch[sf][0] = new_nr_ue_ulsch(N_RB_UL, 8); + if (!UE->ulsch[sf][0]) { + printf("Can't get ue ulsch structures.\n"); + exit(-1); } } @@ -431,11 +426,11 @@ int main(int argc, char **argv) uint8_t rvidx = 0; uint8_t UE_id = 0; - NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0]; + NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid]; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; mod_order = nr_get_Qm_ul(Imcs, 0); code_rate = nr_get_code_rate_ul(Imcs, 0); @@ -525,7 +520,7 @@ int main(int argc, char **argv) } */ - if (ulsch_ue->g[i] == 0) + if (ulsch_ue->harq_processes[harq_pid]->f[i] == 0) modulated_input[i] = 1.0; ///sqrt(2); //QPSK else modulated_input[i] = -1.0; ///sqrt(2); @@ -615,8 +610,7 @@ int main(int argc, char **argv) } for (sf = 0; sf < 2; sf++) - for (i = 0; i < 2; i++) - free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL); + free_nr_ue_ulsch(&UE->ulsch[sf][0], N_RB_UL); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 71c76625bd8565aa6ca1490c19086b01e668ddf1..7f090bf48f41a69f9e29982d53bd7295dba90629 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -804,7 +804,7 @@ int main(int argc, char **argv) unsigned char harq_pid = 0; - NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0]; + NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; //nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu; nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req)); NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); @@ -813,7 +813,7 @@ int main(int argc, char **argv) nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu; - NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; unsigned char *estimated_output_bit; unsigned char *test_input_bit; @@ -1044,8 +1044,8 @@ int main(int argc, char **argv) memset((void*)roundStats,0,50*sizeof(roundStats[0])); while (round<max_rounds && crc_status) { round_trials[round][snrRun]++; - ulsch_ue[0]->harq_processes[harq_pid]->round = round; - gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round; + ulsch_ue->harq_processes[harq_pid]->round = round; + gNB->ulsch[0]->harq_processes[harq_pid]->round = round; rv_index = nr_rv_round_map[round]; UE_proc.thread_id = 0; @@ -1186,7 +1186,7 @@ int main(int argc, char **argv) //nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);" - for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; + for (int i=0;i<(TBS/8);i++) ulsch_ue->harq_processes[harq_pid]->a[i]=i&0xff; if (input_fd == NULL) { // set FAPI parameters for UE, put them in the scheduled response and call @@ -1361,8 +1361,8 @@ int main(int argc, char **argv) } //////////////////////////////////////////////////////////// - if ((gNB->ulsch[0][0]->last_iteration_cnt >= - gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1) { + if ((gNB->ulsch[0]->last_iteration_cnt >= + gNB->ulsch[0]->max_ldpc_iterations+1) || ul_proc_error == 1) { error_flag = 1; n_errors[round][snrRun]++; crc_status = 1; @@ -1387,8 +1387,8 @@ int main(int argc, char **argv) for (i = 0; i < available_bits; i++) { - if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || - ((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) + if(((ulsch_ue->harq_processes[harq_pid]->f[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || + ((ulsch_ue->harq_processes[harq_pid]->f[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) { /*if(errors_scrambling == 0) printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/ @@ -1406,7 +1406,7 @@ int main(int argc, char **argv) for (i = 0; i < TBS; i++) { estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); - test_input_bit[i] = (ulsch_ue[0]->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); + test_input_bit[i] = (ulsch_ue->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); if (estimated_output_bit[i] != test_input_bit[i]) { /*if(errors_decoding == 0) @@ -1415,13 +1415,13 @@ int main(int argc, char **argv) } } if (n_trials == 1) { - for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++) - for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) { - if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); + for (int r=0;r<ulsch_ue->harq_processes[harq_pid]->C;r++) + for (int i=0;i<ulsch_ue->harq_processes[harq_pid]->K>>3;i++) { + if ((ulsch_ue->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); /*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, - i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i], + i,ulsch_ue->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], - ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ + ulsch_ue->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ } } if (errors_decoding > 0 && error_flag == 0) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9720183aba5b56d50b246ac9987e52876974f350..05748e5e964355313d8926a7ee067e51b1fc3b05 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -623,15 +623,18 @@ void RCconfig_NR_L1(void) { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl); - char *pt = strtok(ulprbbl,","); + char *save = NULL; + char *pt = strtok_r(ulprbbl, ",", &save); int prbbl[275]; int num_prbbl=0; memset(prbbl,0,275*sizeof(int)); while (pt) { - prbbl[atoi(pt)] = 1; + const int rb = atoi(pt); + AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb); + prbbl[rb] = 0x3FFF; // all symbols taken LOG_I(NR_PHY,"Blacklisting prb %d\n",atoi(pt)); - pt = strtok(NULL,","); + pt = strtok_r(NULL, ",", &save); num_prbbl++; } @@ -734,15 +737,16 @@ void RCconfig_nr_macrlc() { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; - char *pt = strtok(ulprbbl,","); - int prbbl[275]; + char *save = NULL; + char *pt = strtok_r(ulprbbl, ",", &save); + uint16_t prbbl[275]; int num_prbbl=0; - int prb; - memset(prbbl,0,275*sizeof(int)); + memset(prbbl,0,sizeof(prbbl)); while (pt) { - prb=atoi(pt); - prbbl[prb] = 1; - pt = strtok(NULL,","); + const int prb = atoi(pt); + AssertFatal(prb < 275, "RB %d out of bounds (max 275)\n", prb); + prbbl[prb] = 0x3FFF; // all symbols taken + pt = strtok_r(NULL, ",", &save); num_prbbl++; } paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; @@ -1452,7 +1456,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { // NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU); cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr); - address = strtok(cidr, "/"); + char *save = NULL; + address = strtok_r(cidr, "/", &save); NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0; NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1; @@ -1724,7 +1729,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { } cidr = *(NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr); - address = strtok(cidr, "/"); + char *save = NULL; + address = strtok_r(cidr, "/", &save); X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv6 = 0; X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv4 = 1; strcpy(X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv4_address, address); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 4024b94851f2f3e48edd428aad7d49b2a06785c9..347165ba0d98de155ea8c3a060999fecf906f710 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1120,7 +1120,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.number_of_pdus = 0; for (int j = 0; j < ul_config->number_pdus; j++) { - uint8_t *ulsch_input_buffer = &(ulsch_input_buffer_array[tx_req.number_of_pdus][MAX_ULSCH_PAYLOAD_BYTES]); + uint8_t *ulsch_input_buffer = ulsch_input_buffer_array[tx_req.number_of_pdus]; fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = &ul_config->ul_config_list[j]; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 0ced6725eaab064b7280a409f52cc559146a9894..80562317ed6078ec21f4748b86e893fddd84015a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -58,18 +58,42 @@ void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList * struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list, NR_UE_sched_ctrl_t *sched_ctrl) { - if (rlc_bearer2add_list) - // keep lcids - for (int i=0;i<rlc_bearer2add_list->list.count;i++) { - sched_ctrl->lcid_mask |= (1<<rlc_bearer2add_list->list.array[i]->logicalChannelIdentity); - LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity, - rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity); + if (rlc_bearer2release_list) { + for (int i = 0; i < rlc_bearer2release_list->list.count; i++) { + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) { + const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1; + memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs); + sched_ctrl->dl_lc_num--; + break; + } + } } - if (rlc_bearer2release_list) - for (int i=0;i<rlc_bearer2release_list->list.count;i++) - sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]); + } + + if (rlc_bearer2add_list) { + // keep lcids + for (int i = 0; i < rlc_bearer2add_list->list.count; i++) { + const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity; + bool found = false; + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == lcid) { + found = true; + break; + } + } + + if (!found) { + sched_ctrl->dl_lc_num++; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; + LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid); + } + } + } + + LOG_D(NR_MAC, "In %s: total num of active bearers %d) \n", + __FUNCTION__, + sched_ctrl->dl_lc_num); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 51541353f41377faeb9fa135428ce32f67443dca..540198a22a228f84e118dd8a1ac6391df7e10574 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -318,7 +318,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int last_slot = (slot + num_slots - 1) % num_slots; uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL; - memset(&vrb_map_UL[last_slot * MAX_BWP_SIZE], 0, sizeof(uint16_t) * MAX_BWP_SIZE); + memcpy(&vrb_map_UL[last_slot * MAX_BWP_SIZE], &RC.nrmac[module_idP]->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE); clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 318edf7efa5eb1ece0bc9c3d2733d7122930c39e..00155770113d373183d4de8a4ce696307083b49e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -389,7 +389,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP const int16_t N_RA_RB = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch); uint16_t *vrb_map_UL = &cc->vrb_map_UL[slotP * MAX_BWP_SIZE]; for (int i = 0; i < N_RA_RB * fdm; ++i) - vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = 0xff; // all symbols + vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = SL_to_bitmap(start_symbol, N_t_slot*N_dur); } } } @@ -772,6 +772,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t int scs = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; int fh = 0; int startSymbolAndLength = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; + int StartSymbolIndex, NrOfSymbols; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); int mappingtype = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType; uint16_t *vrb_map_UL = &RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; @@ -780,7 +782,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t int BWPSize = nr_mac->type0_PDCCH_CSS_config[ra->beam_id].num_rbs; int rbStart = 0; for (int i = 0; (i < ra->msg3_nb_rb) && (rbStart <= (BWPSize - ra->msg3_nb_rb)); i++) { - if (vrb_map_UL[rbStart + BWPStart + i]) { + if (vrb_map_UL[rbStart + BWPStart + i]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols)) { rbStart += i; i = 0; } @@ -898,7 +900,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t aggregation_level); for (int rb = 0; rb < ra->msg3_nb_rb; rb++) { - vrb_map_UL[rbStart + BWPStart + rb] = 1; + vrb_map_UL[rbStart + BWPStart + rb] |= SL_to_bitmap(StartSymbolIndex, NrOfSymbols); } // reset state to wait msg3 @@ -928,6 +930,9 @@ void nr_get_Msg3alloc(module_id_t module_id, int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + int StartSymbolIndex = 0; + int NrOfSymbols = 0; + int startSymbolAndLength = 0; int temp_slot = 0; ra->Msg3_tda_id = 16; // initialization to a value above limit @@ -942,6 +947,8 @@ void nr_get_Msg3alloc(module_id_t module_id, int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); int nb_slots_per_period = ((1<<mu)*10)/nb_periods_per_frame; for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) { + startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2; // we want to transmit in the uplink symbols of mixed slot if ((k2 + DELTA[mu])%nb_slots_per_period == 0) { @@ -949,6 +956,8 @@ void nr_get_Msg3alloc(module_id_t module_id, ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot)) { ra->Msg3_tda_id = i; + ra->msg3_startsymb = StartSymbolIndex; + ra->msg3_nrsymb = NrOfSymbols; break; } } @@ -1002,11 +1011,12 @@ void nr_get_Msg3alloc(module_id_t module_id, while (rbSize < msg3_nb_rb) { rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbSize = 0; - while (rbStart < bwpSize && vrb_map_UL[rbStart + bwpStart]) + while (rbStart < bwpSize && + (vrb_map_UL[rbStart + bwpStart]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols))) rbStart++; AssertFatal(rbStart < bwpSize - msg3_nb_rb, "no space to allocate Msg 3 for RA!\n"); while (rbStart + rbSize < bwpSize - && !vrb_map_UL[rbStart + bwpStart + rbSize] + && !(vrb_map_UL[rbStart + bwpStart + rbSize]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols)) && rbSize < msg3_nb_rb) rbSize++; } @@ -1113,7 +1123,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t i + ra->msg3_first_rb, ra->Msg3_frame, ra->Msg3_slot); - vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] = 1; + vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] |= SL_to_bitmap(ra->msg3_startsymb, ra->msg3_nrsymb); } LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 7d16a4ee01d295ff28a34adae41210b001c02456..cddeb364d519e666cd9e9bbd3c72de38d224e2ef 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -640,7 +640,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; // Data to be transmitted - bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + bzero(tx_req->TLVs[0].value.direct,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*1056); memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); tx_req->PDU_length = TBS; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 4ef05d660d815047fae4c2e01a1fab3f998211df..e50c27083623c3057a9e0d83d199ea869519f44b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -471,76 +471,49 @@ void nr_store_dlsch_buffer(module_id_t module_id, NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_pdus_total = 0; - int lcid; - const uint16_t rnti = UE_info->rnti[UE_id]; - LOG_D(NR_MAC,"UE %d/%x : lcid_mask %x\n",UE_id,rnti,sched_ctrl->lcid_mask); - if ((sched_ctrl->lcid_mask&(1<<2)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1] = mac_rlc_status_ind(module_id, + /* loop over all activated logical channels */ + // Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { + + const int lcid = sched_ctrl->dl_lc_ids[i]; + const uint16_t rnti = UE_info->rnti[UE_id]; + LOG_D(NR_MAC, "In %s: UE %d/%x: LCID %d\n", __FUNCTION__, UE_id, rnti, lcid); + start_meas(&RC.nrmac[module_id]->rlc_status_ind); + sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, rnti, module_id, frame, slot, ENB_FLAG_YES, MBMS_FLAG_NO, - DL_SCH_LCID_DCCH1, + lcid, 0, 0); - if ((sched_ctrl->lcid_mask&(1<<1)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DCCH, - 0, - 0); - if ((sched_ctrl->lcid_mask&(1<<4)) > 0) { - start_meas(&RC.nrmac[module_id]->rlc_status_ind); - sched_ctrl->rlc_status[DL_SCH_LCID_DTCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DTCH, - 0, - 0); - stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - } - if(sched_ctrl->rlc_status[DL_SCH_LCID_DCCH].bytes_in_buffer > 0){ - lcid = DL_SCH_LCID_DCCH; - } - else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) - { - lcid = DL_SCH_LCID_DCCH1; - }else{ - lcid = DL_SCH_LCID_DTCH; - } - - sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - //later multiplex here. Just select DCCH/SRB before DTCH/DRB - sched_ctrl->lcid_to_schedule = lcid; + stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - if (sched_ctrl->num_total_bytes == 0 - && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */ - continue; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; - LOG_D(NR_MAC, - "[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n", - __func__, - frame, - slot, - lcid<4?"DCCH":"DTCH", - lcid, - sched_ctrl->rlc_status[lcid].bytes_in_buffer, - sched_ctrl->ta_apply); + sched_ctrl->dl_pdus_total += sched_ctrl->rlc_status[lcid].pdus_in_buffer; + sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; + LOG_D(MAC, + "[gNB %d][%4d.%2d] %s%d->DLSCH, RLC status for UE %d: %d bytes in buffer, total DL buffer size = %d bytes, %d total PDU bytes, %s TA command\n", + module_id, + frame, + slot, + lcid < 4 ? "DCCH":"DTCH", + lcid, + UE_id, + sched_ctrl->rlc_status[lcid].bytes_in_buffer, + sched_ctrl->num_total_bytes, + sched_ctrl->dl_pdus_total, + sched_ctrl->ta_apply ? "send":"do not send"); + } } } @@ -690,7 +663,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* retransmissions: directly allocate */ *n_rb_sched -= sched_ctrl->sched_pdsch.rbSize; for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] -= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); return true; } @@ -861,6 +834,10 @@ void pf_dl(module_id_t module_id, CCEIndex, sched_ctrl->aggregation_level); + /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ + max_num_ue--; + if (max_num_ue < 0) return; + /* MCS has been set above */ const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; @@ -889,7 +866,12 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + // Fix me: currently, the RLC does not give us the total number of PDUs + // awaiting. Therefore, for the time being, we put a fixed overhead of 12 + // (for 4 PDUs) and optionally + 2 for TA. Once RLC gives the number of + // PDUs, we replace with 3 * numPDUs + const int oh = 3 * 4 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + //const int oh = 3 * sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfLayers, @@ -907,7 +889,7 @@ void pf_dl(module_id_t module_id, /* transmissions: directly allocate */ n_rb_sched -= sched_pdsch->rbSize; for (int rb = 0; rb < sched_pdsch->rbSize; rb++) - rballoc_mask[rb + sched_pdsch->rbStart] -= slbitmap; + rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap; } } @@ -1333,68 +1315,72 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += written; int size = TBS - written; DevAssert(size >= 0); - /* next, get RLC data */ - // const int lcid = DL_SCH_LCID_DTCH; - const int lcid = sched_ctrl->lcid_to_schedule; - int dlsch_total_bytes = 0; start_meas(&gNB_mac->rlc_data_req); if (sched_ctrl->num_total_bytes > 0) { - tbs_size_t len = 0; - while (size > 3) { - // we do not know how much data we will get from RLC, i.e., whether it - // will be longer than 256B or not. Therefore, reserve space for long header, then - // fetch data, then fill real length - NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; - - /* limit requested number of bytes to what preprocessor specified, or - * such that TBS is full */ - const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); - - len = mac_rlc_data_req(module_id, - rnti, - module_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - ndata, - (char *)buf, - 0, - 0); - - LOG_D(NR_MAC, - "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", - frame, - slot, - rnti, - len, - lcid < 4 ? "DCCH" : "DTCH", - lcid, - ndata, - size); - if (len == 0) - break; - - header->R = 0; - header->F = 1; - header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; - size -= len; - buf += len; - dlsch_total_bytes += len; - } - if (len == 0) { - /* RLC did not have data anymore, mark buffer as unused */ - buf -= 3; - size += 3; + + /* loop over all activated logical channels */ + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { + + const int lcid = sched_ctrl->dl_lc_ids[i]; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; // no data for this LC + + int dlsch_total_bytes = 0; + while (size > 3) { + // we do not know how much data we will get from RLC, i.e., whether it + // will be longer than 256B or not. Therefore, reserve space for long header, then + // fetch data, then fill real length + NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; + buf += 3; + size -= 3; + + /* limit requested number of bytes to what preprocessor specified, or + * such that TBS is full */ + const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); + tbs_size_t len = mac_rlc_data_req(module_id, + rnti, + module_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + ndata, + (char *)buf, + 0, + 0); + + LOG_D(NR_MAC, + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", + frame, + slot, + rnti, + len, + lcid < 4 ? "DCCH" : "DTCH", + lcid, + ndata, + size); + if (len == 0) { + /* RLC did not have data anymore, mark buffer as unused */ + buf -= 3; + size += 3; + break; + } + + header->R = 0; + header->F = 1; + header->LCID = lcid; + header->L1 = (len >> 8) & 0xff; + header->L2 = len & 0xff; + size -= len; + buf += len; + dlsch_total_bytes += len; + } + + UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; } - } - else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { + } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) { /* we will need the large header, phy-test typically allocates all * resources and fills to the last byte below */ NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; @@ -1412,7 +1398,6 @@ void nr_schedule_ue_spec(module_id_t module_id, header->L2 = size & 0xff; size -= size; buf += size; - dlsch_total_bytes += size; } stop_meas(&gNB_mac->rlc_data_req); @@ -1432,7 +1417,6 @@ void nr_schedule_ue_spec(module_id_t module_id, UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; - UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; /* save retransmission information */ harq->sched_pdsch = *sched_pdsch; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 9a08d883e22bbe61218a846af2d50242a6629406..7a47f47076b27b4ac9c5f3ee8d304e585c7b27e8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -55,8 +55,6 @@ extern RAN_CONTEXT_t RC; //#define ENABLE_MAC_PAYLOAD_DEBUG 1 -//uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES]; - /*Scheduling of DLSCH with associated DCI in common search space * current version has only a DCI for type 1 PDCCH for C_RNTI*/ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, @@ -315,7 +313,9 @@ void nr_preprocessor_phytest(module_id_t module_id, } sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_lc_num = 1; const int lcid = DL_SCH_LCID_DTCH; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; const uint16_t rnti = UE_info->rnti[UE_id]; /* update sched_ctrl->num_total_bytes so that postprocessor schedules data, * if available */ @@ -330,7 +330,6 @@ void nr_preprocessor_phytest(module_id_t module_id, 0, 0); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - sched_ctrl->lcid_to_schedule = lcid; uint8_t nr_of_candidates; for (int i=0; i<5; i++) { @@ -482,9 +481,8 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; - const uint16_t symb = ((1 << ps->nrOfSymbols) - 1) << ps->startSymbolIndex; for (int i = rbStart; i < rbStart + rbSize; ++i) { - if ((vrb_map_UL[i+BWPStart] & symb) != 0) { + if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) != 0) { LOG_E(MAC, "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", __func__, @@ -562,6 +560,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ sched_ctrl->aggregation_level); for (int rb = rbStart; rb < rbStart + rbSize; rb++) - vrb_map_UL[rb+BWPStart] = 1; + vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f00c2ed45873611ae52ad2624cea81f92daa3bb3..869ac215a66fbbce239ec7105f46be51f6416b45 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1226,23 +1226,26 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, else { // this is the default PUCCH configuration, PUCCH format 0 or 1 LOG_D(NR_MAC,"pucch_acknak: Filling default PUCCH configuration from Tables (r_pucch %d, bwp %p)\n",r_pucch,bwp); int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; - int prboffset = r_pucch/default_pucch_csset[rsetindex]; - int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex]; - pucch_pdu->prb_start = (r_pucch>>3)==0 ? - default_pucch_prboffset[rsetindex] + prboffset: - pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8; + int prb_start, second_hop_prb, nr_of_symb, start_symb; + set_r_pucch_parms(rsetindex, + r_pucch, + pucch_pdu->bwp_size, + &prb_start, + &second_hop_prb, + &nr_of_symb, + &start_symb); + + pucch_pdu->prb_start = prb_start; pucch_pdu->rnti = rnti; pucch_pdu->freq_hop_flag = 1; - pucch_pdu->second_hop_prb = (r_pucch>>3)==0? - pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset: - default_pucch_prboffset[rsetindex] + prboffsetm8; + pucch_pdu->second_hop_prb = second_hop_prb; pucch_pdu->format_type = default_pucch_fmt[rsetindex]; pucch_pdu->initial_cyclic_shift = r_pucch%default_pucch_csset[rsetindex]; if (rsetindex==3||rsetindex==7||rsetindex==11) pucch_pdu->initial_cyclic_shift*=6; else if (rsetindex==1||rsetindex==2) pucch_pdu->initial_cyclic_shift*=3; else pucch_pdu->initial_cyclic_shift*=4; - pucch_pdu->nr_of_symbols = default_pucch_numbsymb[rsetindex]; - pucch_pdu->start_symbol_index = default_pucch_firstsymb[rsetindex]; + pucch_pdu->nr_of_symbols = nr_of_symb; + pucch_pdu->start_symbol_index = start_symb; if (pucch_pdu->format_type == 1) pucch_pdu->time_domain_occ_idx = 0; // check this!! pucch_pdu->sr_flag = O_sr; pucch_pdu->prb_size=1; @@ -1250,6 +1253,32 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } +void set_r_pucch_parms(int rsetindex, + int r_pucch, + int bwp_size, + int *prb_start, + int *second_hop_prb, + int *nr_of_symbols, + int *start_symbol_index) { + + // procedure described in 38.213 section 9.2.1 + + int prboffset = r_pucch/default_pucch_csset[rsetindex]; + int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex]; + + *prb_start = (r_pucch>>3)==0 ? + default_pucch_prboffset[rsetindex] + prboffset: + bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8; + + *second_hop_prb = (r_pucch>>3)==0? + bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset: + default_pucch_prboffset[rsetindex] + prboffsetm8; + + *nr_of_symbols = default_pucch_numbsymb[rsetindex]; + *start_symbol_index = default_pucch_firstsymb[rsetindex]; +} + + void prepare_dci(const NR_CellGroupConfig_t *CellGroup, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format, @@ -2176,10 +2205,6 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); sched_ctrl->set_mcs = true; - sched_ctrl->lcid_mask = 0; - if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { - sched_ctrl->lcid_mask = 1<<DL_SCH_LCID_DTCH; - } sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5df7f73505c0e406f3646b827af2cd3503abdb21..592634c1b284e1b2b23732285db4bb8b77451f80 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -769,16 +769,16 @@ void nr_csi_meas_reporting(int Mod_idP, switch(pucchres->format.present){ case NR_PUCCH_Resource__format_PR_format2: len = pucchres->format.choice.format2->nrofPRBs; - mask = ((1 << pucchres->format.choice.format2->nrofSymbols) - 1) << pucchres->format.choice.format2->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format2->startingSymbolIndex, pucchres->format.choice.format2->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI; break; case NR_PUCCH_Resource__format_PR_format3: len = pucchres->format.choice.format3->nrofPRBs; - mask = ((1 << pucchres->format.choice.format3->nrofSymbols) - 1) << pucchres->format.choice.format3->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format3->startingSymbolIndex, pucchres->format.choice.format3->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI; break; case NR_PUCCH_Resource__format_PR_format4: - mask = ((1 << pucchres->format.choice.format4->nrofSymbols) - 1) << pucchres->format.choice.format4->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format4->startingSymbolIndex, pucchres->format.choice.format4->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI; break; default: @@ -786,7 +786,12 @@ void nr_csi_meas_reporting(int Mod_idP, } // verify resources are free for (int i = start; i < start + len; ++i) { - vrb_map_UL[i+bwp_start] |= mask; + if((vrb_map_UL[i+bwp_start] & mask) != 0) { + LOG_E(NR_MAC, "%4d.%2d VRB MAP in %4d.%2d not free. Can't schedule CSI reporting on PUCCH.\n", frame, slot, frame, sched_slot); + memset(curr_pucch, 0, sizeof(*curr_pucch)); + } + else + vrb_map_UL[i+bwp_start] |= mask; } } } @@ -1525,6 +1530,61 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } } +bool test_acknack_vrb_occupation(NR_UE_sched_ctrl_t *sched_ctrl, + NR_sched_pucch_t *pucch, + uint16_t *vrb_map_UL, + const NR_ServingCellConfigCommon_t *scc, + NR_PUCCH_Config_t *pucch_Config, + int r_pucch, + int bwp_start, + int bwp_size) { + + // We assume initial cyclic shift is always 0 so different pucch resources can't overlap + + NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[1]; + if (csi_pucch && + csi_pucch->csi_bits > 0 && + csi_pucch->frame == pucch->frame && + csi_pucch->ul_slot == pucch->ul_slot && + csi_pucch->simultaneous_harqcsi && + (csi_pucch->csi_bits + csi_pucch->dai_c) < 11) + return true; // available resources for csi_pucch already verified + + if(r_pucch<0){ + const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[0]; + DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); + pucch->second_hop_prb = resource->secondHopPRB!= NULL ? *resource->secondHopPRB : 0; + pucch->nr_of_symb = resource->format.choice.format0->nrofSymbols; + pucch->start_symb = resource->format.choice.format0->startingSymbolIndex; + pucch->prb_start = resource->startingPRB; + } + else{ + int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; + set_r_pucch_parms(rsetindex, + r_pucch, + bwp_size, + &pucch->prb_start, + &pucch->second_hop_prb, + &pucch->nr_of_symb, + &pucch->start_symb); + } + + // verifying occupation of PRBs for ACK/NACK on dedicated pucch + for (int l=0; l<pucch->nr_of_symb; l++) { + uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1); + int prb; + if (l==1 && pucch->second_hop_prb != 0) + prb = pucch->second_hop_prb; + else + prb = pucch->prb_start; + if ((vrb_map_UL[bwp_start+prb] & symb) != 0) { + return false; + break; + } + } + return true; +} + // this function returns an index to NR_sched_pucch structure // currently this structure contains PUCCH0 at index 0 and PUCCH2 at index 1 @@ -1564,6 +1624,24 @@ int nr_acknack_scheduling(int mod_id, * later) * * each UE has dedicated PUCCH Format 0 resources, and we use index 0! */ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; + NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]; + + NR_PUCCH_Config_t *pucch_Config = NULL; + if (sched_ctrl->active_ubwp) { + pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + } else if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { + pucch_Config = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + } + NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? + &sched_ctrl->active_ubwp->bwp_Common->genericParameters: + &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + int bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; LOG_D(NR_MAC, "In %s: %d.%d Trying to allocate pucch, current DAI %d\n", __FUNCTION__, frame, slot, pucch->dai_c); @@ -1609,7 +1687,6 @@ int nr_acknack_scheduling(int mod_id, LOG_D(NR_MAC, "In %s: pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n", __FUNCTION__, frame, slot, pucch->frame, pucch->ul_slot, pucch->dai_c); // this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP - NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]; NR_BWP_UplinkDedicated_t *ubwpd=NULL; if (cg && @@ -1683,23 +1760,36 @@ int nr_acknack_scheduling(int mod_id, // Find the right timing_indicator value. int ind_found = -1; // while we are within the feedback limits + uint16_t *vrb_map_UL; while ((n_slots_frame + pucch->ul_slot - slot) % n_slots_frame <= max_fb_time) { - int i = 0; - while (i < 8) { - LOG_D(NR_MAC, "In %s: pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", __FUNCTION__, - i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); - int diff = pucch->ul_slot - slot; - if (diff<0) - diff += n_slots_frame; - if (pdsch_to_harq_feedback[i] == diff && - pdsch_to_harq_feedback[i] >= minfbtime) { - ind_found = i; - break; + // checking if in ul_slot the resources potentially to be assigned to this PUCCH are available + vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + bool ret = test_acknack_vrb_occupation(sched_ctrl, + pucch, + vrb_map_UL, + scc, + pucch_Config, + r_pucch, + bwp_start, + bwp_size); + if (ret) { + int i = 0; + while (i < 8) { + LOG_D(NR_MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", + i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); + int diff = pucch->ul_slot - slot; + if (diff<0) + diff += n_slots_frame; + if (pdsch_to_harq_feedback[i] == diff && + pdsch_to_harq_feedback[i] >= minfbtime) { + ind_found = i; + break; + } + ++i; } - ++i; + if (ind_found!=-1) + break; } - if (ind_found!=-1) - break; // advance to the next ul slot const int f = pucch->frame; const int s = pucch->ul_slot; @@ -1760,46 +1850,16 @@ int nr_acknack_scheduling(int mod_id, pucch->dai_c++; pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources pucch->r_pucch=r_pucch; - NR_PUCCH_Config_t *pucch_Config = NULL; - if (sched_ctrl->active_ubwp) { - pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; - } else if (RC.nrmac[mod_id]->UE_info.CellGroup[UE_id] && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } - - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? - &sched_ctrl->active_ubwp->bwp_Common->genericParameters: - &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); - - /* verify that at that slot and symbol, resources are free. We only do this - * for initialCyclicShift 0 (we assume it always has that one), so other - * initialCyclicShifts can overlap with ICS 0!*/ - if (pucch_Config) { - const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; - DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); - int second_hop_prb = resource->secondHopPRB!= NULL ? *resource->secondHopPRB : 0; - int nr_of_symbols = resource->format.choice.format0->nrofSymbols; - if (resource->format.choice.format0->initialCyclicShift == 0) { - uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; - for (int l=0; l<nr_of_symbols; l++) { - uint16_t symb = 1 << (resource->format.choice.format0->startingSymbolIndex + l); - int prb; - if (l==1 && second_hop_prb != 0) - prb = second_hop_prb; - else - prb = resource->startingPRB; - if ((vrb_map_UL[bwp_start+prb] & symb) != 0) - LOG_W(MAC, "symbol 0x%x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d.%d\n", symb, resource->startingPRB, pucch->frame, pucch->ul_slot); - vrb_map_UL[bwp_start+prb] |= symb; - } - } + vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + for (int l=0; l<pucch->nr_of_symb; l++) { + uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1); + int prb; + if (l==1 && pucch->second_hop_prb != 0) + prb = pucch->second_hop_prb; + else + prb = pucch->prb_start; + vrb_map_UL[bwp_start+prb] |= symb; } return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 7667ff42e88a1eac5c70cd0b758953dfb7a0b6a2..e070118be78ea1c8a910e7aacaf78fc41fe545ee 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -818,6 +818,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); UE_info->active[UE_id] = true; + process_CellGroup(ra->CellGroup, UE_scheduling_control); + } else { LOG_A(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP); @@ -956,7 +958,7 @@ int next_list_entry_looped(NR_list_t *list, int UE_id) bool allocate_ul_retransmission(module_id_t module_id, frame_t frame, sub_frame_t slot, - uint8_t *rballoc_mask, + uint16_t *rballoc_mask, int *n_rb_sched, int UE_id, int harq_pid) @@ -977,13 +979,6 @@ bool allocate_ul_retransmission(module_id_t module_id, LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda); LOG_D(NR_MAC,"num_dmrs_cdm_grps_no_data %d, tbs %d\n",num_dmrs_cdm_grps_no_data, retInfo->tb_size); if (tda == retInfo->time_domain_allocation) { - /* Check the resource is enough for retransmission */ - while (rbStart < bwpSize && !rballoc_mask[rbStart]) - rbStart++; - if (rbStart + retInfo->rbSize > bwpSize) { - LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); - return false; - } /* check whether we need to switch the TDA allocation since tha last * (re-)transmission */ NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; @@ -997,18 +992,29 @@ bool allocate_ul_retransmission(module_id_t module_id, nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); sched_ctrl->update_pusch_ps = false; } + + /* Check the resource is enough for retransmission */ + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + if (rbStart + retInfo->rbSize > bwpSize) { + LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); + return false; + } LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { + NR_pusch_semi_static_t temp_ps; + int dci_format = get_dci_format(sched_ctrl); + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); /* the retransmission will use a different time domain allocation, check * that we have enough resources */ - while (rbStart < bwpSize && !rballoc_mask[rbStart]) + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbStart++; int rbSize = 0; - while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) + while (rbStart + rbSize < bwpSize && + (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbSize++; - NR_pusch_semi_static_t temp_ps; - int dci_format = get_dci_format(sched_ctrl); - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -1091,7 +1097,7 @@ bool allocate_ul_retransmission(module_id_t module_id, /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(sched_ctrl->pusch_semi_static.startSymbolIndex, sched_ctrl->pusch_semi_static.nrOfSymbols); return true; } @@ -1115,7 +1121,7 @@ void pf_ul(module_id_t module_id, NR_list_t *UE_list, int max_num_ue, int n_rb_sched, - uint8_t *rballoc_mask) { + uint16_t *rballoc_mask) { const int CC_id = 0; gNB_MAC_INST *nrmac = RC.nrmac[module_id]; @@ -1209,21 +1215,6 @@ void pf_ul(module_id_t module_id, if (max_num_ue < 0) return; - LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - if (rbStart + min_rb >= bwpSize) { - LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", - UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - return; - } - - sched_ctrl->cce_index = CCEIndex; - fill_pdcch_vrb_map(RC.nrmac[module_id], - CC_id, - &sched_ctrl->sched_pdcch, - CCEIndex, - sched_ctrl->aggregation_level); - /* Save PUSCH field */ /* we want to avoid a lengthy deduction of DMRS and other parameters in * every TTI if we can save it, so check whether dci_format, TDA, or @@ -1238,6 +1229,24 @@ void pf_ul(module_id_t module_id, nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); sched_ctrl->update_pusch_ps = false; } + + LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + if (rbStart + min_rb >= bwpSize) { + LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + return; + } + + sched_ctrl->cce_index = CCEIndex; + fill_pdcch_vrb_map(RC.nrmac[module_id], + CC_id, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = 9; update_ul_ue_R_Qm(sched_pusch, ps); @@ -1256,7 +1265,7 @@ void pf_ul(module_id_t module_id, /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); continue; } @@ -1331,19 +1340,6 @@ void pf_ul(module_id_t module_id, NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - sched_pusch->rbStart = rbStart; - uint16_t max_rbSize = 1; - while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) - max_rbSize++; - - if (rbStart + min_rb >= bwpSize) { - LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", - UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - return; - } - else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - /* Save PUSCH field */ /* we want to avoid a lengthy deduction of DMRS and other parameters in * every TTI if we can save it, so check whether dci_format, TDA, or @@ -1360,11 +1356,28 @@ void pf_ul(module_id_t module_id, } update_ul_ue_R_Qm(sched_pusch, ps); + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + sched_pusch->rbStart = rbStart; + uint16_t max_rbSize = 1; + while (rbStart + max_rbSize < bwpSize && + (rballoc_mask[rbStart + max_rbSize]&&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + max_rbSize++; + + if (rbStart + min_rb >= bwpSize) { + LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + return; + } + else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + + /* Calculate the current scheduling bytes and the necessary RBs */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); uint16_t rbSize = 0; uint32_t TBS = 0; - + nr_find_nb_rb(sched_pusch->Qm, sched_pusch->R, 1, // layers @@ -1391,7 +1404,7 @@ void pf_ul(module_id_t module_id, n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); } } @@ -1474,11 +1487,9 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; + const uint16_t symb = SL_to_bitmap(startSymbolIndex, nrOfSymbols); int st = 0, e = 0, len = 0; - for (int i = 0; i < bwpSize; i++) - if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=symb; for (int i = 0; i < bwpSize; i++) { while ((vrb_map_UL[bwpStart + i] & symb) != 0 && i < bwpSize) @@ -1495,12 +1506,12 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t LOG_D(NR_MAC,"UL %d.%d : start_prb %d, end PRB %d\n",frame,slot,st,e); - uint8_t rballoc_mask[bwpSize]; + uint16_t rballoc_mask[bwpSize]; /* Calculate mask: if any RB in vrb_map_UL is blocked (1), the current RB will be 0 */ for (int i = 0; i < bwpSize; i++) - rballoc_mask[i] = i >= st && i <= e; - LOG_D(NR_MAC,"%d.%d : UL start %d, end %d\n",frame,slot,st,e); + rballoc_mask[i] = (i >= st && i <= e)*SL_to_bitmap(startSymbolIndex, nrOfSymbols); + /* proportional fair scheduling algorithm */ pf_ul(module_id, frame, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 28e9d689fa6f40ecd7a9cb622e2b4e87e1b1a84a..8b734e3b950b7f50212c7c514a3a5cabf7a60ea8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -291,6 +291,14 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup, nr_dci_format_t format, int bwp_id); +void set_r_pucch_parms(int rsetindex, + int r_pucch, + int bwp_size, + int *prb_start, + int *second_hop_prb, + int *nr_of_symbols, + int *start_symbol_index); + /* find coreset within the search space */ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index b1e12414871fc8bf8864dd448c3f555354ac8d05..4141976b5dd3ff6af6d4b6f729e9e214560eaf4d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -171,6 +171,8 @@ typedef struct { uint8_t msg3_round; /// Flag to indicate if Msg3 carries a DCCH or DTCH message bool msg3_dcch_dtch; + int msg3_startsymb; + int msg3_nrsymb; /// TBS used for Msg4 int msg4_TBsize; /// MCS used for Msg4 @@ -327,6 +329,10 @@ typedef struct NR_sched_pucch { uint8_t timing_indicator; uint8_t resource_indicator; int r_pucch; + int prb_start; + int second_hop_prb; + int nr_of_symb; + int start_symb; } NR_sched_pucch_t; /* PUSCH semi-static configuration: as long as the TDA and DCI format remain @@ -597,14 +603,13 @@ typedef struct { /// total amount of data awaiting for this UE uint32_t num_total_bytes; + uint16_t dl_pdus_total; /// per-LC status data - mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID]; + mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID]; /// Estimation of HARQ from BLER NR_DL_bler_stats_t dl_bler_stats; - int lcid_mask; - int lcid_to_schedule; uint16_t ta_frame; int16_t ta_update; bool ta_apply; @@ -640,6 +645,12 @@ typedef struct { /// UL HARQ processes that await retransmission NR_list_t retrans_ul_harq; NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information + + /// number of active DL LCs + uint8_t dl_lc_num; + /// order in which DLSCH scheduler should allocate LCs + uint8_t dl_lc_ids[NR_MAX_NUM_LCID]; + } NR_UE_sched_ctrl_t; typedef struct { @@ -724,7 +735,7 @@ typedef struct gNB_MAC_INST_s { /// current PDU index (BCH,DLSCH) uint16_t pdu_index[NFAPI_CC_MAX]; int num_ulprbbl; - int ulprbbl[275]; + uint16_t ulprbbl[275]; /// NFAPI Config Request Structure nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX]; /// NFAPI DL Config Request Structure diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 1f66400af1a67765afc38b8673dec7062d7d240a..7d1e2f493184ae675882b8f2aeaa900506b6b37e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1149,9 +1149,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits; drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed; drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0; @@ -1181,7 +1181,8 @@ void nr_DRB_preconfiguration(uint16_t crnti) NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig,NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); Rlc_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_Bearer_ToAdd_list)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index d494b963990fcd49b1933e2144dc88cfe2014b58..87842ad0744eda82839f549266dc8670e42dbab2 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -94,10 +94,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->cellGroupId = scg_id; NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); - else - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index 08daf58cf7d149dadf0d84bc68bf35243f4d50b0..4d681b8d62465cb69769a7e9766d068ff3048bc3 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -116,9 +116,6 @@ int load_lib(openair0_device *device, deflibname=OAI_IQPLAYER_LIBNAME; shlib_fdesc[0].fname="device_init"; set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT); // softmodem has to know we use the iqplayer to workaround randomized algorithms - } else if ( IS_SOFTMODEM_BASICSIM ) { - deflibname=OAI_BASICSIM_LIBNAME; - shlib_fdesc[0].fname="device_init"; } else if (IS_SOFTMODEM_RFSIM && flag == RAU_LOCAL_RADIO_HEAD) { deflibname=OAI_RFSIM_LIBNAME; shlib_fdesc[0].fname="device_init"; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 38a7b0fa67aac05b71d4f1a8635f0ba4e2895ed2..a60d5e78fc93f06a411918ef73e99db17fd9b636 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -46,8 +46,6 @@ #define OAI_THIRDPARTY_TP_LIBNAME "thirdparty_transpro" /* name of shared library implementing the rf simulator */ #define OAI_RFSIM_LIBNAME "rfsimulator" -/* name of shared library implementing the basic simulator */ -#define OAI_BASICSIM_LIBNAME "tcp_bridge_oai" /* name of shared library implementing the iq player */ #define OAI_IQPLAYER_LIBNAME "oai_iqplayer" diff --git a/targets/ARCH/tcp_bridge/README b/targets/ARCH/tcp_bridge/README deleted file mode 100644 index 9bd1a16e59293f3c9634c07257fa9b9e11ee23b8..0000000000000000000000000000000000000000 --- a/targets/ARCH/tcp_bridge/README +++ /dev/null @@ -1,4 +0,0 @@ -This is sort of a "TCP driver" to ease debugging. This is mostly internal -to EURECOM. You probably don't want to use it. - -Same license as the rest. diff --git a/targets/ARCH/tcp_bridge/README.tcp_bridge_oai b/targets/ARCH/tcp_bridge/README.tcp_bridge_oai deleted file mode 100644 index 05a520f6ae0286c82abd7a228160df34bad228ff..0000000000000000000000000000000000000000 --- a/targets/ARCH/tcp_bridge/README.tcp_bridge_oai +++ /dev/null @@ -1,42 +0,0 @@ -The driver tcp_bridge_oai.c is to be used with the basic simulator. - -To build the basic simulator: - cd [openair top directory] - . oaienv - cd cmake_targets - ./build_oai -I -w USRP - ./build_oai --basic-simulator - cd ../common/utils/T/tracer - make - -To use it, you need to run the eNB and the UE. - -The eNB requires the T tracer. -Open two terminals. -In one terminal, run: - cd [openair top directory] - cd common/utils/T/tracer - ./enb -d ../T_messages.txt -In the other terminal, run: - cd [openair top directory] - cd cmake_targets/basic_simulator/enb - export ENODEB=1 - sudo -E ./lte-softmodem -O [configuration file] --T_stdout 0 -[configuration file] is just a regular configuration file. -The eNB needs an EPC. - -To run the UE, open a terminal and run: - cd [openair top directory] - cd cmake_targets/basic_simulator/ue - sudo ./lte-uesoftmodem -C 2680000000 -r 25 --ue-rxgain 140 -Adapt the value of -r, it has to match the value N_RB_DL in the configuration -file of the eNB. (Same for -C which should match the value downlink_frequency -in the configuration file.) - -The UE configuration (security keys) is generated from the file -openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf. You need to configure -your EPC to know about the UE. If you change the file -openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf then you need to -regenerate the configuration files using the program targets/bin/conf2uedata. -You run it as: - $OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o $OPENAIR_DIR/cmake_targets/basic_simulator/ue diff --git a/targets/ARCH/tcp_bridge/tcp_bridge.c b/targets/ARCH/tcp_bridge/tcp_bridge.c deleted file mode 100644 index f8c12dcb7acb0e89140f106b6b43eb246dd87c1b..0000000000000000000000000000000000000000 --- a/targets/ARCH/tcp_bridge/tcp_bridge.c +++ /dev/null @@ -1,292 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -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) -{ - 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; -} - -#include "common_lib.h" - -typedef struct { - int32_t data[30720]; /* max 20MHz */ - unsigned long timestamp; - int size; -} input_buffer; - -#define BSIZE 16 - -typedef struct { - int sock; - int samples_per_subframe; - input_buffer b[BSIZE]; - int bstart; - int blen; - unsigned long read_timestamp; -} tcp_bridge_state_t; - - -/****************************************************************************/ -/* buffer management */ -/* (could be simpler, we are synchronous) */ -/* maybe we should lock */ -/****************************************************************************/ - -void put_buffer(tcp_bridge_state_t *t, void *data, int size, unsigned long timestamp) -{ - int nextpos; - if (t->blen == BSIZE) { printf("tcp_bridge: buffer full\n"); exit(1); } - if (size > 30720*4) abort(); - if (t->blen) { - int lastpos = (t->bstart+t->blen-1) % BSIZE; - if (timestamp != t->b[lastpos].timestamp + t->samples_per_subframe) - { printf("tcp_bridge: discontinuity\n"); exit(1); } - } - nextpos = (t->bstart+t->blen) % BSIZE; - t->b[nextpos].timestamp = timestamp; - t->b[nextpos].size = size; - memcpy(t->b[nextpos].data, data, size); - t->blen++; -} - -void get_buffer(tcp_bridge_state_t *t, void *data, int size, unsigned long timestamp) -{ - int pos; - if (t->blen == 0) { printf("tcp_bridge: buffer empty\n"); exit(1); } - if (size >30720*4) abort(); - pos = t->bstart; - if (size != t->b[pos].size) { printf("tcp_bridge: bad size\n"); exit(1); } - memcpy(data, t->b[pos].data, size); - t->bstart = (t->bstart + 1) % BSIZE; - t->blen--; -} - -/****************************************************************************/ -/* end of buffer management */ -/****************************************************************************/ - - -/****************************************************************************/ -/* network management (read/write) */ -/****************************************************************************/ - -void read_data_from_network(int sock, input_buffer *b) -{ - if (fullread(sock, &b->timestamp, sizeof(b->timestamp)) != sizeof(b->timestamp)) goto err; - if (fullread(sock, &b->size, sizeof(b->size)) != sizeof(b->size)) goto err; - if (fullread(sock, b->data, b->size) != b->size) goto err; - return; - -err: - printf("tcp_bridge: read_data_from_network fails\n"); - exit(1); -} - -void write_data_to_network(int sock, input_buffer *b) -{ - if (fullwrite(sock, &b->timestamp, sizeof(b->timestamp)) != sizeof(b->timestamp)) goto err; - if (fullwrite(sock, &b->size, sizeof(b->size)) != sizeof(b->size)) goto err; - if (fullwrite(sock, b->data, b->size) != b->size) goto err; - return; - -err: - printf("tcp_bridge: write_data_to_network fails\n"); - exit(1); -} - -/****************************************************************************/ -/* end of network management */ -/****************************************************************************/ - - -int tcp_bridge_start(openair0_device *device) -{ - int i; - int port = 4042; - tcp_bridge_state_t *tcp_bridge = device->priv; - - 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); } - - struct sockaddr_in addr = { - sin_family: AF_INET, - sin_port: htons(port), - sin_addr: { s_addr: INADDR_ANY } - }; - - if (bind(sock, (struct sockaddr *)&addr, sizeof(addr))) - { perror("tcp_bridge: bind"); exit(1); } - - if (listen(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); } - - close(sock); - - tcp_bridge->sock = sock2; - - /* the other end has to send 10 subframes at startup */ - for (i = 0; i < 10; i++) - read_data_from_network(sock2, &tcp_bridge->b[i]); - tcp_bridge->bstart = 0; - tcp_bridge->blen = 10; - - printf("tcp_bridge: connection established\n"); - - 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; } -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_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) -{ - tcp_bridge_state_t *t = device->priv; - input_buffer out; - int i; -//printf("write ts %ld nsamps %d\n", timestamp, nsamps); - - if (nsamps > 30720) abort(); - - /* read buffer timestamped with 'timestamp' if not already here */ - for (i = 0; i < t->blen; i++) { - input_buffer *b = &t->b[(t->bstart + i) % BSIZE]; - if (b->timestamp == timestamp) break; - } - if (i == t->blen) { - int nextpos = (t->bstart + t->blen) % BSIZE; - if (t->blen == BSIZE) abort(); - read_data_from_network(t->sock, &t->b[nextpos]); - t->blen++; - if (t->b[nextpos].timestamp != timestamp) abort(); - } - - memcpy(out.data, buff[0], nsamps * 4); - out.timestamp = timestamp; - out.size = nsamps * 4; - write_data_to_network(t->sock, &out); - - return nsamps; -} - -int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) -{ - tcp_bridge_state_t *t = device->priv; - input_buffer *b; - - if (cc != 1) abort(); - if (t->blen == 0) abort(); - - b = &t->b[t->bstart]; - - if (b->timestamp != t->read_timestamp) abort(); - if (b->size != nsamps * 4) abort(); - - *timestamp = b->timestamp; - memcpy(buff[0], b->data, b->size); - - t->read_timestamp += nsamps; - t->bstart = (t->bstart + 1) % BSIZE; - t->blen--; - -static unsigned long ts = 0; -//printf("read ts %ld nsamps %d\n", ts, nsamps); -*timestamp = ts; -ts += nsamps; - - return nsamps; -} - -int tcp_bridge_write_init(openair0_device *device) -{ - return 0; -} - -__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)); - - /* only 25 or 50 PRBs handled for the moment */ - if (openair0_cfg[0].sample_rate != 61440000 && - openair0_cfg[0].sample_rate != 30720000 && - openair0_cfg[0].sample_rate != 15360000 && - openair0_cfg[0].sample_rate != 7680000) { - printf("tcp_bridge: ERROR: only sample rate 61.44, 30.72, 15.36, and 7.68 Msps supported\n"); - exit(1); - } - - device->trx_start_func = tcp_bridge_start; - device->trx_get_stats_func = tcp_bridge_get_stats; - device->trx_reset_stats_func = tcp_bridge_reset_stats; - device->trx_end_func = tcp_bridge_end; - device->trx_stop_func = tcp_bridge_stop; - device->trx_set_freq_func = tcp_bridge_set_freq; - device->trx_set_gains_func = tcp_bridge_set_gains; - device->trx_write_func = tcp_bridge_write; - device->trx_read_func = tcp_bridge_read; - device->trx_write_init = tcp_bridge_write_init; - - device->priv = tcp_bridge; - - switch ((int)openair0_cfg[0].sample_rate) { - case 61440000: tcp_bridge->samples_per_subframe = 61440; 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/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c deleted file mode 100644 index c3d5355876cde1e976f52f3ace43452ab35a1f63..0000000000000000000000000000000000000000 --- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c +++ /dev/null @@ -1,443 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -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=<an ip address> (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) { - 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; -} - -#include "common_lib.h" - -typedef struct { - int sock; - int samples_per_subframe; - 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) { - 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(helpTxt); - 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 } - }; - - if (bind(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr))) { - perror("tcp_bridge: bind"); - 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 sockServ = accept(tcp_bridge->sock, (struct sockaddr *)&addr, &len); - - if ( sockServ == -1) { - perror("tcp_bridge: accept"); - exit(1); - } - - verify_connection(sockServ, tcp_bridge->is_enb); - printf("tcp_bridge: connection established\n"); - close(tcp_bridge->sock); - tcp_bridge->sock=sockServ; - return 0; -} - -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); - - while(1) { - printf("tcp_bridge: trying to connect to %s:%d\n", tcp_bridge->ip, port); - - 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"); - return 0; - } - - perror("tcp_bridge"); - sleep(1); - } - - 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_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); - } - - 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); - } - - 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. - */ - 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(); - } - } - - return tcp_bridge_read(device, timestamp, buff, nsamps, cc); -} - -/* 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; - 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(); - } - - /* Due to some unknown bug in the eNB (or UE, or both), the first frames - * are not correctly generated (or handled), which leads to a bad behavior - * of the simulator in some cases (seen with 100 RBs: the UE reads a bad - * MIB and switches to 25 RBs, which results in a deadlock in this driver). - * Let's skip 10 frames to avoid this issue. - */ - for (int i = 0; i < 10 * 10; i++) { - memset(b, 0, t->samples_per_subframe * 4); - n = fullwrite(t->sock, b, t->samples_per_subframe * 4); - - if (n != t->samples_per_subframe * 4) { - printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno)); - abort(); - } - - n = fullread(t->sock, b, t->samples_per_subframe * 4); - - if (n != t->samples_per_subframe * 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 *)calloc(sizeof(tcp_bridge_state_t),1); - - 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"); - - if (openair0_cfg[0].sample_rate != 61440000 && - openair0_cfg[0].sample_rate != 30720000 && - openair0_cfg[0].sample_rate != 15360000 && - openair0_cfg[0].sample_rate != 7680000) { - printf("tcp_bridge: ERROR: only sample rate 61.44, 30.72, 15.36, and 7.68 Msps supported\n"); - exit(1); - } - - device->trx_start_func = tcp_bridge_start; - device->trx_get_stats_func = tcp_bridge_get_stats; - device->trx_reset_stats_func = tcp_bridge_reset_stats; - device->trx_end_func = tcp_bridge_end; - device->trx_stop_func = tcp_bridge_stop; - device->trx_set_freq_func = tcp_bridge_set_freq; - device->trx_set_gains_func = tcp_bridge_set_gains; - device->trx_write_func = tcp_bridge_write; - - if (tcp_bridge->is_enb) { - device->trx_read_func = tcp_bridge_read; - } else { - device->trx_read_func = tcp_bridge_ue_first_read; - } - - 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; - } - - /* let's pretend to be a b2x0 */ - device->type = USRP_B200_DEV; - device->openair0_cfg=&openair0_cfg[0]; - return 0; -} diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 7e897c7debdbd3c32dd6f70920c8093b61eaf0e0..66ce6ef2474acaa36da14769254d8664e1e37d2d 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1387,12 +1387,6 @@ int setup_RU_buffers(RU_t *ru) { else if (frame_parms->N_RB_DL == 50) ru->N_TA_offset = 624/2; else if (frame_parms->N_RB_DL == 25) ru->N_TA_offset = 624/4; - if(IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - ru->N_TA_offset = 0; - if (frame_parms->N_RB_DL == 100) /* no scaling to do */; else if (frame_parms->N_RB_DL == 50) { ru->sf_extension /= 2; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2e95e56d852db2a57036cde266cf29809b38e020..9010a40bf951feb6008f4a4acdb0d394f376aaa7 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -360,12 +360,6 @@ void init_UE(int nb_inst, } } else UE->N_TA_offset = 0; - if( IS_SOFTMODEM_BASICSIM) - /* this is required for the basic simulator in TDD mode - * TODO: find a proper cleaner solution - */ - UE->N_TA_offset = 0; - LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); init_UE_threads(inst); @@ -883,7 +877,7 @@ static void *UE_thread_rxn_txnp4(void *arg) proc->instance_cnt_rxtx--; - if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_RFSIM) { if (pthread_cond_signal(&proc->cond_rxtx) != 0) abort(); } @@ -1998,12 +1992,6 @@ void *UE_thread(void *arg) log_scheduler(__func__); while (!oai_exit) { - if (IS_SOFTMODEM_BASICSIM) - while (!(UE->proc.instance_cnt_synch < 0)) { - printf("ue sync not ready\n"); - usleep(500*1000); - } - AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); int instance_cnt_synch = UE->proc.instance_cnt_synch; int is_synchronized = UE->is_synchronized; @@ -2011,8 +1999,18 @@ void *UE_thread(void *arg) if (is_synchronized == 0) { if (instance_cnt_synch < 0) { // we can invoke the synch - // grab 10 ms of signal and wakeup synch thread + // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy + for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti/2, + UE->frame_parms.nb_antennas_rx); + + // grab 10 ms of signal and wakeup synch thread + if (UE->mode != loop_through_memory) { if (IS_SOFTMODEM_RFSIM ) { for(int sf=0; sf<10; sf++) { @@ -2121,7 +2119,7 @@ void *UE_thread(void *arg) // update thread index for received subframe UE->current_thread_id[sub_frame] = thread_idx; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_RFSIM ) { int t; for (t = 0; t < 2; t++) { @@ -2213,8 +2211,8 @@ void *UE_thread(void *arg) LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); } - /* no timeout in IS_SOFTMODEM_BASICSIM or IS_SOFTMODEM_RFSIM mode */ - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) { + /* no timeout in IS_SOFTMODEM_RFSIM mode */ + if (IS_SOFTMODEM_RFSIM) { ret = pthread_mutex_lock(&proc->mutex_rxtx); } else { struct timespec tv; diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2b39bd3f0fca94c7bef3f55d6f421b093b2a5254..8cdef647cab5063722aaccf0d3ccbe938677e6ef 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -519,7 +519,7 @@ int restart_L1L2(module_id_t enb_id) { static void init_pdcp(int ue_id) { uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { + if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; }