diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 8f1955f265..3042ada815 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -529,28 +529,6 @@ pipeline { } } } - stage ("Test IF4p5 - TDD - Band 38 - B210 - MultiRRU") { - when { - expression {doFullTestsuite} - } - steps { - script { - triggerSlaveJob ('eNB-CI-IF4p5-TDD-Band38-MultiRRU-B210', 'Test-IF4p5-TDD-Band38-Multi-RRU') - } - } - post { - always { - script { - finalizeSlaveJob('eNB-CI-IF4p5-TDD-Band38-MultiRRU-B210') - } - } - failure { - script { - currentBuild.result = 'FAILURE' - } - } - } - } stage ("Test OAI UE - FDD - Band 20 - B200") { when { expression {doFullTestsuite} diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index ba5ce49e8d..e606513935 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -506,6 +506,7 @@ class Containerize(): # mySSH.command('sed -i -e "s/FLEXRAN_ENABLED:.*$/FLEXRAN_ENABLED: \'no\'/" ci-docker-compose.yml', '\$', 2) # mySSH.command('sed -i -e "s/CI_FLEXRAN_CTL_IP_ADDR/127.0.0.1/" ci-docker-compose.yml', '\$', 2) # Currently support only one + mySSH.command('echo ' + lPassWord + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 15) mySSH.command('docker-compose --file ci-docker-compose.yml config --services | sed -e "s@^@service=@" 2>&1', '\$', 10) result = re.search('service=(?P[a-zA-Z0-9\_]+)', mySSH.getBefore()) if result is not None: @@ -715,7 +716,7 @@ class Containerize(): logging.debug(cmd) networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - def UndeployGenObject(self, HTML, RAN): + def UndeployGenObject(self, HTML, RAN, UE): self.exitStatus = 0 ymlPath = self.yamlPath[0].split('/') logPath = '../cmake_targets/log/' + ymlPath[1] @@ -751,7 +752,7 @@ class Containerize(): logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - # Analyzing log file! + # Analyzing log file(s)! listOfPossibleRanContainers = ['enb', 'gnb', 'cu', 'du'] for container in listOfPossibleRanContainers: filename = self.yamlPath[0] + '/rfsim?g-oai-' + container + '.log' @@ -766,7 +767,6 @@ class Containerize(): continue logging.debug('\u001B[1m Analyzing xNB logfile ' + filename + ' \u001B[0m') - # For the moment just assume this exists logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML) if (logStatus < 0): fullStatus = False @@ -774,6 +774,27 @@ class Containerize(): else: HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK) + listOfPossibleUeContainers = ['lte-ue*', 'nr-ue*'] + for container in listOfPossibleUeContainers: + filename = self.yamlPath[0] + '/rfsim?g-oai-' + container + '.log' + cmd = 'ls ' + filename + containerStatus = True + try: + lsStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + filename = str(lsStatus).strip() + except: + containerStatus = False + if not containerStatus: + continue + + logging.debug('\u001B[1m Analyzing UE logfile ' + filename + ' \u001B[0m') + logStatus = UE.AnalyzeLogFile_UE(filename, HTML, RAN) + if (logStatus < 0): + fullStatus = False + HTML.CreateHtmlTestRow('UE log Analysis', 'KO', logStatus) + else: + HTML.CreateHtmlTestRow('UE log Analysis', 'OK', CONST.ALL_PROCESSES_OK) + cmd = 'rm ' + self.yamlPath[0] + '/*.log' logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) @@ -789,6 +810,7 @@ class Containerize(): cmd = 'sudo rm /tmp/capture_' + ymlPath[1] + '.pcap' logging.debug(cmd) copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + self.tsharkStarted = False logging.debug('\u001B[1m Undeploying \u001B[0m') cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml down' @@ -814,7 +836,7 @@ class Containerize(): HTML.CreateHtmlTestRow('n/a', 'KO', CONST.ALL_PROCESSES_OK) logging.info('\u001B[1m Undeploying OAI Object(s) FAIL\u001B[0m') - def PingFromContainer(self, HTML): + def PingFromContainer(self, HTML, RAN, UE): self.exitStatus = 0 ymlPath = self.yamlPath[0].split('/') logPath = '../cmake_targets/log/' + ymlPath[1] @@ -828,17 +850,17 @@ class Containerize(): result = re.search(', (?P[0-9\.]+)% packet loss, time [0-9\.]+ms', deployStatus) if result is None: - self.PingExit(HTML, False, 'Packet Loss Not Found') + self.PingExit(HTML, RAN, UE, False, 'Packet Loss Not Found') return packetloss = result.group('packetloss') if float(packetloss) == 100: - self.PingExit(HTML, False, 'Packet Loss is 100%') + self.PingExit(HTML, RAN, UE, False, 'Packet Loss is 100%') return result = re.search('rtt min\/avg\/max\/mdev = (?P[0-9\.]+)\/(?P[0-9\.]+)\/(?P[0-9\.]+)\/[0-9\.]+ ms', deployStatus) if result is None: - self.PingExit(HTML, False, 'Ping RTT_Min RTT_Avg RTT_Max Not Found!') + self.PingExit(HTML, RAN, UE, False, 'Ping RTT_Min RTT_Avg RTT_Max Not Found!') return rtt_min = result.group('rtt_min') @@ -860,7 +882,7 @@ class Containerize(): packetLossOK = False elif float(packetloss) > 0: message += '\nPacket Loss is not 0%' - self.PingExit(HTML, packetLossOK, message) + self.PingExit(HTML, RAN, UE, packetLossOK, message) if packetLossOK: logging.debug('\u001B[1;37;44m ping result \u001B[0m') @@ -870,7 +892,7 @@ class Containerize(): logging.debug('\u001B[1;34m ' + max_msg + '\u001B[0m') logging.info('\u001B[1m Ping Test PASS\u001B[0m') - def PingExit(self, HTML, status, message): + def PingExit(self, HTML, RAN, UE, status, message): html_queue = SimpleQueue() html_cell = '
UE\n' + message + '
' html_queue.put(html_cell) @@ -885,10 +907,10 @@ class Containerize(): logging.debug('----------------------------------------') HTML.testCase_id = 'AUTO-UNDEPLOY' HTML.desc = 'Automatic Un-Deployment' - self.UndeployGenObject(HTML) + self.UndeployGenObject(HTML, RAN, UE) self.exitStatus = 1 - def IperfFromContainer(self, HTML): + def IperfFromContainer(self, HTML, RAN): self.exitStatus = 0 ymlPath = self.yamlPath[0].split('/') diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 7fb45ed3ea..cf7b91d3c0 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -93,7 +93,7 @@ class Log_Mgt: avail_space =int(self.__CheckAvailSpace())*1000 #avail space in target folder, initially displayed in Gb avg_size=self.__AvgSize() #average size of artifacts in the target folder logging.debug("Avail Space : " + str(avail_space) + " / Artifact Avg Size : " + str(avg_size)) - if avail_space < 2*avg_size: #reserved space is 2x artifact file ; oldest file will be deleted + if avail_space < 50*avg_size: #reserved space is 50x artifact file ; oldest file will be deleted oldestfile=self.__GetOldestFile() HOST=self.Username+'@'+self.IPAddress COMMAND="echo " + self.Password + " | sudo -S rm "+ self.path + "/" + oldestfile diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 9d2c75363d..5d89a7b2e0 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -2045,6 +2045,52 @@ class OaiCiTest(): else: return -2 + + def Iperf_analyzeV2BIDIR(self, lock, UE_IPAddress, device_id, statusQueue,server_filename,client_filename): + + #check the 2 files are here + if (not os.path.isfile(client_filename)) or (not os.path.isfile(server_filename)): + self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Client or Server Log File not present') + return + #check the 2 files size + if (os.path.getsize(client_filename)==0) and (os.path.getsize(server_filename)==0): + self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Client and Server Log File are empty') + return + + report_msg='TCP BIDIR Report:\n' + #if client is not empty, all the info is in, otherwise we ll use the server file to get some partial info + client_filesize = os.path.getsize(client_filename) + if client_filesize == 0: + report_msg+="Client file (UE) present but !!! EMPTY !!!\n" + report_msg+="Partial report from server file\n" + filename = server_filename + else : + report_msg+="Report from client file (UE)\n" + filename = client_filename + + report=[] #used to check if relevant lines were found + + with open(filename, 'r') as f_client: + for line in f_client.readlines(): + result = re.search(rf'^\[\s+\d+\](?P\[.+\]).*\s+(?P[0-9\.]+ [KMG]bits\/sec).*\s+(?P\bsender|receiver\b)', str(line)) + if result is not None: + report.append(str(line)) + report_msg+=result.group('role') + ' ' + result.group('direction')+ '\t = ' +result.group('bitrate')+'\n' + + if len(report)>0: + lock.acquire() + statusQueue.put(0) + statusQueue.put(device_id) + statusQueue.put(UE_IPAddress) + statusQueue.put(report_msg) + logging.debug('\u001B[1;37;45m TCP Bidir Iperf Result (' + UE_IPAddress + ') \u001B[0m') + logging.debug('\u001B[1;35m ' + report_msg + '\u001B[0m') + lock.release() + else: + self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Could not analyze from Log file') + + + def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options, filename,type): if (not os.path.isfile(filename)): self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log') @@ -2342,17 +2388,22 @@ class OaiCiTest(): result = re.search('TRF_IP_ADDR = (?P[0-9\.]+)', SSH.getBefore()) if result is not None: trf_gen_IP = result.group('trf_ip_addr') + #kill iperf processes on EPC side + SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5) + SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf3"', '\$', 5) SSH.close() #kill iperf processes on UE side before (in case there are still some remaining) SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'killall --signal=SIGKILL iperf' SSH.command(cmd,'\$',5) + cmd = 'killall --signal=SIGKILL iperf3' + SSH.command(cmd,'\$',5) SSH.close() - iperf_time = self.Iperf_ComputeTime() + iperf_time = self.Iperf_ComputeTime() if self.iperf_direction=="DL": logging.debug("Iperf for Module in DL mode detected") - #server side UE + ##server side UE server_filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'rm ' + server_filename @@ -2360,20 +2411,21 @@ class OaiCiTest(): cmd = 'echo $USER; nohup iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > ' + server_filename + ' &' SSH.command(cmd,'\$',5) SSH.close() - #client side EPC + ##client side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' - SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5) + #remove old client file in EPC.SourceCodePath + cmd = 'rm ' + EPC.SourceCodePath + '/' + client_filename + SSH.command(cmd,'\$',5) iperf_cmd = 'bin/iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename - cmd = 'docker exec -it prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' + cmd = 'docker exec -w /iperf-2.0.13 -it prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' SSH.command(cmd,'\$',int(iperf_time)*5.0) SSH.command('docker cp prod-trf-gen:/iperf-2.0.13/'+ client_filename + ' ' + EPC.SourceCodePath, '\$', 5) - SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + client_filename, '.') SSH.close() - #copy the 2 resulting files locally + #copy the 2 resulting files locally (python executor) SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, server_filename, '.') - SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, client_filename, '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + client_filename, '.') #send for analysis self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,server_filename,1) @@ -2382,9 +2434,9 @@ class OaiCiTest(): #server side EPC SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' - SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5) + iperf_cmd = 'echo $USER; nohup bin/iperf -s -u 2>&1 > ' + server_filename - cmd = 'docker exec -d prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' + cmd = 'docker exec -d -w /iperf-2.0.13 prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' SSH.command(cmd,'\$',5) SSH.close() @@ -2399,14 +2451,49 @@ class OaiCiTest(): #once client is done, retrieve the server file from container to EPC Host SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) SSH.command('docker cp prod-trf-gen:/iperf-2.0.13/' + server_filename + ' ' + EPC.SourceCodePath, '\$', 5) - SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + server_filename, '.') SSH.close() #copy the 2 resulting files locally SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, client_filename, '.') - SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + server_filename, '.') #send for analysis self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,server_filename,1) + + elif self.iperf_direction=="BIDIR": + logging.debug("Iperf for Module in BIDIR mode detected") + server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + + #server side EPC + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + iperf_cmd = 'echo $USER; nohup /usr/local/bin/iperf3 -s 2>&1 > ' + server_filename + cmd = 'docker exec -d -w /iperf-2.0.13 prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' + SSH.command(cmd,'\$',5) + SSH.close() + + #client side UE + SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + cmd = 'rm '+ client_filename + SSH.command(cmd,'\$',5) + SSH.command('iperf3 -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename, '\$', int(iperf_time)*5.0) + SSH.close() + + #once client is done, retrieve the server file from container to EPC Host + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + #remove old server file in EPC.SourceCodePath + cmd = 'rm ' + EPC.SourceCodePath + '/' + server_filename + SSH.command(cmd,'\$',5) + #copy from docker container to EPC.SourceCodePath + SSH.command('docker cp prod-trf-gen:/iperf-2.0.13/' + server_filename + ' ' + EPC.SourceCodePath, '\$', 5) + SSH.close() + + #copy the 2 resulting files locally + SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, client_filename, '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + server_filename, '.') + + #send for analysis + self.Iperf_analyzeV2BIDIR(lock, UE_IPAddress, device_id, statusQueue, server_filename, client_filename) + else : logging.debug("Incorrect or missing IPERF direction in XML") @@ -2418,10 +2505,15 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'killall --signal=SIGKILL iperf' SSH.command(cmd,'\$',5) + cmd = 'killall --signal=SIGKILL iperf3' + SSH.command(cmd,'\$',5) SSH.close() SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) cmd = 'killall --signal=SIGKILL iperf' SSH.command(cmd,'\$',5) + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + cmd = 'killall --signal=SIGKILL iperf3' + SSH.command(cmd,'\$',5) SSH.close() @@ -2472,6 +2564,32 @@ class OaiCiTest(): #send for analysis filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1) + elif self.iperf_direction=="BIDIR": + logging.debug("Iperf for Module in BIDIR mode detected") + server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + + + #server side EPC + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + cmd = 'rm ' + server_filename + SSH.command(cmd,'\$',5) + cmd = 'echo $USER; nohup iperf3 -s 2>&1 > '+server_filename+' &' + SSH.command(cmd,'\$',5) + SSH.close() + + #client side UE + SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + cmd = 'rm ' + client_filename + SSH.command(cmd,'\$',5) + SSH.command('iperf3 -c 192.172.0.1 ' + self.iperf_args + ' 2>&1 > '+client_filename, '\$', int(iperf_time)*5.0) + SSH.close() + + #copy the 2 resulting files locally + SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, client_filename, '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.') + #send for analysis + self.Iperf_analyzeV2BIDIR(lock, UE_IPAddress, device_id, statusQueue, server_filename, client_filename) else : logging.debug("Incorrect or missing IPERF direction in XML") @@ -2479,10 +2597,14 @@ class OaiCiTest(): SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) cmd = 'killall --signal=SIGKILL iperf' SSH.command(cmd,'\$',5) + cmd = 'killall --signal=SIGKILL iperf3' + SSH.command(cmd,'\$',5) SSH.close() SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) cmd = 'killall --signal=SIGKILL iperf' SSH.command(cmd,'\$',5) + cmd = 'killall --signal=SIGKILL iperf3' + SSH.command(cmd,'\$',5) SSH.close() return diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index e825b2f7bd..33792f6ca4 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -183,7 +183,7 @@ class PhySim: mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.command('cd '+self.__workSpacePath,'\$',5) #run and redirect the results to a log file - mySSH.command(self.__workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) + mySSH.command(self.__workSpacePath+'ran_build/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) mySSH.close() #return updated HTML to main lHTML = html.HTMLManagement() diff --git a/ci-scripts/cls_static_code_analysis.py b/ci-scripts/cls_static_code_analysis.py index 1680f3e560..c899a9aabd 100644 --- a/ci-scripts/cls_static_code_analysis.py +++ b/ci-scripts/cls_static_code_analysis.py @@ -121,7 +121,7 @@ class StaticCodeAnalysis(): mySSH.command('docker build --tag oai-cppcheck:xenial --file ci-scripts/docker/Dockerfile.cppcheck.xenial . > cmake_targets/log/cppcheck-xenial.txt 2>&1', '\$', 600) mySSH.command('sed -e "s@xenial@bionic@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.bionic', '\$', 6) mySSH.command('docker build --tag oai-cppcheck:bionic --file ci-scripts/docker/Dockerfile.cppcheck.bionic . > cmake_targets/log/cppcheck-bionic.txt 2>&1', '\$', 600) - mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 30) # Analyzing the logs mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index 79b2f7f877..dc86567c1f 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -215,11 +215,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf index 01add06e3a..682fb376cf 100644 --- a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -36,7 +36,7 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; ul_prbblacklist = "51,52,53,54" - min_rxtxtime_pdsch = 6; + min_rxtxtime = 6; pdcch_ConfigSIB1 = ( { controlResourceSetZero = 12; @@ -241,13 +241,13 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; +} ); RUs = ( diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf index ab0cf5f469..c0d4c6d4c9 100644 --- a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -36,7 +36,7 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; ul_prbblacklist = "51,52,53,54" - min_rxtxtime_pdsch = 6; + min_rxtxtime = 6; pdcch_ConfigSIB1 = ( { @@ -242,13 +242,13 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; +} ); RUs = ( diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index b03758a006..adcbcd45d0 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -227,14 +227,14 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( 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 16f72c68e5..e3bdde8469 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 @@ -229,13 +229,13 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; +} ); RUs = ( 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 1a940a51c4..3955b1542e 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 @@ -226,12 +226,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; +} ); RUs = ( diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf index 4338c00b36..dd9c210c0d 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -211,12 +211,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 1c2133bebe..2400136f9f 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -195,12 +195,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( 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 b0a757c9d0..adb79ceb8d 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 @@ -210,12 +210,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; +} ); RUs = ( 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 16456f939c..72ead42784 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 @@ -41,6 +41,7 @@ gNBs = pdsch_AntennaPorts = 1; pusch_AntennaPorts = 2; ul_prbblacklist = "51,52,53,54" + do_SRS = 1; pdcch_ConfigSIB1 = ( { @@ -226,18 +227,18 @@ MACRLCs = ( tr_n_preference = "local_RRC"; # pusch_TargetSNRx10 = 200; # pucch_TargetSNRx10 = 150; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 4; - prach_dtx_threshold = 120; -# pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; +# pucch0_dtx_threshold = 150; +} ); RUs = ( 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 70892930c9..32a40fe951 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 @@ -44,6 +44,7 @@ gNBs = #pucch_TargetSNRx10 = 200; ul_prbblacklist = "51,52,53,54" min_rxtxtime = 6; + do_SRS = 1; pdcch_ConfigSIB1 = ( { @@ -236,13 +237,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 4; - prach_dtx_threshold = 120; -# pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; +# pucch0_dtx_threshold = 150; +} ); RUs = ( 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 70892930c9..3579d1e3c2 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 @@ -39,11 +39,8 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - #pusch_TargetSNRx10 = 200; - #pucch_TargetSNRx10 = 200; - ul_prbblacklist = "51,52,53,54" - min_rxtxtime = 6; + pusch_AntennaPorts = 2; + ul_prbblacklist = "79,80,81,82" pdcch_ConfigSIB1 = ( { @@ -82,11 +79,11 @@ gNBs = # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; + dl_carrierBandwidth = 162; #initialDownlinkBWP #genericParameters # this is RBstart=0,L=106 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; + initialDLBWPlocationAndBandwidth = 31899; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -94,8 +91,6 @@ gNBs = initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -104,11 +99,11 @@ gNBs = # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; + ul_carrierBandwidth = 162; pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 28875; + initialULBWPlocationAndBandwidth = 31899; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -229,27 +224,27 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; +# pusch_TargetSNRx10 = 200; +# pucch_TargetSNRx10 = 150; + ulsch_max_frame_inactivity = 0; } ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 4; - prach_dtx_threshold = 120; -# pucch0_dtx_threshold = 150; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + prach_dtx_threshold = 120; +# pucch0_dtx_threshold = 150; +} ); RUs = ( { local_rf = "yes" - nb_tx = 1 - nb_rx = 1 + nb_tx = 2 + nb_rx = 2 att_tx = 0 att_rx = 0; bands = [78]; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 6ade355053..9cc8f554e8 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -194,11 +194,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index b7a04b1f36..249b7e4527 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -210,12 +210,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 6; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 6; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf index 3aa8696234..f232106d56 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -211,11 +211,11 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 6; - } + thread_pool_size = 6; +} ); RUs = ( diff --git a/ci-scripts/main.py b/ci-scripts/main.py index d8cad1c962..43772fb655 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -313,7 +313,7 @@ def GetParametersFromXML(action): CiTestObj.ue_id = "" else: CiTestObj.ue_id = ue_id - CiTestObj.iperf_direction = test.findtext('direction')#used for modules only + CiTestObj.iperf_direction = test.findtext('direction')#used for modules only CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold') iperf_bitrate_threshold = test.findtext('iperf_bitrate_threshold') if (iperf_bitrate_threshold is None): @@ -914,15 +914,15 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re if CONTAINERS.exitStatus==1: RAN.prematureExit = True elif action == 'UndeployGenObject': - CONTAINERS.UndeployGenObject(HTML, RAN) + CONTAINERS.UndeployGenObject(HTML, RAN, CiTestObj) if CONTAINERS.exitStatus==1: RAN.prematureExit = True elif action == 'PingFromContainer': - CONTAINERS.PingFromContainer(HTML) + CONTAINERS.PingFromContainer(HTML, RAN, CiTestObj) if CONTAINERS.exitStatus==1: RAN.prematureExit = True elif action == 'IperfFromContainer': - CONTAINERS.IperfFromContainer(HTML) + CONTAINERS.IperfFromContainer(HTML, RAN) if CONTAINERS.exitStatus==1: RAN.prematureExit = True else: diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index baf3a00725..ad360d2179 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -493,9 +493,9 @@ class RANManagement(): conf_file='../ci-scripts/stats_monitor_conf.yaml' if self.eNB_Stats=='yes': if (self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb'): - mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' enb 2>&1 > enb_stats_monitor_execution.log &', '\$', 5) + mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' ' + self.testCase_id + ' enb 2>&1 > enb_stats_monitor_execution.log &', '\$', 5) else: - mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' gnb 2>&1 > gnb_stats_monitor_execution.log &', '\$', 5) + mySSH.command('echo $USER; nohup python3 ' + monitor_file + ' ' + conf_file + ' ' + self.testCase_id + ' gnb 2>&1 > gnb_stats_monitor_execution.log &', '\$', 5) @@ -671,10 +671,14 @@ class RANManagement(): mySSH.command('echo ' + localEpcPassword + ' | sudo -S chmod 666 /tmp/' + self.epcPcapFile, '\$', 5) mySSH.copyin(localEpcIpAddr, localEpcUserName, localEpcPassword, '/tmp/' + self.epcPcapFile, '.') mySSH.copyout(lIpAddr, lUserName, lPassWord, self.epcPcapFile, lSourcePath + '/cmake_targets/.') + mySSH.command('killall --signal SIGKILL record', '\$', 5) mySSH.close() + # 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)) + if (result is not None): logging.debug('\u001B[1m Replaying RAW record file\u001B[0m') mySSH.open(lIpAddr, lUserName, lPassWord) - mySSH.command('killall --signal SIGKILL record', '\$', 5) mySSH.command('cd ' + lSourcePath + '/common/utils/T/tracer/', '\$', 5) enbLogFile = self.eNBLogFiles[int(self.eNB_instance)] raw_record_file = enbLogFile.replace('.log', '_record.raw') diff --git a/ci-scripts/ran_dashboard/Hdashboard.py b/ci-scripts/ran_dashboard/Hdashboard.py index 864e31fc1f..1b65c7af4f 100644 --- a/ci-scripts/ran_dashboard/Hdashboard.py +++ b/ci-scripts/ran_dashboard/Hdashboard.py @@ -544,6 +544,30 @@ class Dashboard: }) editable_mr.save() + def AWSCleanup(self,mode): + #first build MR list from aws S3 bucket + if mode != 'report' and mode !='delete': + print("incorrect mode for awsclean") + return + aws_mr_list=[] + s3 = boto3.resource('s3') + my_bucket = s3.Bucket('oaitestdashboard') + for my_bucket_object in my_bucket.objects.all(): + #MR objects are like MR1407/index.html + res=re.search(r'^MR([0-9]+)',my_bucket_object.key) + if res!=None: + aws_mr_list.append(res.group(1))#store MR number as a string + #open MR list from GIt already exists as an attribute of this class self.mr_list + #parse aws MR list and delete those MR that are no longer open + for aws_mr in aws_mr_list: + if aws_mr not in self.mr_list: + if mode=="report": + print(aws_mr+' can be deleted from AWS S3') + else : + awspath="MR"+aws_mr+"/" + print('deleting ' + aws_mr) + my_bucket.objects.filter(Prefix=awspath).delete() + @@ -579,6 +603,10 @@ def main(): htmlDash.PostGitNote(mr,commit, args) else: print("Not a Merge Request => this build is for testing/debug purpose, no report to git") + elif sys.argv[1]=="awsclean": + mode=sys.argv[2]#report or delete + htmlDash=Dashboard() + htmlDash.AWSCleanup(mode) else: print("Wrong argument at position 1") diff --git a/ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml b/ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml index 144fcd25a5..8b311cf6ac 100644 --- a/ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml +++ b/ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml @@ -2,7 +2,7 @@ LTE-2x2 : #short name used in the dashboard job : 'RAN-LTE-2x2-Module-OAIEPC' #job name from Jenkins, used in the database link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-LTE-2x2-Module-OAIEPC' bench : 'Obelix-N310-OAIEPC-Quectel(nrmodule2)' - test : 'TDD, 40MHz, MCS9, 26Mb DL, 7Mb UL' + test : 'TM1 + TM2, TDD, 40MHz, MCS9, 26Mb DL, 7Mb UL' NSA-B200 : job : 'RAN-NSA-B200-Module-LTEBOX' link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-NSA-B200-Module-LTEBOX' @@ -18,14 +18,9 @@ SA-N310 : link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-Module-CN5G' bench : 'Asterix-N310-OAICN5G-Quectel(nrmodule2)' test : 'TDD, 40MHz, 60Mb DL, 3Mb UL' -SA-OAIUE-B200 : - job : 'RAN-SA-OAIUE-B200-CN5G' - link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-OAIUE-B200-CN5G/' - bench : 'Asterix-N310-OAICN5G-OAIUE-B200' - test : 'TDD, 40MHz, Ping, (to be implemented : iperf)' -SA-OAIUE-N310 : - job : 'RAN-SA-OAIUE-N310-CN5G' - link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-OAIUE-N310-CN5G/' +SA-OAIUE-N310-X300 : + job : 'RAN-SA-OAIUE-N310-X300-CN5G' + link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-OAIUE-N310-X300-CN5G/' bench : 'Asterix-N310-OAICN5G-OAIUE-N310' test : 'TDD, 40MHz, Ping, (to be implemented : iperf)' diff --git a/ci-scripts/stats_monitor.py b/ci-scripts/stats_monitor.py index e732325fa1..d7cad7ae55 100755 --- a/ci-scripts/stats_monitor.py +++ b/ci-scripts/stats_monitor.py @@ -11,6 +11,7 @@ import pickle import matplotlib.pyplot as plt import numpy as np import yaml +import os class StatMonitor(): @@ -59,18 +60,21 @@ class StatMonitor(): self.d[node_type]['mcs'].append(int(result.group(4))) - def collect(self,node_type): + def collect(self,testcase_id,node_type): if node_type=='enb': files = ["L1_stats.log", "MAC_stats.log", "PDCP_stats.log", "RRC_stats.log"] else: #'gnb' files = ["nrL1_stats.log", "nrMAC_stats.log", "nrPDCP_stats.log", "nrRRC_stats.log"] - # append each file's contents to another file (prepended with CI-) for - # post-mortem/debugging analysis + #append each file's contents to another file (prepended with CI-) for debug for f in files: - cmd = rf'cat {f} >> CI-{f}' - subprocess.Popen(shlex.split(cmd)) - # join the files for further processing - cmd = rf'cat {shlex.join(files)}' + if os.path.isfile(f): + cmd = 'cat '+ f + ' >> CI-'+testcase_id+'-'+f + subprocess.Popen(cmd,shell=True) + #join the files for further processing + cmd='cat ' + for f in files: + if os.path.isfile(f): + cmd += f+' ' process=subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) output = process.stdout.readlines() if node_type=='enb': @@ -79,7 +83,7 @@ class StatMonitor(): self.process_gnb(node_type,output) - def graph(self,node_type): + def graph(self,testcase_id, node_type): for page in self.d[node_type]['graph']:#work out a set a graphs per page col = 1 figure, axis = plt.subplots(len(self.d[node_type]['graph'][page]), col ,figsize=(10, 10)) @@ -110,13 +114,14 @@ class StatMonitor(): plt.tight_layout() #save as png - plt.savefig(node_type+'_stats_monitor_'+page+'.png') + plt.savefig(node_type+'_stats_monitor_'+testcase_id+'_'+page+'.png') if __name__ == "__main__": cfg_filename = sys.argv[1] #yaml file as metrics config - node = sys.argv[2]#enb or gnb + testcase_id = sys.argv[2] #test case id to name files accordingly, especially if we have several tests in a sequence + node = sys.argv[3]#enb or gnb mon=StatMonitor(cfg_filename) #collecting stats when modem process is stopped @@ -124,11 +129,11 @@ if __name__ == "__main__": process=subprocess.Popen(CMD, shell=True, stdout=subprocess.PIPE) output = process.stdout.readlines() while len(output)!=0 : - mon.collect(node) + mon.collect(testcase_id,node) process=subprocess.Popen(CMD, shell=True, stdout=subprocess.PIPE) output = process.stdout.readlines() time.sleep(1) print('Process stopped') with open(node+'_stats_monitor.pickle', 'wb') as handle: pickle.dump(mon.d, handle, protocol=pickle.HIGHEST_PROTOCOL) - mon.graph(node) + mon.graph(testcase_id, node) diff --git a/ci-scripts/xml_files/container_4g_rfsim.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml similarity index 87% rename from ci-scripts/xml_files/container_4g_rfsim.xml rename to ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml index 2466f55800..fd254f1856 100644 --- a/ci-scripts/xml_files/container_4g_rfsim.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml @@ -21,10 +21,9 @@ --> - rfsim-4glte - Testing 4G LTE RF sim - Monolithic eNB + rfsim-4glte-fdd05mhz + Monolithic eNB - FDD 05MHz wrench - 2 100011 000011 @@ -46,7 +45,7 @@ DeployGenObject Deploy Cassandra Database - yaml_files/4g_rfsimulator + yaml_files/4g_rfsimulator_fdd_05MHz cassandra db_init 1 @@ -66,23 +65,23 @@ DeployGenObject Deploy OAI 4G CoreNetwork - yaml_files/4g_rfsimulator + yaml_files/4g_rfsimulator_fdd_05MHz oai_hss oai_mme oai_spgwc oai_spgwu trf_gen 6 DeployGenObject - Deploy OAI 4G eNB RF sim - yaml_files/4g_rfsimulator + Deploy OAI 4G eNB RF sim (FDD 05MHz) + yaml_files/4g_rfsimulator_fdd_05MHz enb 7 DeployGenObject - Deploy OAI 4G NR-UE RF sim - yaml_files/4g_rfsimulator + Deploy OAI 4G NR-UE RF sim (FDD 05MHz) + yaml_files/4g_rfsimulator_fdd_05MHz oai_ue0 8 @@ -124,7 +123,7 @@ UndeployGenObject Undeploy all OAI 4G stack - yaml_files/4g_rfsimulator + yaml_files/4g_rfsimulator_fdd_05MHz diff --git a/ci-scripts/xml_files/container_4g_rfsim_down.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_down.xml similarity index 87% rename from ci-scripts/xml_files/container_4g_rfsim_down.xml rename to ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_down.xml index 651447a9ca..1c3b1d5a7c 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_down.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_down.xml @@ -21,8 +21,8 @@ --> - rfsim-4glte-down - CleanUp 4G RF - Monolithic eNB + rfsim-4glte-fdd05mhz-down + CleanUp 4G RF trash 100011 @@ -32,7 +32,7 @@ UndeployGenObject Undeploy all OAI 4G stack - yaml_files/4g_rfsimulator + yaml_files/4g_rfsimulator_fdd_05MHz diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml new file mode 100644 index 0000000000..2ff9461b93 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml @@ -0,0 +1,109 @@ + + + rfsim-4glte-fdd05mhz-noS1 + Monolithic eNB - FDD 05MHz - noS1 + wrench + + 100011 + 000013 + 000001 + 000014 + 000002 + 020011 + 020012 + 030011 + 030012 + 100011 + + + + + IdleSleep + Sleep + 30 + + + + IdleSleep + Sleep + 10 + + + + DeployGenObject + Deploy OAI 4G eNB RF sim (FDD 05MHz) + yaml_files/4g_rfsimulator_fdd_05MHz_noS1 + enb + 1 + + + + DeployGenObject + Deploy OAI 4G NR-UE RF sim (FDD 05MHz) + yaml_files/4g_rfsimulator_fdd_05MHz_noS1 + oai_ue0 + 2 + + + + PingFromContainer + Ping Traffic-Gen from LTE-UE + rfsim4g-oai-lte-ue0 + -I oaitun_ue1 -c 20 10.0.1.1 + 5 + + + + PingFromContainer + Ping LTE-UE from eNB + rfsim4g-oai-enb + -I oaitun_enb1 -c 20 10.0.1.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim4g-oai-lte-ue0 + rfsim4g-oai-enb + -B 10.0.1.2 -u -i 1 -s + -B 10.0.1.1 -c 10.0.1.2 -u -i 1 -t 30 -b 2M + + + + IperfFromContainer + Iperf UDP Uplink + rfsim4g-oai-enb + rfsim4g-oai-lte-ue0 + -B 10.0.1.1 -u -i 1 -s + -B 10.0.1.2 -c 10.0.1.1 -u -i 1 -t 30 -b 1M + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_05MHz_noS1 + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1_down.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1_down.xml new file mode 100644 index 0000000000..6db1dfd9de --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1_down.xml @@ -0,0 +1,38 @@ + + + rfsim-4glte-fdd05mhz-nos1-down + CleanUp 4G RF + trash + + 100011 + + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_05MHz_noS1 + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml new file mode 100644 index 0000000000..f00e277c36 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml @@ -0,0 +1,129 @@ + + + rfsim-4glte-fdd10mhz + Monolithic eNB - FDD 10MHz + wrench + + 100011 + 000011 + 000001 + 000012 + 000002 + 000013 + 000001 + 000014 + 000002 + 020011 + 020012 + 030011 + 030012 + 100011 + + + + + DeployGenObject + Deploy Cassandra Database + yaml_files/4g_rfsimulator_fdd_10MHz + cassandra db_init + 1 + + + + IdleSleep + Sleep + 30 + + + + IdleSleep + Sleep + 10 + + + + DeployGenObject + Deploy OAI 4G CoreNetwork + yaml_files/4g_rfsimulator_fdd_10MHz + oai_hss oai_mme oai_spgwc oai_spgwu trf_gen + 6 + + + + DeployGenObject + Deploy OAI 4G eNB RF sim (FDD 10MHz) + yaml_files/4g_rfsimulator_fdd_10MHz + enb + 7 + + + + DeployGenObject + Deploy OAI 4G NR-UE RF sim (FDD 10MHz) + yaml_files/4g_rfsimulator_fdd_10MHz + oai_ue0 + 8 + + + + PingFromContainer + Ping Traffic-Gen from LTE-UE + rfsim4g-oai-lte-ue0 + -I oaitun_ue1 -c 20 192.168.61.11 + 5 + + + + PingFromContainer + Ping LTE-UE from Traffic-Gen + rfsim4g-trf-gen + -c 20 12.0.0.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim4g-oai-lte-ue0 + rfsim4g-trf-gen + -B 12.0.0.2 -u -i 1 -s + -c 12.0.0.2 -u -i 1 -t 30 -b 2M + + + + IperfFromContainer + Iperf UDP Uplink + rfsim4g-trf-gen + rfsim4g-oai-lte-ue0 + -u -i 1 -s + -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 1M + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_10MHz + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz_down.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz_down.xml new file mode 100644 index 0000000000..7d03d56ff4 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz_down.xml @@ -0,0 +1,38 @@ + + + rfsim-4glte-fdd10mhz-down + CleanUp 4G RF + trash + + 100011 + + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_10MHz + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml new file mode 100644 index 0000000000..52e1ac7de1 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml @@ -0,0 +1,129 @@ + + + rfsim-4glte-fdd20mhz + Monolithic eNB - FDD 20MHz + wrench + + 100011 + 000011 + 000001 + 000012 + 000002 + 000013 + 000001 + 000014 + 000002 + 020011 + 020012 + 030011 + 030012 + 100011 + + + + + DeployGenObject + Deploy Cassandra Database + yaml_files/4g_rfsimulator_fdd_20MHz + cassandra db_init + 1 + + + + IdleSleep + Sleep + 30 + + + + IdleSleep + Sleep + 10 + + + + DeployGenObject + Deploy OAI 4G CoreNetwork + yaml_files/4g_rfsimulator_fdd_20MHz + oai_hss oai_mme oai_spgwc oai_spgwu trf_gen + 6 + + + + DeployGenObject + Deploy OAI 4G eNB RF sim (FDD 20MHz) + yaml_files/4g_rfsimulator_fdd_20MHz + enb + 7 + + + + DeployGenObject + Deploy OAI 4G NR-UE RF sim (FDD 20MHz) + yaml_files/4g_rfsimulator_fdd_20MHz + oai_ue0 + 8 + + + + PingFromContainer + Ping Traffic-Gen from LTE-UE + rfsim4g-oai-lte-ue0 + -I oaitun_ue1 -c 20 192.168.61.11 + 5 + + + + PingFromContainer + Ping LTE-UE from Traffic-Gen + rfsim4g-trf-gen + -c 20 12.0.0.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim4g-oai-lte-ue0 + rfsim4g-trf-gen + -B 12.0.0.2 -u -i 1 -s + -c 12.0.0.2 -u -i 1 -t 30 -b 2M + + + + IperfFromContainer + Iperf UDP Uplink + rfsim4g-trf-gen + rfsim4g-oai-lte-ue0 + -u -i 1 -s + -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 1M + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_20MHz + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz_down.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz_down.xml new file mode 100644 index 0000000000..0a721c5091 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz_down.xml @@ -0,0 +1,38 @@ + + + rfsim-4glte-fdd20mhz-down + CleanUp 4G RF + trash + + 100011 + + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_fdd_20MHz + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml new file mode 100644 index 0000000000..cdaee430ef --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml @@ -0,0 +1,130 @@ + + + rfsim-4glte-tdd05mhz + Monolithic eNB - TDD 05MHz + wrench + 2 + + 100011 + 000011 + 000001 + 000012 + 000002 + 000013 + 000001 + 000014 + 000002 + 020011 + 020012 + 030011 + 030012 + 100011 + + + + + DeployGenObject + Deploy Cassandra Database + yaml_files/4g_rfsimulator_tdd_05MHz + cassandra db_init + 1 + + + + IdleSleep + Sleep + 30 + + + + IdleSleep + Sleep + 10 + + + + DeployGenObject + Deploy OAI 4G CoreNetwork + yaml_files/4g_rfsimulator_tdd_05MHz + oai_hss oai_mme oai_spgwc oai_spgwu trf_gen + 6 + + + + DeployGenObject + Deploy OAI 4G eNB RF sim (TDD 05MHz) + yaml_files/4g_rfsimulator_tdd_05MHz + enb + 7 + + + + DeployGenObject + Deploy OAI 4G NR-UE RF sim (TDD 05MHz) + yaml_files/4g_rfsimulator_tdd_05MHz + oai_ue0 + 8 + + + + PingFromContainer + Ping Traffic-Gen from LTE-UE + rfsim4g-oai-lte-ue0 + -I oaitun_ue1 -c 20 192.168.61.11 + 5 + + + + PingFromContainer + Ping LTE-UE from Traffic-Gen + rfsim4g-trf-gen + -c 20 12.0.0.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim4g-oai-lte-ue0 + rfsim4g-trf-gen + -B 12.0.0.2 -u -i 1 -s + -c 12.0.0.2 -u -i 1 -t 30 -b 2M + + + + IperfFromContainer + Iperf UDP Uplink + rfsim4g-trf-gen + rfsim4g-oai-lte-ue0 + -u -i 1 -s + -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 1M + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_tdd_05MHz + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz_down.xml b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz_down.xml new file mode 100644 index 0000000000..7e27bac73c --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz_down.xml @@ -0,0 +1,38 @@ + + + rfsim-4glte-tdd05mhz-down + CleanUp 4G RF + trash + + 100011 + + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator_tdd_05MHz + + + diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 5c53bf5eed..2476a75427 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -36,6 +36,7 @@ 000002 070000 070001 + 070002 000001 010002 080001 @@ -132,6 +133,16 @@ single-ue + + Iperf + iperf (BIDIR TCP)(10 sec)(single-ue profile) + -t 10 --bidir + BIDIR + nrmodule2_quectel + single-ue + + + Terminate_eNB diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml index 55852ad79b..bfa2208d3d 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml @@ -42,7 +42,7 @@ Initialize_OAI_UE Initialize OAI UE (N310) nr - --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=192.168.18.241,second_addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time + --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=192.168.18.241,addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 28c6b2e9e0..8d15015c07 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -31,10 +31,15 @@ 010000 000001 050000 + 000001 050001 + 000001 070000 + 000001 070001 000001 + 070002 + 000001 010002 080000 @@ -58,7 +63,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time + -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --T_stdout 2 --log_config.global_log_options level,nocolor,time 0 0 nr @@ -83,7 +88,7 @@ Ping - Ping: 20pings in 20sec + Ping: 40pings in 40sec nrmodule2_quectel -c 40 1 @@ -121,6 +126,15 @@ single-ue + + Iperf + iperf (BIDIR TCP)(10 sec)(single-ue profile) + -t 10 --bidir + BIDIR + nrmodule2_quectel + single-ue + + Terminate_eNB diff --git a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml index 696ec790ff..23cc6d25b8 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml @@ -22,18 +22,21 @@ --> TEST-SA-FR1-Tab3 - SA Ping DL UL with QUECTEL + SA 162PRB tasks 1 - 040000 + 042000 000002 010000 000001 - 050000 - 050001 - 070000 - 070001 + 052000 + 000001 + 072000 + 000001 + 072001 + 000001 + 072002 000001 010002 080000 @@ -55,7 +58,7 @@ - + Initialize_eNB Initialize gNB -O ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time @@ -81,39 +84,44 @@ - + Ping - Ping: 20pings in 20sec + Ping: 40pings in 40sec nrmodule2_quectel - -c 20 - 5 + -c 40 + 1 + 20 - - Ping - Ping: 100pings in 20sec - nrmodule2_quectel - -c 100 -i 0,2 - 5 - - + Iperf iperf (DL/140Mbps/UDP)(60 sec)(single-ue profile) -u -b 140M -t 60 DL nrmodule2_quectel - 5 + 50 + 50 single-ue - + Iperf iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) -u -b 3M -t 60 UL nrmodule2_quectel 5 + 95 + single-ue + + + + Iperf + iperf (BIDIR TCP)(10 sec)(single-ue profile) + -t 10 --bidir + BIDIR + nrmodule2_quectel single-ue diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml index edc4440612..3e497ede13 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml @@ -26,28 +26,28 @@ tasks 1 - 040000 + 041000 000002 - 010000 + 011000 000001 - 050000 + 051000 000001 - 070000 + 071000 000001 - 070001 + 071001 000001 - 070002 + 071002 000001 - 070003 + 071003 000001 - 070004 + 071004 000001 - 010002 - 080000 + 011002 + 081000 - + Initialize_UE Initialize Quectel nrmodule2_quectel @@ -55,14 +55,14 @@ - + Terminate_UE Terminate Quectel nrmodule2_quectel - + Initialize_eNB Initialize gNB -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf --sa -q --usrp-tx-thread-config 1 --log_config.global_log_options level,nocolor,time @@ -88,9 +88,9 @@ - + Ping - Ping: 20pings in 20sec + Ping: 40pings in 40sec nrmodule2_quectel -c 40 1 @@ -98,7 +98,7 @@ - + Iperf iperf (DL/10Mbps/UDP)(30 sec)(single-ue profile) -u -b 10M -t 30 @@ -108,7 +108,7 @@ 95 single-ue - + Iperf iperf (DL/20Mbps/UDP)(30 sec)(single-ue profile) -u -b 20M -t 30 @@ -118,7 +118,7 @@ 95 single-ue - + Iperf iperf (DL/40Mbps/UDP)(30 sec)(single-ue profile) -u -b 40M -t 30 @@ -128,7 +128,7 @@ 95 single-ue - + Iperf iperf (DL/60Mbps/UDP)(30 sec)(single-ue profile) -u -b 60M -t 30 @@ -138,20 +138,20 @@ 95 single-ue - + Iperf iperf (DL/90Mbps/UDP)(30 sec)(single-ue profile) -u -b 90M -t 30 DL nrmodule2_quectel - 5 - 95 + 10 + 90 single-ue - + Terminate_eNB Terminate gNB 0 diff --git a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml index 6cb7b2883b..11c4abce1b 100644 --- a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml @@ -96,7 +96,7 @@ nrmodule2_quectel -c 100 -s 1024 -i 0,2 1 - 30 + 40 diff --git a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml index fcc772b8f4..714cf51a9b 100644 --- a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml @@ -96,14 +96,14 @@ nrmodule2_quectel -c 100 -s 1024 -i 0,2 1 - 30 + 40 Iperf - iperf (DL/26Mbps/UDP)(60 sec)(single-ue profile) - -u -b 26M -t 60 + iperf (DL/1Mbps/UDP)(60 sec)(single-ue profile) + -u -b 1M -t 60 DL nrmodule2_quectel 5 diff --git a/ci-scripts/yaml_files/4g_rfsimulator/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md similarity index 100% rename from ci-scripts/yaml_files/4g_rfsimulator/README.md rename to ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md diff --git a/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml similarity index 100% rename from ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml rename to ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml diff --git a/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/oai_db.cql similarity index 100% rename from ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql rename to ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/oai_db.cql diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml new file mode 100644 index 0000000000..6e3916b8ca --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml @@ -0,0 +1,75 @@ +version: '3.8' + +services: + enb: + image: oai-enb:develop + privileged: true + container_name: rfsim4g-oai-enb + networks: + public_net: + ipv4_address: 192.168.61.20 + environment: + TZ: Europe/Paris + USE_FDD_MONO: 'yes' + RFSIMULATOR: enb + ENB_NAME: eNB-rf-sim + MCC: '208' + MNC: '96' + MNC_LENGTH: 2 + TAC: 1 + UTRA_BAND_ID: 7 + DL_FREQUENCY_IN_MHZ: 2680 + UL_FREQUENCY_OFFSET_IN_MHZ: 120 + NID_CELL: 10 + NB_PRB: 25 + MME_S1C_IP_ADDRESS: 192.168.61.3 + ENB_S1C_IF_NAME: eth0 + ENB_S1C_IP_ADDRESS: 192.168.61.20 + ENB_S1U_IF_NAME: eth0 + ENB_S1U_IP_ADDRESS: 192.168.61.20 + ENB_X2_IP_ADDRESS: 192.168.61.20 + FLEXRAN_ENABLED: 'no' + FLEXRAN_INTERFACE_NAME: eth0 + FLEXRAN_IPV4_ADDRESS: 192.168.61.10 + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1 + healthcheck: + test: /bin/bash -c "pgrep lte-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_ue0: + image: oai-lte-ue:develop + privileged: true + container_name: rfsim4g-oai-lte-ue0 + networks: + public_net: + ipv4_address: 192.168.61.30 + expose: + - "10000" + environment: + TZ: Europe/Paris + HOSTNAME: oai_ue0 + RFSIMULATOR: 192.168.61.20 + MCC: '208' + MNC: '96' + SHORT_IMSI: '0100000001' + LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'c42449363bbad02b66d16bc975d77cc1' + MSISDN: '001011234561010' + HPLMN: 20896 + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --log_config.global_log_options level,nocolor,time --noS1 + healthcheck: + test: /bin/bash -c "pgrep lte-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + +networks: + public_net: + name: rfsim4g-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-public" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml new file mode 100644 index 0000000000..4c1ceb424a --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -0,0 +1,272 @@ +version: '3.8' + +services: + cassandra: + image: cassandra:2.1 + container_name: rfsim4g-cassandra + networks: + private_net: + ipv4_address: 192.168.68.2 + environment: + CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster" + CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch + healthcheck: + test: /bin/bash -c "nodetool status" + interval: 10s + timeout: 5s + retries: 5 + + db_init: + image: cassandra:2.1 + container_name: rfsim4g-db-init + depends_on: [cassandra] + deploy: + restart_policy: + condition: on-failure + max_attempts: 10 + networks: + private_net: + ipv4_address: 192.168.68.4 + volumes: + - ../4g_rfsimulator_fdd_05MHz/oai_db.cql:/home/oai_db.cql + entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" + + oai_hss: + image: oai-hss:latest + container_name: rfsim4g-oai-hss + privileged: true + depends_on: [cassandra] + networks: + private_net: + ipv4_address: 192.168.68.3 + public_net: + ipv4_address: 192.168.61.2 + environment: + REALM: openairinterface.org + HSS_FQDN: hss.openairinterface.org + PREFIX: /openair-hss/etc + cassandra_Server_IP: 192.168.68.2 + OP_KEY: 1006020f0a478bf6b699f15c062e42b3 + LTE_K: fec86ba6eb707ed08905757b1bb44b8f + APN1: oai.ipv4 + APN2: internet + FIRST_IMSI: 208960100000001 + NB_USERS: 10 + healthcheck: + test: /bin/bash -c "pgrep oai_hss" + interval: 10s + timeout: 5s + retries: 5 + + oai_mme: + image: oai-mme:latest + container_name: rfsim4g-oai-mme + privileged: true + depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.3 + environment: + REALM: openairinterface.org + PREFIX: /openair-mme/etc + INSTANCE: 1 + PID_DIRECTORY: /var/run + HSS_IP_ADDR: 192.168.61.2 + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org + MCC: '208' + MNC: '96' + MME_GID: 32768 + MME_CODE: 3 + TAC_0: 1 + TAC_1: 2 + TAC_2: 3 + MME_FQDN: mme.openairinterface.org + MME_S6A_IP_ADDR: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S1_MME: eth0 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S11: eth0 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S10: lo + MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 + OUTPUT: CONSOLE + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 + PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 + MCC_SGW_0: '208' + MNC3_SGW_0: '096' + TAC_LB_SGW_0: '01' + TAC_HB_SGW_0: '00' + MCC_MME_0: '208' + MNC3_MME_0: '096' + TAC_LB_MME_0: '02' + TAC_HB_MME_0: '00' + MCC_MME_1: '208' + MNC3_MME_1: '096' + TAC_LB_MME_1: '03' + TAC_HB_MME_1: '00' + TAC_LB_SGW_TEST_0: '03' + TAC_HB_SGW_TEST_0: '00' + SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + healthcheck: + test: /bin/bash -c "pgrep oai_mme" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwc: + image: oai-spgwc:latest + privileged: true + depends_on: [oai_mme] + container_name: rfsim4g-oai-spgwc + networks: + public_net: + ipv4_address: 192.168.61.4 + environment: + TZ: Europe/Paris + SGW_INTERFACE_NAME_FOR_S11: eth0 + PGW_INTERFACE_NAME_FOR_SX: eth0 + DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 + PUSH_PROTOCOL_OPTION: 'true' + APN_NI_1: oai.ipv4 + APN_NI_2: oai.ipv4_2 + DEFAULT_APN_NI_1: oai.ipv4 + UE_IP_ADDRESS_POOL_1: '12.0.0.2 - 12.0.0.254' + UE_IP_ADDRESS_POOL_2: '12.1.1.2 - 12.1.1.254' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwc" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwu: + image: oai-spgwu-tiny:latest + privileged: true + container_name: rfsim4g-oai-spgwu-tiny + depends_on: [oai_spgwc] + networks: + public_net: + ipv4_address: 192.168.61.5 + environment: + TZ: Europe/Paris + PID_DIRECTORY: /var/run + INSTANCE: 1 + SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 + PGW_INTERFACE_NAME_FOR_SGI: eth0 + SGW_INTERFACE_NAME_FOR_SX: eth0 + SPGWC0_IP_ADDRESS: 192.168.61.4 + NETWORK_UE_IP: '12.0.0.0/24' + NETWORK_UE_NAT_OPTION: 'yes' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwu" + interval: 10s + timeout: 5s + retries: 5 + + trf_gen: + image: trf-gen:production + privileged: true + container_name: rfsim4g-trf-gen + networks: + public_net: + ipv4_address: 192.168.61.11 + entrypoint: /bin/bash -c "ip route add 12.0.0.0/24 via 192.168.61.5 dev eth0; sleep infinity" + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.61.5" + interval: 10s + timeout: 5s + retries: 5 + + enb: + image: oai-enb:develop + privileged: true + container_name: rfsim4g-oai-enb + networks: + public_net: + ipv4_address: 192.168.61.20 + environment: + TZ: Europe/Paris + USE_FDD_MONO: 'yes' + RFSIMULATOR: enb + ENB_NAME: eNB-rf-sim + MCC: '208' + MNC: '96' + MNC_LENGTH: 2 + TAC: 1 + UTRA_BAND_ID: 7 + DL_FREQUENCY_IN_MHZ: 2680 + UL_FREQUENCY_OFFSET_IN_MHZ: 120 + NID_CELL: 10 + NB_PRB: 50 + MME_S1C_IP_ADDRESS: 192.168.61.3 + ENB_S1C_IF_NAME: eth0 + ENB_S1C_IP_ADDRESS: 192.168.61.20 + ENB_S1U_IF_NAME: eth0 + ENB_S1U_IP_ADDRESS: 192.168.61.20 + ENB_X2_IP_ADDRESS: 192.168.61.20 + FLEXRAN_ENABLED: 'no' + FLEXRAN_INTERFACE_NAME: eth0 + FLEXRAN_IPV4_ADDRESS: 192.168.61.10 + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_ue0: + image: oai-lte-ue:develop + privileged: true + container_name: rfsim4g-oai-lte-ue0 + networks: + public_net: + ipv4_address: 192.168.61.30 + expose: + - "10000" + environment: + TZ: Europe/Paris + HOSTNAME: oai_ue0 + RFSIMULATOR: 192.168.61.20 + MCC: '208' + MNC: '96' + SHORT_IMSI: '0100000001' + LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'c42449363bbad02b66d16bc975d77cc1' + MSISDN: '001011234561010' + HPLMN: 20896 + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 50 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + +networks: + private_net: + name: rfsim4g-oai-private-net + ipam: + config: + - subnet: 192.168.68.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-private" + public_net: + name: rfsim4g-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-public" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml new file mode 100644 index 0000000000..4a61181afb --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -0,0 +1,272 @@ +version: '3.8' + +services: + cassandra: + image: cassandra:2.1 + container_name: rfsim4g-cassandra + networks: + private_net: + ipv4_address: 192.168.68.2 + environment: + CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster" + CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch + healthcheck: + test: /bin/bash -c "nodetool status" + interval: 10s + timeout: 5s + retries: 5 + + db_init: + image: cassandra:2.1 + container_name: rfsim4g-db-init + depends_on: [cassandra] + deploy: + restart_policy: + condition: on-failure + max_attempts: 10 + networks: + private_net: + ipv4_address: 192.168.68.4 + volumes: + - ../4g_rfsimulator_fdd_05MHz/oai_db.cql:/home/oai_db.cql + entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" + + oai_hss: + image: oai-hss:latest + container_name: rfsim4g-oai-hss + privileged: true + depends_on: [cassandra] + networks: + private_net: + ipv4_address: 192.168.68.3 + public_net: + ipv4_address: 192.168.61.2 + environment: + REALM: openairinterface.org + HSS_FQDN: hss.openairinterface.org + PREFIX: /openair-hss/etc + cassandra_Server_IP: 192.168.68.2 + OP_KEY: 1006020f0a478bf6b699f15c062e42b3 + LTE_K: fec86ba6eb707ed08905757b1bb44b8f + APN1: oai.ipv4 + APN2: internet + FIRST_IMSI: 208960100000001 + NB_USERS: 10 + healthcheck: + test: /bin/bash -c "pgrep oai_hss" + interval: 10s + timeout: 5s + retries: 5 + + oai_mme: + image: oai-mme:latest + container_name: rfsim4g-oai-mme + privileged: true + depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.3 + environment: + REALM: openairinterface.org + PREFIX: /openair-mme/etc + INSTANCE: 1 + PID_DIRECTORY: /var/run + HSS_IP_ADDR: 192.168.61.2 + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org + MCC: '208' + MNC: '96' + MME_GID: 32768 + MME_CODE: 3 + TAC_0: 1 + TAC_1: 2 + TAC_2: 3 + MME_FQDN: mme.openairinterface.org + MME_S6A_IP_ADDR: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S1_MME: eth0 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S11: eth0 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S10: lo + MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 + OUTPUT: CONSOLE + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 + PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 + MCC_SGW_0: '208' + MNC3_SGW_0: '096' + TAC_LB_SGW_0: '01' + TAC_HB_SGW_0: '00' + MCC_MME_0: '208' + MNC3_MME_0: '096' + TAC_LB_MME_0: '02' + TAC_HB_MME_0: '00' + MCC_MME_1: '208' + MNC3_MME_1: '096' + TAC_LB_MME_1: '03' + TAC_HB_MME_1: '00' + TAC_LB_SGW_TEST_0: '03' + TAC_HB_SGW_TEST_0: '00' + SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + healthcheck: + test: /bin/bash -c "pgrep oai_mme" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwc: + image: oai-spgwc:latest + privileged: true + depends_on: [oai_mme] + container_name: rfsim4g-oai-spgwc + networks: + public_net: + ipv4_address: 192.168.61.4 + environment: + TZ: Europe/Paris + SGW_INTERFACE_NAME_FOR_S11: eth0 + PGW_INTERFACE_NAME_FOR_SX: eth0 + DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 + PUSH_PROTOCOL_OPTION: 'true' + APN_NI_1: oai.ipv4 + APN_NI_2: oai.ipv4_2 + DEFAULT_APN_NI_1: oai.ipv4 + UE_IP_ADDRESS_POOL_1: '12.0.0.2 - 12.0.0.254' + UE_IP_ADDRESS_POOL_2: '12.1.1.2 - 12.1.1.254' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwc" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwu: + image: oai-spgwu-tiny:latest + privileged: true + container_name: rfsim4g-oai-spgwu-tiny + depends_on: [oai_spgwc] + networks: + public_net: + ipv4_address: 192.168.61.5 + environment: + TZ: Europe/Paris + PID_DIRECTORY: /var/run + INSTANCE: 1 + SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 + PGW_INTERFACE_NAME_FOR_SGI: eth0 + SGW_INTERFACE_NAME_FOR_SX: eth0 + SPGWC0_IP_ADDRESS: 192.168.61.4 + NETWORK_UE_IP: '12.0.0.0/24' + NETWORK_UE_NAT_OPTION: 'yes' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwu" + interval: 10s + timeout: 5s + retries: 5 + + trf_gen: + image: trf-gen:production + privileged: true + container_name: rfsim4g-trf-gen + networks: + public_net: + ipv4_address: 192.168.61.11 + entrypoint: /bin/bash -c "ip route add 12.0.0.0/24 via 192.168.61.5 dev eth0; sleep infinity" + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.61.5" + interval: 10s + timeout: 5s + retries: 5 + + enb: + image: oai-enb:develop + privileged: true + container_name: rfsim4g-oai-enb + networks: + public_net: + ipv4_address: 192.168.61.20 + environment: + TZ: Europe/Paris + USE_FDD_MONO: 'yes' + RFSIMULATOR: enb + ENB_NAME: eNB-rf-sim + MCC: '208' + MNC: '96' + MNC_LENGTH: 2 + TAC: 1 + UTRA_BAND_ID: 7 + DL_FREQUENCY_IN_MHZ: 2680 + UL_FREQUENCY_OFFSET_IN_MHZ: 120 + NID_CELL: 10 + NB_PRB: 100 + MME_S1C_IP_ADDRESS: 192.168.61.3 + ENB_S1C_IF_NAME: eth0 + ENB_S1C_IP_ADDRESS: 192.168.61.20 + ENB_S1U_IF_NAME: eth0 + ENB_S1U_IP_ADDRESS: 192.168.61.20 + ENB_X2_IP_ADDRESS: 192.168.61.20 + FLEXRAN_ENABLED: 'no' + FLEXRAN_INTERFACE_NAME: eth0 + FLEXRAN_IPV4_ADDRESS: 192.168.61.10 + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_ue0: + image: oai-lte-ue:develop + privileged: true + container_name: rfsim4g-oai-lte-ue0 + networks: + public_net: + ipv4_address: 192.168.61.30 + expose: + - "10000" + environment: + TZ: Europe/Paris + HOSTNAME: oai_ue0 + RFSIMULATOR: 192.168.61.20 + MCC: '208' + MNC: '96' + SHORT_IMSI: '0100000001' + LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'c42449363bbad02b66d16bc975d77cc1' + MSISDN: '001011234561010' + HPLMN: 20896 + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 100 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + +networks: + private_net: + name: rfsim4g-oai-private-net + ipam: + config: + - subnet: 192.168.68.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-private" + public_net: + name: rfsim4g-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-public" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml new file mode 100644 index 0000000000..3424780791 --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -0,0 +1,271 @@ +version: '3.8' + +services: + cassandra: + image: cassandra:2.1 + container_name: rfsim4g-cassandra + networks: + private_net: + ipv4_address: 192.168.68.2 + environment: + CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster" + CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch + healthcheck: + test: /bin/bash -c "nodetool status" + interval: 10s + timeout: 5s + retries: 5 + + db_init: + image: cassandra:2.1 + container_name: rfsim4g-db-init + depends_on: [cassandra] + deploy: + restart_policy: + condition: on-failure + max_attempts: 10 + networks: + private_net: + ipv4_address: 192.168.68.4 + volumes: + - ../4g_rfsimulator_fdd_05MHz/oai_db.cql:/home/oai_db.cql + entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" + + oai_hss: + image: oai-hss:latest + container_name: rfsim4g-oai-hss + privileged: true + depends_on: [cassandra] + networks: + private_net: + ipv4_address: 192.168.68.3 + public_net: + ipv4_address: 192.168.61.2 + environment: + REALM: openairinterface.org + HSS_FQDN: hss.openairinterface.org + PREFIX: /openair-hss/etc + cassandra_Server_IP: 192.168.68.2 + OP_KEY: 1006020f0a478bf6b699f15c062e42b3 + LTE_K: fec86ba6eb707ed08905757b1bb44b8f + APN1: oai.ipv4 + APN2: internet + FIRST_IMSI: 208960100000001 + NB_USERS: 10 + healthcheck: + test: /bin/bash -c "pgrep oai_hss" + interval: 10s + timeout: 5s + retries: 5 + + oai_mme: + image: oai-mme:latest + container_name: rfsim4g-oai-mme + privileged: true + depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.3 + environment: + REALM: openairinterface.org + PREFIX: /openair-mme/etc + INSTANCE: 1 + PID_DIRECTORY: /var/run + HSS_IP_ADDR: 192.168.61.2 + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org + MCC: '208' + MNC: '96' + MME_GID: 32768 + MME_CODE: 3 + TAC_0: 1 + TAC_1: 2 + TAC_2: 3 + MME_FQDN: mme.openairinterface.org + MME_S6A_IP_ADDR: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S1_MME: eth0 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S11: eth0 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S10: lo + MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 + OUTPUT: CONSOLE + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 + PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 + MCC_SGW_0: '208' + MNC3_SGW_0: '096' + TAC_LB_SGW_0: '01' + TAC_HB_SGW_0: '00' + MCC_MME_0: '208' + MNC3_MME_0: '096' + TAC_LB_MME_0: '02' + TAC_HB_MME_0: '00' + MCC_MME_1: '208' + MNC3_MME_1: '096' + TAC_LB_MME_1: '03' + TAC_HB_MME_1: '00' + TAC_LB_SGW_TEST_0: '03' + TAC_HB_SGW_TEST_0: '00' + SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + healthcheck: + test: /bin/bash -c "pgrep oai_mme" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwc: + image: oai-spgwc:latest + privileged: true + depends_on: [oai_mme] + container_name: rfsim4g-oai-spgwc + networks: + public_net: + ipv4_address: 192.168.61.4 + environment: + TZ: Europe/Paris + SGW_INTERFACE_NAME_FOR_S11: eth0 + PGW_INTERFACE_NAME_FOR_SX: eth0 + DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 + PUSH_PROTOCOL_OPTION: 'true' + APN_NI_1: oai.ipv4 + APN_NI_2: oai.ipv4_2 + DEFAULT_APN_NI_1: oai.ipv4 + UE_IP_ADDRESS_POOL_1: '12.0.0.2 - 12.0.0.254' + UE_IP_ADDRESS_POOL_2: '12.1.1.2 - 12.1.1.254' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwc" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwu: + image: oai-spgwu-tiny:latest + privileged: true + container_name: rfsim4g-oai-spgwu-tiny + depends_on: [oai_spgwc] + networks: + public_net: + ipv4_address: 192.168.61.5 + environment: + TZ: Europe/Paris + PID_DIRECTORY: /var/run + INSTANCE: 1 + SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 + PGW_INTERFACE_NAME_FOR_SGI: eth0 + SGW_INTERFACE_NAME_FOR_SX: eth0 + SPGWC0_IP_ADDRESS: 192.168.61.4 + NETWORK_UE_IP: '12.0.0.0/24' + NETWORK_UE_NAT_OPTION: 'yes' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwu" + interval: 10s + timeout: 5s + retries: 5 + + trf_gen: + image: trf-gen:production + privileged: true + container_name: rfsim4g-trf-gen + networks: + public_net: + ipv4_address: 192.168.61.11 + entrypoint: /bin/bash -c "ip route add 12.0.0.0/24 via 192.168.61.5 dev eth0; sleep infinity" + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.61.5" + interval: 10s + timeout: 5s + retries: 5 + + enb: + image: oai-enb:develop + privileged: true + container_name: rfsim4g-oai-enb + networks: + public_net: + ipv4_address: 192.168.61.20 + environment: + TZ: Europe/Paris + USE_TDD_MONO: 'yes' + RFSIMULATOR: enb + ENB_NAME: eNB-rf-sim + MCC: '208' + MNC: '96' + MNC_LENGTH: 2 + TAC: 1 + UTRA_BAND_ID: 38 + DL_FREQUENCY_IN_MHZ: 2605 + UL_FREQUENCY_OFFSET_IN_MHZ: 0 + NID_CELL: 10 + NB_PRB: 25 + MME_S1C_IP_ADDRESS: 192.168.61.3 + S1C_IF_NAME: eth0 + F1_CU_IP_ADDRESS: 192.168.61.20 + S1U_IF_NAME: eth0 + F1_CU_IP_ADDRESS: 192.168.61.20 + FLEXRAN_ENABLED: 'no' + FLEXRAN_INTERFACE_NAME: eth0 + FLEXRAN_IPV4_ADDRESS: 192.168.61.10 + USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_ue0: + image: oai-lte-ue:develop + privileged: true + container_name: rfsim4g-oai-lte-ue0 + networks: + public_net: + ipv4_address: 192.168.61.30 + expose: + - "10000" + environment: + TZ: Europe/Paris + HOSTNAME: oai_ue0 + RFSIMULATOR: 192.168.61.20 + MCC: '208' + MNC: '96' + SHORT_IMSI: '0100000001' + LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'c42449363bbad02b66d16bc975d77cc1' + MSISDN: '001011234561010' + HPLMN: 20896 + USE_ADDITIONAL_OPTIONS: --rfsim -T -C 2605000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --log_config.global_log_options level,nocolor,time + healthcheck: + test: /bin/bash -c "pgrep lte-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + +networks: + private_net: + name: rfsim4g-oai-private-net + ipam: + config: + - subnet: 192.168.68.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-private" + public_net: + name: rfsim4g-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 + driver_opts: + com.docker.network.bridge.name: "rfsim4g-public" diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index eb15aef0d8..6a39f2147e 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -111,7 +111,6 @@ services: oai-smf: container_name: "rfsim5g-oai-smf" image: oai-smf:latest - entrypoint: /bin/bash -c "/openair-smf/bin/oai_smf -c /openair-smf/bin/oai-smf.conf -o" environment: - TZ=Europe/Paris - INSTANCE=0 @@ -140,12 +139,13 @@ services: - REGISTER_NRF=yes - DISCOVER_UPF=yes - USE_FQDN_DNS=yes + - DNN_NI0=oai + - DNN_NI2=oai.ipv4 depends_on: - oai-nrf - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf healthcheck: test: /bin/bash -c "/openair-smf/bin/smf-healthcheck.sh" interval: 10s diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf deleted file mode 100644 index 0c83ab8be9..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf +++ /dev/null @@ -1,133 +0,0 @@ -################################################################################ -# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The OpenAirInterface Software Alliance licenses this file to You under -# the OAI Public License, Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.openairinterface.org/?page_id=698 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# For more information about the OpenAirInterface (OAI) Software Alliance: -# contact@openairinterface.org -################################################################################ - -SMF = -{ - FQDN = "oai-smf-svc"; - INSTANCE = 0; # 0 is the default - PID_DIRECTORY = "/var/run"; # /var/run is the default - - INTERFACES : - { - N4 : - { - # SMF binded interface for N4 communication (UPF) - INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE - IPV4_ADDRESS = "read"; - }; - - SBI : - { - # SMF binded interface for SBI interface (e.g., communication with AMF, UDM) - INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE - IPV4_ADDRESS = "read"; - PORT = 80; # YOUR NETWORK CONFIG HERE (default: 80) - HTTP2_PORT = 9090; # YOUR NETWORK CONFIG HERE - API_VERSION = "v1"; # YOUR SMF API VERSION CONFIG HERE - }; - - }; - - - # Pool of UE assigned IP addresses - # Do not make IP pools overlap - # first IPv4 address X.Y.Z.1 is reserved for GTP network device on UPF - IP_ADDRESS_POOL : - { - IPV4_LIST = ( - {RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - {RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - {RANGE = "10.10.10.2 - 10.10.10.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - - ); - IPV6_LIST = ( - {PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - {PREFIX = "3001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - {PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - ); - }; - - DNN_LIST = ( - # IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6} - {DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}, - {DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, - {DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1} - ); - - # DNS address communicated to UEs - DEFAULT_DNS_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE - - SUPPORT_FEATURES: - { - # STRING, {"yes", "no"}, - REGISTER_NRF = "yes"; # Set to yes if SMF resgisters to an NRF - DISCOVER_UPF = "yes"; # Set to yes to enable UPF discovery and selection - FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # Non standard feature, normally should be set to "no", - # but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling - USE_LOCAL_SUBSCRIPTION_INFO = "yes"; # Set to yes if SMF uses local subscription information instead of from an UDM - USE_FQDN_DNS = "yes"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN - } - - AMF : - { - IPV4_ADDRESS = "0.0.0.0"; # YOUR AMF CONFIG HERE - PORT = 80; # YOUR AMF CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR AMF API VERSION FOR SBI CONFIG HERE - FQDN = "oai-amf" # YOUR AMF FQDN CONFIG HERE - }; - - UDM : - { - IPV4_ADDRESS = "127.0.0.1"; # YOUR UDM CONFIG HERE - PORT = 80; # YOUR UDM CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR UDM API VERSION FOR SBI CONFIG HERE - FQDN = "localhost" # YOUR UDM FQDN CONFIG HERE - }; - - NRF : - { - IPV4_ADDRESS = "192.168.71.130"; # YOUR NRF CONFIG HERE - PORT = 80; # YOUR NRF CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR NRF API VERSION FOR SBI CONFIG HERE - FQDN = "oai-nrf" # YOUR NRF FQDN CONFIG HERE - }; - - UPF_LIST = ( - {IPV4_ADDRESS = "192.168.71.134" ; FQDN = "oai-spgwu"} # YOUR UPF CONFIG HERE - ); - - LOCAL_CONFIGURATION : - { - SESSION_MANAGEMENT_SUBSCRIPTION_LIST = ( - { NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, - QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", - QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"}, - { NSSAI_SST = 1; NSSAI_SD = "1", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, - QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", - QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"} - ); - }; - -}; - diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 5c384b3202..fc562dd1eb 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -14,7 +14,7 @@ This page is only valid for an `Ubuntu18` host. -**NOTE: this version (2021-10-05) is valid for the `v1.1.0` and `v1.2.0` versions of the `OAI 5G CN`.** +**NOTE: this version (2022-01-27) has been updated for the `v1.3.0` version of the `OAI 5G CN`.** **TABLE OF CONTENTS** @@ -76,9 +76,9 @@ $ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop $ docker logout ``` -**CAUTION: 2021/10/05 with the release `v1.2.0` of the `CN5G`, the previous version was not compatible any-more.** +**CAUTION: 2022/01/27 with the release `v1.3.0` of the `CN5G`, the previous version was not compatible any-more.** -**This new version is working for both the `v1.1.0` and `v1.2.0` of the `CN5G`.** +**This new version is working only with the `v1.3.0` of the `CN5G`.** # 2. Deploy containers # diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 952da8087d..f0476b0a1e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -111,7 +111,6 @@ services: oai-smf: container_name: "rfsim5g-oai-smf" image: oai-smf:latest - entrypoint: /bin/bash -c "/openair-smf/bin/oai_smf -c /openair-smf/bin/oai-smf.conf -o" environment: - TZ=Europe/Paris - INSTANCE=0 @@ -140,12 +139,13 @@ services: - REGISTER_NRF=yes - DISCOVER_UPF=yes - USE_FQDN_DNS=yes + - DNN_NI0=oai + - DNN_NI2=oai.ipv4 depends_on: - oai-nrf - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf healthcheck: test: /bin/bash -c "/openair-smf/bin/smf-healthcheck.sh" interval: 10s diff --git a/ci-scripts/yaml_files/5g_rfsimulator/oai-smf.conf b/ci-scripts/yaml_files/5g_rfsimulator/oai-smf.conf deleted file mode 100644 index 0c83ab8be9..0000000000 --- a/ci-scripts/yaml_files/5g_rfsimulator/oai-smf.conf +++ /dev/null @@ -1,133 +0,0 @@ -################################################################################ -# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The OpenAirInterface Software Alliance licenses this file to You under -# the OAI Public License, Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.openairinterface.org/?page_id=698 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# For more information about the OpenAirInterface (OAI) Software Alliance: -# contact@openairinterface.org -################################################################################ - -SMF = -{ - FQDN = "oai-smf-svc"; - INSTANCE = 0; # 0 is the default - PID_DIRECTORY = "/var/run"; # /var/run is the default - - INTERFACES : - { - N4 : - { - # SMF binded interface for N4 communication (UPF) - INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE - IPV4_ADDRESS = "read"; - }; - - SBI : - { - # SMF binded interface for SBI interface (e.g., communication with AMF, UDM) - INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE - IPV4_ADDRESS = "read"; - PORT = 80; # YOUR NETWORK CONFIG HERE (default: 80) - HTTP2_PORT = 9090; # YOUR NETWORK CONFIG HERE - API_VERSION = "v1"; # YOUR SMF API VERSION CONFIG HERE - }; - - }; - - - # Pool of UE assigned IP addresses - # Do not make IP pools overlap - # first IPv4 address X.Y.Z.1 is reserved for GTP network device on UPF - IP_ADDRESS_POOL : - { - IPV4_LIST = ( - {RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - {RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - {RANGE = "10.10.10.2 - 10.10.10.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. - - ); - IPV6_LIST = ( - {PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - {PREFIX = "3001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - {PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. - ); - }; - - DNN_LIST = ( - # IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6} - {DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}, - {DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, - {DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1} - ); - - # DNS address communicated to UEs - DEFAULT_DNS_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE - DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE - - SUPPORT_FEATURES: - { - # STRING, {"yes", "no"}, - REGISTER_NRF = "yes"; # Set to yes if SMF resgisters to an NRF - DISCOVER_UPF = "yes"; # Set to yes to enable UPF discovery and selection - FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # Non standard feature, normally should be set to "no", - # but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling - USE_LOCAL_SUBSCRIPTION_INFO = "yes"; # Set to yes if SMF uses local subscription information instead of from an UDM - USE_FQDN_DNS = "yes"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN - } - - AMF : - { - IPV4_ADDRESS = "0.0.0.0"; # YOUR AMF CONFIG HERE - PORT = 80; # YOUR AMF CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR AMF API VERSION FOR SBI CONFIG HERE - FQDN = "oai-amf" # YOUR AMF FQDN CONFIG HERE - }; - - UDM : - { - IPV4_ADDRESS = "127.0.0.1"; # YOUR UDM CONFIG HERE - PORT = 80; # YOUR UDM CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR UDM API VERSION FOR SBI CONFIG HERE - FQDN = "localhost" # YOUR UDM FQDN CONFIG HERE - }; - - NRF : - { - IPV4_ADDRESS = "192.168.71.130"; # YOUR NRF CONFIG HERE - PORT = 80; # YOUR NRF CONFIG HERE (default: 80) - API_VERSION = "v1"; # YOUR NRF API VERSION FOR SBI CONFIG HERE - FQDN = "oai-nrf" # YOUR NRF FQDN CONFIG HERE - }; - - UPF_LIST = ( - {IPV4_ADDRESS = "192.168.71.134" ; FQDN = "oai-spgwu"} # YOUR UPF CONFIG HERE - ); - - LOCAL_CONFIGURATION : - { - SESSION_MANAGEMENT_SUBSCRIPTION_LIST = ( - { NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, - QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", - QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"}, - { NSSAI_SST = 1; NSSAI_SD = "1", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, - QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", - QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"} - ); - }; - -}; - diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f2eda66fc0..b7b365741c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1,4 +1,4 @@ -#/* +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -343,8 +343,8 @@ set(CMAKE_CXX_FLAGS if (SANITIZE_ADDRESS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-common") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-common") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common") endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") @@ -1710,6 +1710,9 @@ set(PHY_SRC_UE set(PHY_NR_SRC_COMMON ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach_common.c + ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c + ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_scrambling.c + ${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c ) set(PHY_NR_SRC @@ -1735,7 +1738,6 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c - ${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c @@ -1758,6 +1760,7 @@ set(PHY_SRC_UE ${PHY_SMALLBLOCKSRC} ${PHY_NR_CODINGIF} ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c + ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/srs_rx.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_uci_tools_common.c ) set(PHY_NR_UE_SRC @@ -1779,7 +1782,6 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sch_dmrs.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/ ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_prach.c - ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/dci_nr.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/dci_tools_nr.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -2074,6 +2076,7 @@ set (MAC_NR_SRC ${NR_GNB_MAC_DIR}/gNB_scheduler_primitives.c ${NR_GNB_MAC_DIR}/gNB_scheduler_phytest.c ${NR_GNB_MAC_DIR}/gNB_scheduler_uci.c + ${NR_GNB_MAC_DIR}/gNB_scheduler_srs.c ${NR_GNB_MAC_DIR}/gNB_scheduler_RA.c ) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 68aef48c6b..92bcfd88e2 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -57,7 +57,7 @@ BUILD_DOXYGEN=0 BUILD_COVERITY_SCAN=0 T_TRACER="True" DISABLE_HARDWARE_DEPENDENCY="False" -CMAKE_BUILD_TYPE="" +CMAKE_BUILD_TYPE="RelWithDebInfo" CMAKE_CMD="$CMAKE" UE_AUTOTEST_TRACE="False" UE_DEBUG_TRACE="False" @@ -585,15 +585,12 @@ function main() { echo_info "3. building the compilation directives ..." DIR=$OPENAIR_DIR/cmake_targets - if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then - build_dir=phy_simulators - else - if [ "$T_TRACER" = "False" ] ; then + if [ "$T_TRACER" = "False" ] ; then build_dir=ran_build_noLOG - else + else build_dir=ran_build - fi fi + [ "$CLEAN" = "1" ] && rm -rf $DIR/$build_dir/build mkdir -p $DIR/$build_dir/build @@ -601,84 +598,81 @@ function main() { config_libconfig_shlib=params_libconfig # first generate the CMakefile in the right directory - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then + # softmodem compilation + + cmake_file=$DIR/$build_dir/CMakeLists.txt + echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file + echo "project (OpenAirInterface)" >> $cmake_file + echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file + echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file + echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file + # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file + echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file + echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file + echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file + echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file + echo "set ( PACKAGE_NAME \"${exec}\")" >> $cmake_file + echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file + echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >> $cmake_file + echo "set ( T_TRACER $T_TRACER )" >> $cmake_file + echo "set ( UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE )" >> $cmake_file + echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )" >> $cmake_file + echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file + echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file + echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file + echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file + echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file + echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file + cd $DIR/$build_dir/build + eval $CMAKE_CMD - # softmodem compilation - - cmake_file=$DIR/$build_dir/CMakeLists.txt - echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file - echo "project (OpenAirInterface)" >> $cmake_file - echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file - echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file - echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file -# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file - echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file - echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file - echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file - echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file - echo "set ( PACKAGE_NAME \"${exec}\")" >> $cmake_file - echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file - echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >> $cmake_file - echo "set ( T_TRACER $T_TRACER )" >> $cmake_file - echo "set ( UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE )" >> $cmake_file - echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )" >> $cmake_file - echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file - echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file - echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file - echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file - echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file - echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file - cd $DIR/$build_dir/build - eval $CMAKE_CMD - - execlist="" - if [ "$eNB" = "1" ] ; then + execlist="" + if [ "$eNB" = "1" ] ; then execlist="$execlist lte-softmodem" - fi - if [ "$eNBocp" = "1" ] ; then + fi + if [ "$eNBocp" = "1" ] ; then execlist="$execlist ocp-enb" - fi - if [ "$gNB" = "1" ] ; then + fi + if [ "$gNB" = "1" ] ; then execlist="$execlist nr-softmodem" - fi - if [ "$RU" = "1" ] ; then + fi + if [ "$RU" = "1" ] ; then execlist="$execlist oairu" - fi - if [ "$UE" = 1 ] ; then + fi + if [ "$UE" = 1 ] ; then execlist="$execlist lte-uesoftmodem" - fi - if [ "$nrUE" = 1 ] ; then + fi + if [ "$nrUE" = 1 ] ; then execlist="$execlist nr-uesoftmodem" - fi - - if [ "$ittiSIM" = "1" ] ; then + fi + + if [ "$ittiSIM" = "1" ] ; then execlist="$execlist nr-ittisim" - fi - - for f in $execlist ; do + fi + + for f in $execlist ; do echo_info "Compiling $f..." compilations \ - $build_dir $f \ - $f $dbin/$f.$REL - done - - -# mandatory shared libraries common to UE and (e/g)NB - - if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then + $build_dir $f \ + $f $dbin/$f.$REL + done + + + # mandatory shared libraries common to UE and (e/g)NB + + if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then echo_info "Building shared libraries common to UE and gNB" - + + compilations \ + $build_dir $config_libconfig_shlib \ + lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so + compilations \ - $build_dir $config_libconfig_shlib \ - lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so - - compilations \ $build_dir coding \ libcoding.so $dbin/libcoding.so - - fi + fi - + if [ "$UE" = 1 ] ; then echo_info "Compiling UE specific part" @@ -727,11 +721,8 @@ function main() { fi fi - if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then - cd $DIR/$build_dir/build - eval $CMAKE_CMD - fi - + cd $DIR/$build_dir/build + ################## # PHY simulators # ################## @@ -742,11 +733,11 @@ function main() { # simlist="ldpctest" for f in $simlist ; do compilations \ - phy_simulators $f \ + ran_build $f \ $f $dbin/$f.$REL done compilations \ - phy_simulators coding \ + ran_build coding \ libcoding.so $dbin/libcoding.so # compilations \ # lte-simulators $config_libconfig_shlib \ @@ -761,7 +752,7 @@ function main() { simlist="secu_knas_encrypt_eia1 secu_kenb aes128_ctr_encrypt aes128_ctr_decrypt secu_knas_encrypt_eea2 secu_knas secu_knas_encrypt_eea1 kdf aes128_cmac_encrypt secu_knas_encrypt_eia2" for f in $simlist ; do compilations \ - phy_simulators test_$f \ + ran_build test_$f \ test_$f $dbin/test_$f.$REL done fi diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 33e558a234..e58f5c9bb1 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -135,7 +135,6 @@ clean_all_files() { rm -rf "$dir"/ran_build/build rm -rf "$dir"/ran_build_noLOG/build rm -rf "$dir"/lte-simulators/build - rm -rf "$dir"/phy_simulators/build rm -rf "$dir"/nas_sim_tools/build rm -rf "$dir"/oaisim_build_oai/build rm -rf "$dir"/oaisim_build_oai/CMakeLists.txt diff --git a/cmake_targets/phy_simulators b/cmake_targets/phy_simulators new file mode 120000 index 0000000000..2a12e92f3e --- /dev/null +++ b/cmake_targets/phy_simulators @@ -0,0 +1 @@ +ran_build/ \ No newline at end of file diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt deleted file mode 100755 index f8c659959f..0000000000 --- a/cmake_targets/phy_simulators/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project (OpenAirInterface) -set ( CMAKE_BUILD_TYPE ) -set ( CFLAGS_PROCESSOR_USER "" ) -set ( UE_EXPANSION False ) -set ( PRE_SCD_THREAD False ) -set ( ENABLE_VCD_FIFO False ) -set ( RF_BOARD "None") -set ( TRANSP_PRO "None") -set ( PACKAGE_NAME "") -set ( DEADLINE_SCHEDULER "False" ) -set ( CPU_AFFINITY "False" ) -set ( T_TRACER True ) -set ( UE_AUTOTEST_TRACE False ) -set ( UE_DEBUG_TRACE False ) -set ( UE_TIMING_TRACE False ) -set ( USRP_REC_PLAY False ) -set ( SKIP_SHARED_LIB_FLAG False ) -set ( PHYSIM True) -set ( RU 0) -include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 1df7808b0f..ec5de6a0d1 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -168,7 +168,7 @@ clean_all_files() { rm -rf $dir/log $OPENAIR_DIR/targets/bin/* rm -rf $dir/ran_build $dir/ran_build_noLOG rm -rf $dir/lte-simulators/build - rm -rf $dir/phy_simulators/build $dir/nas_sim_tools/build + rm -rf $dir/nas_sim_tools/build rm -rf $dir/oaisim_build_oai/build $dir/oaisim_build_oai/CMakeLists.txt rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build } diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md index 9ab90cf120..d5ede8c57d 100644 --- a/common/utils/LOG/DOC/addconsoletrace.md +++ b/common/utils/LOG/DOC/addconsoletrace.md @@ -3,6 +3,7 @@ ```C LOG_E(,,,...) LOG_W(,,,...) +LOG_A(,,,...) LOG_I(,,,...) LOG_D(,,,...) LOG_T(,,,...) @@ -14,9 +15,10 @@ these macros are used in place of the printf C function. The additionnal ***comp |:---------|:---------------|:---------------|----------------:| | LOG_E | E | 0 | error | | LOG_W | W | 1 | warning | -| LOG_I | I | 2 | informational | -| LOG_D | D | 3 | debug | -| LOG_T | T | 4 | trace | +| LOG_A | A | 2 | analysis | +| LOG_I | I | 3 | informational | +| LOG_D | D | 4 | debug | +| LOG_T | T | 5 | trace | component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt). diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md index d7c748952d..041c29e688 100644 --- a/common/utils/LOG/DOC/rtusage.md +++ b/common/utils/LOG/DOC/rtusage.md @@ -7,9 +7,9 @@ All logging facility parameters are defined in the log_config section. Some para | name | type | default | description | |:---:|:---:|:---:|:----| -| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`info`,`debug`,`trace` | +| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`analysis`,`info`,`debug`,`trace` | | `global_log_online` | `boolean` | 1 (=true) | If false, all console messages are discarded, whatever their level | -| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header, `function`, adds the function name, `line_num`, adds the line number, `time` adds the time since process starts| +| `global_log_options` | `list of pre-defined string of char` | | 5 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,A,W,E for trace, debug, info, analysis, warning, error),`thread`, add the thread name in the message header, `thread_id`, adds the thread ID in the message header, `function`, adds the function name, `line_num`, adds the line number, `time` adds the time since process starts| ### Component specific parameters | name | type | default | description | diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 28134d6db1..29e4f718c6 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -65,6 +65,7 @@ char logmem_filename[1024] = {0}; mapping log_level_names[] = { {"error", OAILOG_ERR}, {"warn", OAILOG_WARNING}, + {"analysis", OAILOG_ANALYSIS}, {"info", OAILOG_INFO}, {"debug", OAILOG_DEBUG}, {"trace", OAILOG_TRACE}, @@ -78,14 +79,15 @@ mapping log_options[] = { {"line_num", FLAG_FILE_LINE }, {"function", FLAG_FUNCT}, {"time", FLAG_TIME}, + {"thread_id", FLAG_THREAD_ID}, {NULL,-1} }; mapping log_maskmap[] = LOG_MASKMAP_INIT; -char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */ -char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */ +char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, LOG_GREEN, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */ +char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */ static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args); @@ -501,6 +503,7 @@ int logInit (void) return 0; } +#include static inline int log_header(log_component_t *c, char *log_buffer, int buffsize, @@ -514,32 +517,45 @@ static inline int log_header(log_component_t *c, char threadname[64]; if (flag & FLAG_THREAD ) { threadname[0]='{'; - if ( pthread_getname_np(pthread_self(), threadname+1,61) != 0) + if (pthread_getname_np(pthread_self(), threadname + 1, sizeof(threadname) - 3) != 0) strcpy(threadname+1, "?thread?"); - strcat(threadname,"}"); + strcat(threadname,"} "); } else { threadname[0]=0; } - + char l[32]; if (flag & FLAG_FILE_LINE && flag & FLAG_FUNCT ) - snprintf(l, sizeof l," (%s:%d) ", func, line); + snprintf(l, sizeof l, "(%s:%d) ", func, line); else if (flag & FLAG_FILE_LINE) - sprintf(l," (%d) ", line); + snprintf(l, sizeof l, "(%d) ", line); + else if (flag & FLAG_FUNCT) + snprintf(l, sizeof l, "(%s) ", func); else - l[0]=0; + l[0] = 0; char timeString[32]; if ( flag & FLAG_TIME ) { struct timespec t; - clock_gettime(CLOCK_MONOTONIC, &t); - snprintf(timeString, sizeof t,"%05.3f",t.tv_sec+t.tv_nsec/1.0e9); + if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) + abort(); + snprintf(timeString, sizeof(timeString), "%lu.%06lu ", + t.tv_sec, + t.tv_nsec / 1000); } else { - timeString[0]=0; + timeString[0] = 0; } - return snprintf(log_buffer, buffsize, "%s%s[%s]%c%s %s ", - timeString, + + char threadIdString[32]; + if (flag & FLAG_THREAD_ID) { + snprintf(threadIdString, sizeof(threadIdString), "%08lx ", syscall(__NR_gettid)); + } else { + threadIdString[0] = 0; + } + return snprintf(log_buffer, buffsize, "%s%s%s[%s] %c %s%s", flag & FLAG_NOCOLOR ? "" : log_level_highlight_start[level], + timeString, + threadIdString, c->name, flag & FLAG_LEVEL ? g_log->level2string[level] : ' ', l, @@ -547,53 +563,6 @@ static inline int log_header(log_component_t *c, ); } -#if LOG_MINIMAL -#include -void logMinimal(int comp, int level, const char *format, ...) -{ - struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) - abort(); - - char buf[MAX_LOG_TOTAL]; - int n = snprintf(buf, sizeof(buf), "%lu.%06lu %08lx [%s] %c ", - ts.tv_sec, - ts.tv_nsec / 1000, - syscall(__NR_gettid), - g_log->log_component[comp].name, - level); - if (n < 0 || n >= sizeof(buf)) - { - fprintf(stderr, "%s: n=%d\n", __func__, n); - return; - } - - va_list args; - va_start(args, format); - int m = vsnprintf(buf + n, sizeof(buf) - n, format, args); - va_end(args); - - if (m < 0) - { - fprintf(stderr, "%s: n=%d m=%d\n", __func__, n, m); - return; - } - - int len = n + m; - if (len > sizeof(buf) - 1) - { - len = sizeof(buf) - 1; - } - if (buf[len - 1] != '\n') - { - buf[len++] = '\n'; - } - - __attribute__((unused)) - int unused = write(STDOUT_FILENO, buf, len); -} -#endif // LOG_MINIMAL - void logRecord_mt(const char *file, const char *func, int line, @@ -864,7 +833,14 @@ void flush_mem_to_file(void) } } -char logmem_log_level[NUM_LOG_LEVEL]={'E','W','I','D','T'}; +const char logmem_log_level[NUM_LOG_LEVEL] = { + [OAILOG_ERR] = 'E', + [OAILOG_WARNING] = 'W', + [OAILOG_ANALYSIS] = 'A', + [OAILOG_INFO] = 'I', + [OAILOG_DEBUG] = 'D', + [OAILOG_TRACE] = 'T', +}; static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args) { @@ -878,12 +854,32 @@ static void log_output_memory(log_component_t *c, const char *file, const char * char log_buffer[MAX_LOG_TOTAL]; // make sure that for log trace the extra info is only printed once, reset when the level changes - if (level < OAILOG_TRACE) - len += log_header(c, log_buffer, MAX_LOG_TOTAL, file, func, line, level); - len += vsnprintf(log_buffer+len, MAX_LOG_TOTAL-len, format, args); - if ( !((g_log->flag | c->flag) & FLAG_NOCOLOR) ) - len+=snprintf(log_buffer+len, MAX_LOG_TOTAL-len, "%s", log_level_highlight_end[level]); - + if (level < OAILOG_TRACE) { + int n = log_header(c, log_buffer+len, MAX_LOG_TOTAL, file, func, line, level); + if (n > 0) { + len += n; + if (len > MAX_LOG_TOTAL) { + len = MAX_LOG_TOTAL; + } + } + } + int n = vsnprintf(log_buffer+len, MAX_LOG_TOTAL-len, format, args); + if (n > 0) { + len += n; + if (len > MAX_LOG_TOTAL) { + len = MAX_LOG_TOTAL; + } + } + if ( !((g_log->flag | c->flag) & FLAG_NOCOLOR) ) { + int n = snprintf(log_buffer+len, MAX_LOG_TOTAL-len, "%s", log_level_highlight_end[level]); + if (n > 0) { + len += n; + if (len > MAX_LOG_TOTAL) { + len = MAX_LOG_TOTAL; + } + } + } + // OAI printf compatibility if(log_mem_flag==1){ if(log_mem_d[log_mem_side].enable_flag==1){ @@ -919,6 +915,7 @@ static void log_output_memory(log_component_t *c, const char *file, const char * } } }else{ + AssertFatal(len >= 0 && len <= MAX_LOG_TOTAL, "Bad len %d\n", len); if (write(fileno(c->stream), log_buffer, len)) {}; } } diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 350337b61b..46c73427c1 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -90,11 +90,12 @@ extern "C" { # define OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */ # define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" functionalities */ # define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */ -# define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */ -# define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers, may impact real-time behavior */ -# define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers, likely impact real-time behavior*/ +# define OAILOG_ANALYSIS 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */ +# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */ +# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers, may impact real-time behavior */ +# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers, likely impact real-time behavior*/ -#define NUM_LOG_LEVEL 5 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/ +#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/ /* @}*/ @@ -127,6 +128,7 @@ extern "C" { #define FLAG_FUNCT 0x0020 #define FLAG_FILE_LINE 0x0040 #define FLAG_TIME 0x0100 +#define FLAG_THREAD_ID 0x0200 #define FLAG_INITIALIZED 0x8000 #define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O) @@ -390,7 +392,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int /* optname help paramflags XXXptr defXXXval type numelt */ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define LOG_GLOBALPARAMS_DESC { \ - {LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \ + {LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[3].name, TYPE_STRING, 0}, \ {LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \ {LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST, 0} \ } @@ -408,32 +410,14 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int // debugging macros #define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */ -#if LOG_MINIMAL - - void logMinimal(int component, int level, const char *format, ...) __attribute__((format(printf, 3, 4))); -# define LOG_E(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'E', __VA_ARGS__); while (0) -# define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0) -# define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */ -# define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0) -# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) -# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0) - -# define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0) -# define LOG_DUMPFLAG(D) 0 -# define LOG_DEBUGFLAG(D) 0 -# define LOG_DUMPMSG(C, B, S, X...) ((void) 0) -# define VLOG(C, L, F, ARGS) ((void) 0) - -#else // LOG_MINIMAL - # if T_TRACER /* per component, level dependent macros */ -# define LOG_E(c, x...) do { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} } while (0) -# define LOG_W(c, x...) do { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)); if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x);} } while (0) -# define LOG_A LOG_I -# define LOG_I(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} } while (0) -# define LOG_D(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} } while (0) -# define LOG_T(c, x...) do { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} } while (0) +# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) +# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) +# define LOG_A(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) +# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) +# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) +# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) # define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0) /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ @@ -449,8 +433,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_E(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} while (0) # define LOG_W(c, x...) do { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} while (0) +# define LOG_A(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x);} while (0) # define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0) -# define LOG_A LOG_I # define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0) # define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0) # define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0) @@ -464,7 +448,6 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_VAR(A,B) A B # define T_ACTIVE(a) (0) # endif /* T_TRACER */ -#endif // LOG_MINIMAL /* avoid warnings for variables only used in LOG macro's but set outside debug section */ #define GCC_NOTUSED __attribute__((unused)) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index a8a4f57fcd..a8b919e525 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -93,6 +93,14 @@ ID = GNB_PHY_PUCCH_PUSCH_IQ DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB FORMAT = int,frame : int,slot : buffer,rxdataF +ID = GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE + DESC = gNodeB channel estimation in the frequency domain + GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB + FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_t +ID = GNB_PHY_UL_TIME_CHANNEL_ESTIMATE + DESC = gNodeB channel estimation in the time domain + GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB + FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_t ID = GNB_PHY_PRACH_INPUT_SIGNAL DESC = gNodeB input data in the time domain for slots with PRACH detection GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB diff --git a/common/utils/T/tracer/gnb.c b/common/utils/T/tracer/gnb.c index 4aaa4898a1..6629a1efd6 100644 --- a/common/utils/T/tracer/gnb.c +++ b/common/utils/T/tracer/gnb.c @@ -4,15 +4,28 @@ #include #include #include "database.h" +#include "event.h" #include "handler.h" #include "config.h" #include "logger/logger.h" -#include "view/view.h" #include "gui/gui.h" +#include "utils.h" +#include "openair_logo.h" + +int ue_id[65536]; +int next_ue_id; typedef struct { widget *pucch_pusch_iq_plot; + widget *ul_freq_estimate_ue_xy_plot; + widget *ul_time_estimate_ue_xy_plot; + widget *current_ue_label; + widget *current_ue_button; + widget *prev_ue_button; + widget *next_ue_button; logger *pucch_pusch_iq_logger; + logger *ul_freq_estimate_ue_logger; + logger *ul_time_estimate_ue_logger; } gnb_gui; typedef struct { @@ -21,6 +34,7 @@ typedef struct { int nevents; pthread_mutex_t lock; gnb_gui *e; + int ue; /* what UE is displayed in the UE specific views */ void *database; } gnb_data; @@ -69,34 +83,133 @@ static void *gui_thread(void *_g) return NULL; } -static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database, - gnb_data *ed) +static void set_current_ue(gui *g, gnb_data *e, int ue) +{ + char s[256]; + + sprintf(s, "[UE %d] ", ue); + label_set_text(g, e->e->current_ue_label, s); + + sprintf(s, "GNB_PHY_PUCCH_PUSCH_IQ [UE %d]", ue); + xy_plot_set_title(g, e->e->pucch_pusch_iq_plot, s); + + sprintf(s, "UL channel estimation in frequency domain [UE %d]", ue); + xy_plot_set_title(g, e->e->ul_freq_estimate_ue_xy_plot, s); + + sprintf(s, "UL channel estimation in time domain [UE %d]", ue); + xy_plot_set_title(g, e->e->ul_time_estimate_ue_xy_plot, s); +} + +void reset_ue_ids(void) +{ + int i; + printf("resetting known UEs\n"); + for (i = 0; i < 65536; i++) ue_id[i] = -1; + ue_id[65535] = 0; + ue_id[65534] = 1; /* HACK: to be removed */ + ue_id[2] = 2; /* this supposes RA RNTI = 2, very openair specific */ + next_ue_id = 0; +} + +static void click(void *private, gui *g, char *notification, widget *w, void *notification_data) +{ + int *d = notification_data; + int button = d[0]; + gnb_data *ed = private; + gnb_gui *e = ed->e; + int ue = ed->ue; + int do_reset = 0; + + if (button != 1) return; + if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; } + if (w == e->next_ue_button) ue++; + if (w == e->current_ue_button) do_reset = 1; + + if (pthread_mutex_lock(&ed->lock)) abort(); + if (do_reset) reset_ue_ids(); + if (ue != ed->ue) { + set_current_ue(g, ed, ue); + ed->ue = ue; + } + if (pthread_mutex_unlock(&ed->lock)) abort(); +} + +static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database, gnb_data *ed) { widget *main_window; widget *top_container; widget *line; + widget *col; + widget *logo; widget *w; + widget *w2; logger *l; view *v; - main_window = new_toplevel_window(g, 500, 300, "gNB tracer"); - + main_window = new_toplevel_window(g, 1500, 230, "gNB tracer"); top_container = new_container(g, VERTICAL); widget_add_child(g, main_window, top_container, -1); line = new_container(g, HORIZONTAL); widget_add_child(g, top_container, line, -1); + logo = new_image(g, openair_logo_png, openair_logo_png_len); + + /* logo + prev/next UE buttons */ + col = new_container(g, VERTICAL); + widget_add_child(g, col, logo, -1); + w = new_container(g, HORIZONTAL); + widget_add_child(g, col, w, -1); + w2 = new_label(g, ""); + widget_add_child(g, w, w2, -1); + label_set_clickable(g, w2, 1); + e->current_ue_button = w2; + e->current_ue_label = w2; + w2 = new_label(g, " [prev UE] "); + widget_add_child(g, w, w2, -1); + label_set_clickable(g, w2, 1); + e->prev_ue_button = w2; + w2 = new_label(g, " [next UE] "); + widget_add_child(g, w, w2, -1); + label_set_clickable(g, w2, 1); + e->next_ue_button = w2; + widget_add_child(g, line, col, -1); /* PUCCH/PUSCH IQ data */ - w = new_xy_plot(g, 55, 55, "", 50); + w = new_xy_plot(g, 200, 200, "", 10); e->pucch_pusch_iq_plot = w; widget_add_child(g, line, w, -1); xy_plot_set_range(g, w, -1000, 1000, -1000, 1000); - xy_plot_set_title(g, w, "rxdataF"); l = new_iqlog_full(h, database, "GNB_PHY_PUCCH_PUSCH_IQ", "rxdataF"); v = new_view_xy(300*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE); logger_add_view(l, v); e->pucch_pusch_iq_logger = l; + + /* UL channel estimation in frequency domain */ + w = new_xy_plot(g, 490, 200, "", 50); + e->ul_freq_estimate_ue_xy_plot = w; + widget_add_child(g, line, w, -1); + xy_plot_set_range(g, w, 0, 2048, -10, 80); + l = new_framelog(h, database, "GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE", "subframe", "chest_t"); + framelog_set_update_only_at_sf9(l, 0); + v = new_view_xy(2048, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE); + logger_add_view(l, v); + e->ul_freq_estimate_ue_logger = l; + + /* UL channel estimation in time domain */ + w = new_xy_plot(g, 490, 200, "", 50); + e->ul_time_estimate_ue_xy_plot = w; + widget_add_child(g, line, w, -1); + xy_plot_set_range(g, w, 0, 2048, -10, 80); + l = new_framelog(h, database, "GNB_PHY_UL_TIME_CHANNEL_ESTIMATE", "subframe", "chest_t"); + framelog_set_update_only_at_sf9(l, 0); + v = new_view_xy(2048, 10, g, w, new_color(g, "#0c0c72"), XY_LOOP_MODE); + logger_add_view(l, v); + e->ul_time_estimate_ue_logger = l; + + set_current_ue(g, ed, ed->ue); + register_notifier(g, "click", e->current_ue_button, click, ed); + register_notifier(g, "click", e->prev_ue_button, click, ed); + register_notifier(g, "click", e->next_ue_button, click, ed); } int main(int n, char **v) @@ -136,7 +249,11 @@ int main(int n, char **v) h = new_handler(database); on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1); + on_off(database, "GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE", is_on, 1); + on_off(database, "GNB_PHY_UL_TIME_CHANNEL_ESTIMATE", is_on, 1); + gnb_data.ue = 0; + gnb_data.e = ⪚ gnb_data.database = database; gnb_data.socket = -1; gnb_data.is_on = is_on; diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index b9284748e4..195bf33335 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -396,6 +396,7 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, { database_event_format f; int i; + d->ul_rnti = -1; d->ul_frame = -1; d->ul_subframe = -1; diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index de8a0522e0..d823fcc1c4 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -500,6 +500,12 @@ 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<phy_proc[0]),0,RX_NB_TH},\ {"phy_proc_rx", &(UE-> phy_proc_rx[0]),0,RX_NB_TH},\ {"phy_proc_tx", &(UE->phy_proc_tx),0,1},\ + {"ue_ul_indication_stats", &(UE->ue_ul_indication_stats),0,1},\ {"ofdm_mod_stats", &(UE->ofdm_mod_stats),0,1},\ {"ulsch_encoding_stats", &(UE->ulsch_encoding_stats),0,1},\ {"ulsch_modulation_stats", &(UE->ulsch_modulation_stats),0,1},\ {"ulsch_segmentation_stats", &(UE->ulsch_segmentation_stats),0,1},\ {"ulsch_rate_matching_stats", &(UE->ulsch_rate_matching_stats),0,1},\ - {"ulsch_turbo_encoding_stats", &(UE->ulsch_turbo_encoding_stats),0,1},\ + {"ulsch_ldpc_encoding_stats", &(UE->ulsch_ldpc_encoding_stats),0,1},\ {"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\ {"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\ {"generic_stat", &(UE->generic_stat),0,1},\ @@ -123,12 +124,12 @@ {"dlsch_f...timation_stats", &(UE->dlsch_freq_offset_estimation_stats),0,1},\ {"dlsch_demodulation_stats", &(UE->dlsch_demodulation_stats),0,1},\ {"dlsch_rate_unmatching_stats", &(UE->dlsch_rate_unmatching_stats),0,1},\ - {"dlsch_turbo_decoding_stats", &(UE->dlsch_turbo_decoding_stats),0,1},\ + {"dlsch_ldpc_decoding_stats", &(UE->dlsch_ldpc_decoding_stats),0,1},\ {"dlsch_deinterleaving_stats", &(UE->dlsch_deinterleaving_stats),0,1},\ {"dlsch_llr_stats", &(UE->dlsch_llr_stats),0,1},\ {"dlsch_unscrambling_stats", &(UE->dlsch_unscrambling_stats),0,1},\ {"dlsch_rate_matching_stats", &(UE->dlsch_rate_matching_stats),0,1},\ - {"dlsch_turbo_encoding_stats", &(UE->dlsch_turbo_encoding_stats),0,1},\ + {"dlsch_ldpc_encoding_stats", &(UE->dlsch_ldpc_encoding_stats),0,1},\ {"dlsch_interleaving_stats", &(UE->dlsch_interleaving_stats),0,1},\ {"dlsch_tc_init_stats", &(UE->dlsch_tc_init_stats),0,1},\ {"dlsch_tc_alpha_stats", &(UE->dlsch_tc_alpha_stats),0,1},\ @@ -146,6 +147,7 @@ {"ue_front_end_stat", &(UE->ue_front_end_stat[0]),0,RX_NB_TH},\ {"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ {"pdcch_procedures_stat", &(UE->pdcch_procedures_stat[0]),0,RX_NB_TH},\ + {"rx_pdsch_stats", &(UE->rx_pdsch_stats), 0, 1}, \ {"pdsch_procedures_stat", &(UE->pdsch_procedures_stat[0]),0,RX_NB_TH},\ {"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ {"dlsch_procedures_stat", &(UE->dlsch_procedures_stat[0]),0,RX_NB_TH},\ diff --git a/doc/BUILD.md b/doc/BUILD.md index 40b63ac697..852a248659 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -60,7 +60,7 @@ cd cmake_targets/ ./build_oai -I --phy_simulators ``` -After completing the build, the binaries are available in the cmake_targets/phy_simulators/build directory. +After completing the build, the binaries are available in the cmake_targets/ran_build/build directory. A copy is also available in the target/bin directory, with all binaries suffixed by the 3GPP release number, today **.Rel15**. diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 2fc7115193..eaa691d6ef 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -294,6 +294,10 @@ The following features are valid for the gNB and the 5G-NR UE. * NR-PUCCH - Format 0 (2 bits, for ACK/NACK and SR) - Format 2 (up to 11 bits, mainly for CSI feedback) +* NR-SRS + - SRS signal reception + - Channel estimation (with T tracer real time monitoring) + - Power noise estimation * NR-PRACH - Formats 0,1,2,3, A1-A3, B1-B3 * Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported) @@ -322,6 +326,8 @@ The following features are valid for the gNB and the 5G-NR UE. - phy-test scheduler (fixed allocation) - regular scheduler with dynamic allocation - HARQ procedures for uplink +- Scheduler procedures for SRS reception + - Periodic SRS reception - MAC procedures to handle CSI measurement report - evalution of RSRP report - evaluation of CQI report @@ -433,11 +439,12 @@ The following features are valid for the gNB and the 5G-NR UE. - Format 0 (2 bits for ACK/NACK and SR) - Format 2 (up to 64 bits, mainly for CSI feedback) - Format 1, 3 and 4 present but old code never dested (need restructuring before verification) -* NR-PRACH +* NR-SRS + - Generation of sequence at PHY + - SRS signal transmission +* NR-PRACH - Formats 0,1,2,3, A1-A3, B1-B3 -* NR-SRS - - Old code never dested (need restructuring before verification) -* SS-RSRP +* SS-RSRP - RSRP measured on synchronization SSB (ok only for single SSB) * Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 are supported) * Highly efficient 3GPP compliant polar encoder and decoder @@ -452,21 +459,21 @@ The following features are valid for the gNB and the 5G-NR UE. ## NR UE Higher Layers ## **UE MAC** -* Minimum system information (MSI) +* Minimum system information (MSI) - MIB processing - Scheduling of system information block 1 (SIB1) reception -* Random access procedure (needs improvement, there is still not a clear separation between MAC and PHY) +* Random access procedure (needs improvement, there is still not a clear separation between MAC and PHY) - Mapping SSBs to multiple ROs - Scheduling of PRACH - Processing of RAR - Transmission and re-transmission of Msg3 - Msg4 and contention resolution -* DCI processing +* DCI processing - format 10 (RA-RNTI, C-RNTI, SI-RNTI, TC-RNTI) - format 00 (C-RNTI, TC-RNTI) - format 11 (C-RNTI) - format 01 (C-RNTI) -* UCI processing +* UCI processing - ACK/NACK processing - Triggering periodic SR - CSI measurement reporting (SSB RSRP only) @@ -475,6 +482,8 @@ The following features are valid for the gNB and the 5G-NR UE. - HARQ procedures * ULSCH scheduler - Configuration of fapi PDU according to DCI +* Scheduler procedures for SRS transmission + - Periodic SRS transmission **UE RLC** diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index 141a80cb50..9f4b27ec0e 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -85,10 +85,10 @@ COPY --from=phy-sim-build \ /lib64/liblapack.so.3 \ /lib64/libexslt.so.0 \ /lib64/libxslt.so.1 \ - /oai-ran/cmake_targets/phy_simulators/build/libdfts.so \ - /oai-ran/cmake_targets/phy_simulators/build/libSIMU.so \ - /oai-ran/cmake_targets/phy_simulators/build/libldpc.so \ - /oai-ran/cmake_targets/phy_simulators/build/libldpc_orig.so \ + /oai-ran/cmake_targets/ran_build/build/libdfts.so \ + /oai-ran/cmake_targets/ran_build/build/libSIMU.so \ + /oai-ran/cmake_targets/ran_build/build/libldpc.so \ + /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so \ /usr/local/lib/ RUN ldconfig diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index ba488d5170..3170749ff1 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -306,6 +306,7 @@ static void dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output) { stroff += print_meas_log(&gNB->ul_indication_stats, "UL Indication", NULL, NULL, output+stroff); stroff += print_meas_log(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL, output+stroff); stroff += print_meas_log(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL, output+stroff); + stroff += print_meas_log(&gNB->schedule_response_stats, "Schedule Response",NULL,NULL, output+stroff); if (ru->feprx) stroff += print_meas_log(&ru->ofdm_demod_stats,"feprx",NULL,NULL, output+stroff); if (ru->feptx_ofdm) { @@ -342,6 +343,7 @@ void *nrL1_stats_thread(void *param) { reset_meas(&gNB->ul_indication_stats); reset_meas(&gNB->rx_pusch_stats); reset_meas(&gNB->ulsch_decoding_stats); + reset_meas(&gNB->schedule_response_stats); while (!oai_exit) { sleep(1); @@ -411,8 +413,8 @@ void init_gNB_Tpool(int inst) { // ULSCH decoding threadpool gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); int numCPU = sysconf(_SC_NPROCESSORS_ONLN); - LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU); - int threadCnt = min(numCPU, gNB->pusch_proc_threads); + LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->thread_pool_size,numCPU); + int threadCnt = min(numCPU, gNB->thread_pool_size); if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt); char pool[80]; sprintf(pool,"-1"); @@ -442,7 +444,7 @@ void init_gNB_Tpool(int inst) { initNotifiedFIFO(gNB->L1_tx_out); // we create 2 threads for L1 tx processing - for (int i=0; i < 1; i++) { + for (int i=0; i < 2; i++) { notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_out,tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); init_DLSCH_struct(gNB, msgDataTx); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index cbe87f665c..adbdfc3da8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -106,6 +106,49 @@ queue_t nr_rach_ind_queue; static void *NRUE_phy_stub_standalone_pnf_task(void *arg); +static int dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, int max_len) +{ + int stroff = 0; + stroff += print_meas_log(&ue->phy_proc_tx, "L1 TX processing", NULL, NULL, output); + stroff += print_meas_log(&ue->ulsch_encoding_stats, "ULSCH encoding", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->phy_proc_rx[0], "L1 RX processing t0", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->phy_proc_rx[1], "L1 RX processing t1", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->ue_ul_indication_stats, "UL Indication", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->rx_pdsch_stats, "PDSCH receiver", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_decoding_stats[0], "PDSCH decoding t0", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_decoding_stats[1], "PDSCH decoding t1", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_deinterleaving_stats, " -> Deinterleive", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_rate_unmatching_stats, " -> Rate Unmatch", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_ldpc_decoding_stats, " -> LDPC Decode", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_unscrambling_stats, "PDSCH unscrambling", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_rx_pdcch_stats, "PDCCH handling", NULL, NULL, output + stroff); + return stroff; +} + +static void *nrL1_UE_stats_thread(void *param) +{ + PHY_VARS_NR_UE *ue = (PHY_VARS_NR_UE *) param; + const int max_len = 16384; + char output[max_len]; + char filename[30]; + snprintf(filename, 29, "nrL1_UE_stats-%d.log", ue->Mod_id); + filename[29] = 0; + FILE *fd = fopen(filename, "w"); + AssertFatal(fd != NULL, "Cannot open %s\n", filename); + + while (!oai_exit) { + sleep(1); + const int len = dump_L1_UE_meas_stats(ue, output, max_len); + AssertFatal(len < max_len, "exceeded length\n"); + fwrite(output, len + 1, 1, fd); // + 1 for terminating NULL byte + fflush(fd); + fseek(fd, 0, SEEK_SET); + } + fclose(fd); + + return NULL; +} + void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag) @@ -595,7 +638,7 @@ static void UE_synch(void *arg) { uint64_t dl_carrier, ul_carrier; nr_get_carrier_frequencies(UE, &dl_carrier, &ul_carrier); - if (nr_initial_sync(&syncD->proc, UE, 2, get_softmodem_params()->sa, get_nrUE_params()->nr_dlsch_parallel) == 0) { + if (nr_initial_sync(&syncD->proc, UE, 2, get_softmodem_params()->sa) == 0) { freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) + round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0); @@ -668,6 +711,7 @@ void processSlotTX(void *arg) { // trigger L2 to run ue_scheduler thru IF module // [TODO] mapping right after NR initial sync if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { + start_meas(&UE->ue_ul_indication_stats); nr_uplink_indication_t ul_indication; memset((void*)&ul_indication, 0, sizeof(ul_indication)); @@ -682,6 +726,7 @@ void processSlotTX(void *arg) { ul_indication.ue_sched_mode = rxtxD->ue_sched_mode; UE->if_inst->ul_indication(&ul_indication); + stop_meas(&UE->ue_ul_indication_stats); } if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) { @@ -733,15 +778,16 @@ void processSlotRX(void *arg) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); } - // calling UL_indication to schedule things other than PUSCH (eg, PUCCH) - rxtxD->ue_sched_mode = NOT_PUSCH; - processSlotTX(rxtxD); // Wait for PUSCH processing to finish notifiedFIFO_elt_t *res; res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool)); delNotifiedFIFO_elt(res); + // calling UL_indication to schedule things other than PUSCH (eg, PUCCH) + rxtxD->ue_sched_mode = NOT_PUSCH; + processSlotTX(rxtxD); + } else { rxtxD->ue_sched_mode = SCHED_ALL; processSlotTX(rxtxD); @@ -1166,6 +1212,8 @@ void init_NR_UE_threads(int nb_inst) { LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX); + pthread_t stat_pthread; + threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, "L1_UE_stats", -1, OAI_PRIORITY_RT_LOW); } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index ddbbbdf52c..7663e9ebd8 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -422,11 +422,11 @@ int main( int argc, char **argv ) { get_options (); //Command-line options specific for NRUE get_common_options(SOFTMODEM_5GUE_BIT); - init_tpools(nrUE_params.nr_dlsch_parallel); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); #if T_TRACER T_Config_Init(); #endif + init_tpools(nrUE_params.nr_dlsch_parallel); //randominit (0); set_taus_seed (0); diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 2c317687cf..205f879964 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1122,11 +1122,11 @@ int pnf_phy_ul_dci_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, proc = &gNB->proc.L1_proc; if (req->numPdus > 0) { - if (req->ul_dci_pdu_list[req->numPdus-1].PDUType == 0) { // copy only the last PDU (PHY can have only one UL PDCCH pdu) - msgTx->ul_pdcch_pdu = req->ul_dci_pdu_list[req->numPdus-1]; // copy the last pdu - } - else { - LOG_E(PHY,"[PNF] UL_DCI_REQ sfn_slot:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSLOT2DEC(req->SFN, req->Slot), req->numPdus-1, req->ul_dci_pdu_list[req->numPdus-1].PDUType); + for (int i=0; inumPdus; i++) { + if (req->ul_dci_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE) // only possible value 0: PDCCH PDU + msgTx->ul_pdcch_pdu[i] = req->ul_dci_pdu_list[i]; + else + LOG_E(PHY,"[PNF] UL_DCI_REQ sfn_slot:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSLOT2DEC(req->SFN, req->Slot), req->numPdus-1, req->ul_dci_pdu_list[req->numPdus-1].PDUType); } } @@ -1207,8 +1207,7 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE) { - // we trust the scheduler sends only one PDCCH PDU per slot - msgTx->pdcch_pdu = dl_tti_pdu_list[i].pdcch_pdu; // fills the last received PDCCH PDU + msgTx->pdcch_pdu[i] = dl_tti_pdu_list[i].pdcch_pdu; // copies all the received PDCCH PDUs } else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_SSB_PDU_TYPE) { //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]); diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 4ef7a73152..3b429a5e84 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -339,7 +339,33 @@ typedef struct } nfapi_nr_ue_pusch_pdu_t; typedef struct { +} fapi_nr_ul_srs_parms_v4; +typedef struct { + uint16_t rnti; // UE RNTI, Value: 1->65535 + uint32_t handle; // An opaque handling returned in the SRS.indication + uint16_t bwp_size; // Bandwidth part size [3GPP TS 38.213, sec 12]. Number of contiguous PRBs allocated to the BWP, Value: 1->275 + uint16_t bwp_start; // Bandwidth part start RB index from reference CRB [3GPP TS 38.213, sec 12], Value: 0->274 + uint8_t subcarrier_spacing; // subcarrierSpacing [3GPP TS 38.211, sec 4.2], Value:0->4 + uint8_t cyclic_prefix; // Cyclic prefix type [3GPP TS 38.211, sec 4.2], 0: Normal; 1: Extended + uint8_t num_ant_ports; // Number of antenna ports N_SRS_ap [3GPP TS 38.211, Sec 6.4.1.4.1], Value: 0 = 1 port, 1 = 2 ports, 2 = 4 ports + uint8_t num_symbols; // Number of symbols N_SRS_symb [3GPP TS 38.211, Sec 6.4.1.4.1], Value: 0 = 1 symbol, 1 = 2 symbols, 2 = 4 symbols + uint8_t num_repetitions; // Repetition factor R [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 = 1, 1 = 2, 2 = 4 + uint8_t time_start_position; // Starting position in the time domain l_0 [3GPP TS 38.211, Sec 6.4.1.4.1], Note: the MAC undertakes the translation from startPosition to l_0, Value: 0 --> 13 + uint8_t config_index; // SRS bandwidth config index C_SRS [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 63 + uint16_t sequence_id; // SRS sequence ID n_SRS_ID [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 --> 1023 + uint8_t bandwidth_index; // SRS bandwidth index B_SRS [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 3 + uint8_t comb_size; // Transmission comb size K_TC [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 = comb size 2, 1 = comb size 4, 2 = comb size 8 (Rel16) + uint8_t comb_offset; // Transmission comb offset K'_TC[3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 1 (combSize = 0), Value: 0 --> 3 (combSize = 1), Value: 0 --> 7 (combSize = 2) + uint8_t cyclic_shift; // Cyclic shift n_CS_SRS [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 --> 7 (combSize = 0), Value: 0 --> 11 (combSize = 1), Value: 0 --> 5 (combSize = 2) + uint8_t frequency_position; // Frequency domain position n_RRC [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 67 + uint16_t frequency_shift; // Frequency domain shift n_shift [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 268 + uint8_t frequency_hopping; // Frequency hopping b_hop [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 3 + uint8_t group_or_sequence_hopping; // Group or sequence hopping configuration (RRC parameter groupOrSequenceHopping in SRSResource IE), Value: 0 = No hopping, 1 = Group hopping groupOrSequenceHopping, 2 = Sequence hopping + uint8_t resource_type; // Type of SRS resource allocation [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0: aperiodic, 1: semi-persistent, 2: periodic + uint16_t t_srs; // SRS-Periodicity in slots [3GPP TS 38.211, Sec 6.4.1.4.4], Value: 1,2,3,4,5,8,10,16,20,32,40,64,80,160,320,640,1280,2560 + uint16_t t_offset; // Slot offset value [3GPP TS 38.211, Sec 6.4.1.4.3], Value:0->2559 + nfapi_nr_ue_ul_beamforming_t beamforming; } fapi_nr_ul_config_srs_pdu; typedef struct { @@ -348,7 +374,7 @@ typedef struct { fapi_nr_ul_config_prach_pdu prach_config_pdu; fapi_nr_ul_config_pucch_pdu pucch_config_pdu; nfapi_nr_ue_pusch_pdu_t pusch_config_pdu; - fapi_nr_ul_config_srs_pdu srs_config_pdu; + fapi_nr_ul_config_srs_pdu srs_config_pdu; }; } fapi_nr_ul_config_request_pdu_t; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index c124ad9fb9..c3a173758c 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -1312,7 +1312,7 @@ typedef struct uint8_t comb_offset;//Transmission comb offset 𝑘 ̄ TC [TS38.211, Sec 6.4.1.4.3] Value: 0 → 1 (combSize = 0) Value: 0 → 3 (combSize = 1) uint8_t cyclic_shift; uint8_t frequency_position; - uint8_t frequency_shift; + uint16_t frequency_shift; uint8_t frequency_hopping; uint8_t group_or_sequence_hopping;//Group or sequence hopping configuration (RRC parameter groupOrSequenceHopping in SRS-Resource uint8_t resource_type;//Type of SRS resource allocation @@ -1402,9 +1402,6 @@ typedef struct } nfapi_nr_ul_dci_request_t; */ - // normally one PDU per coreset per BWP -#define NFAPI_NR_MAX_UL_DCI_PDUS 4 - typedef struct { /// only possible value 0: PDCCH PDU uint16_t PDUType; @@ -1418,7 +1415,7 @@ typedef struct { uint16_t SFN; uint16_t Slot; uint8_t numPdus; - nfapi_nr_ul_dci_request_pdus_t ul_dci_pdu_list[NFAPI_NR_MAX_UL_DCI_PDUS]; + nfapi_nr_ul_dci_request_pdus_t ul_dci_pdu_list[NFAPI_NR_MAX_NB_CORESETS]; } nfapi_nr_ul_dci_request_t; //3.4.5 slot_errors diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c index 32b87f80e0..ce9c22f7f7 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c @@ -263,8 +263,8 @@ static uint8_t pack_nr_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, static uint8_t pack_pnf_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg; - return (pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) && - push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) && + return (push8(pNfapiMsg->num_tlvs,ppWritePackedMsg,end) && + pack_tlv(NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, ppWritePackedMsg, end, &pack_pnf_phy_rf_config_value) && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); } @@ -697,8 +697,7 @@ static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_ pack_tlv(NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_gsm_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) && pack_tlv(NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_umts_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) && pack_tlv(NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG, &(pNfapiMsg->nfapi_config.nmm_lte_frequency_bands), ppWritePackedMsg, end, &pack_nmm_frequency_bands_value) && - pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) ); + pack_tlv(NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG, &(pNfapiMsg->nfapi_config.nmm_uplink_rssi_supported), ppWritePackedMsg, end, &pack_uint8_tlv_value)); } @@ -724,47 +723,50 @@ static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uin pack_tlv(NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) && - + pack_tlv(NFAPI_NR_CONFIG_FREQUENCY_SHIFT_7P5KHZ_TAG, &(pNfapiMsg->carrier_config.frequency_shift_7p5khz), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - + pack_tlv(NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), ppWritePackedMsg, end, &pack_uint16_tlv_value) && + + pack_tlv(NFAPI_NR_CONFIG_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, &(pNfapiMsg->prach_config.prach_multiple_carriers_in_a_band), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG, &(pNfapiMsg->prach_config.prach_ConfigurationIndex), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SSB_PER_RACH_TAG, &(pNfapiMsg->prach_config.ssb_per_rach), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), ppWritePackedMsg, end, &pack_uint16_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG, &(pNfapiMsg->prach_config.prach_sub_c_spacing), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_root_sequence_index), ppWritePackedMsg, end, &pack_uint16_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_K1_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].k1), ppWritePackedMsg, end, &pack_uint16_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].prach_zero_corr_conf), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_BCH_PAYLOAD_TAG, &(pNfapiMsg->ssb_config.bch_payload), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), ppWritePackedMsg, end, &pack_uint32_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), ppWritePackedMsg, end, &pack_uint32_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) && - pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) && - + // TODO: Not sure what's going on, ssb_mask_list[1] packing below seems to match unpack, but is causing problems + // pack_tlv(NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), ppWritePackedMsg, end, &pack_uint32_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_BEAM_ID_TAG, &(pNfapiMsg->ssb_table.ssb_beam_id_list[0].beam_id), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, &(pNfapiMsg->ssb_table.ss_pbch_multiple_carriers_in_a_band), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_CONFIG_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG, &(pNfapiMsg->ssb_table.multiple_cells_ss_pbch_in_a_carrier), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) && - pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) && - pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) && + pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) && pack_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) && pack_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) && - //pack_tlv(NFAPI_NR_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), ppWritePackedMsg, end, &pack_rf_bands_value) && - pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), ppWritePackedMsg, end, &pack_ipv4_address_value) && + pack_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), ppWritePackedMsg, end, &pack_ipv6_address_value) && + pack_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - //pack_tlv(NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - - pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) ); + pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), ppWritePackedMsg, end, &pack_uint8_tlv_value) && + pack_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), ppWritePackedMsg, end, &pack_uint8_tlv_value)); } static uint8_t pack_nr_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { @@ -775,7 +777,7 @@ static uint8_t pack_nr_config_response(void *msg, uint8_t **ppWritePackedMsg, ui static uint8_t pack_config_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { nfapi_config_response_t *pNfapiMsg = (nfapi_config_response_t *)msg; - return ( push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && + return ( push32(pNfapiMsg->error_code, ppWritePackedMsg, end) && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config) ); } @@ -1346,7 +1348,8 @@ static uint8_t unpack_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end unpack_tlv_t unpack_fns[] = { { NFAPI_PNF_PHY_RF_TAG, &pNfapiMsg->pnf_phy_rf_config, &unpack_pnf_phy_rf_config_value}, }; - return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension); + return (pull8(ppReadPackedMsg, &pNfapiMsg->num_tlvs, end) && + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); } @@ -1722,13 +1725,14 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, for(int i=0;i<40;i++) pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t*) malloc(14*sizeof(nfapi_nr_max_num_of_symbol_per_slot_t)); - pNfapiMsg->prach_config.num_prach_fd_occasions_list=(nfapi_nr_num_prach_fd_occasions_t *) malloc(sizeof(nfapi_nr_num_prach_fd_occasions_t)); for(int i = 0; i < 40; i++){ //unpacking tdd slot config for(int symbol = 0; symbol<14;symbol++){ pull8(ppReadPackedMsg,&pNfapiMsg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[symbol].slot_config.value, end); } } + pNfapiMsg->prach_config.num_prach_fd_occasions_list=(nfapi_nr_num_prach_fd_occasions_t *) malloc(sizeof(nfapi_nr_num_prach_fd_occasions_t)); + unpack_tlv_t unpack_fns[] = { { NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), &unpack_uint16_tlv_value}, @@ -1741,8 +1745,13 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, { NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), &unpack_uint16_tlv_value}, { NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), &unpack_uint16_tlv_value}, { NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), &unpack_uint32_tlv_value}, + { NFAPI_NR_CONFIG_FREQUENCY_SHIFT_7P5KHZ_TAG, &(pNfapiMsg->carrier_config.frequency_shift_7p5khz), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), &unpack_uint8_tlv_value}, - { NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), &unpack_uint16_tlv_value}, + + { NFAPI_NR_CONFIG_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, &(pNfapiMsg->prach_config.prach_multiple_carriers_in_a_band), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG, &(pNfapiMsg->prach_config.prach_ConfigurationIndex), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), &unpack_uint8_tlv_value}, @@ -1754,24 +1763,32 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, { NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions_list[0].num_root_sequences), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_SCS_COMMON_TAG, &(pNfapiMsg->ssb_config.scs_common), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_BCH_PAYLOAD_TAG, &(pNfapiMsg->ssb_config.bch_payload), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG, &(pNfapiMsg->ssb_config.ss_pbch_power), &unpack_uint32_tlv_value}, + { NFAPI_NR_CONFIG_BETA_PSS_TAG, &(pNfapiMsg->ssb_table.beta_pss), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_MIB_TAG, &(pNfapiMsg->ssb_table.MIB), &unpack_uint32_tlv_value}, { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[0].ssb_mask), &unpack_uint32_tlv_value}, - { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), &unpack_uint32_tlv_value}, - + // TODO: Not sure what's going on, ssb_mask_list[1] unpacking below seems to match pack, but is causing problems + // { NFAPI_NR_CONFIG_SSB_MASK_TAG, &(pNfapiMsg->ssb_table.ssb_mask_list[1].ssb_mask), &unpack_uint32_tlv_value}, + { NFAPI_NR_CONFIG_BEAM_ID_TAG, &(pNfapiMsg->ssb_table.ssb_beam_id_list[0].beam_id), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG, &(pNfapiMsg->ssb_table.ssb_offset_point_a), &unpack_uint16_tlv_value}, { NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, &(pNfapiMsg->ssb_table.ss_pbch_multiple_carriers_in_a_band), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG, &(pNfapiMsg->ssb_table.multiple_cells_ss_pbch_in_a_carrier), &unpack_uint8_tlv_value}, + { NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), &unpack_uint8_tlv_value}, - { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), &unpack_ipv6_address_value}, - { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), &unpack_uint16_tlv_value}, + { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), &unpack_ipv4_address_value}, { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), &unpack_ipv6_address_value}, { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), &unpack_uint16_tlv_value}, + { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), &unpack_ipv4_address_value}, + { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), &unpack_ipv6_address_value}, + { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), &unpack_uint16_tlv_value}, + { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), &unpack_uint8_tlv_value}, { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), &unpack_uint8_tlv_value}, { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), &unpack_uint8_tlv_value}, - { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), &unpack_uint8_tlv_value}, }; return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) && diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index adc6d6e384..0e43c803e7 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -4548,7 +4548,7 @@ static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMs pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) && pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) && pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && + pull16(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) && pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) && pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) && diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index d1c3917c2c..7e37abcf81 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -38,7 +38,7 @@ #include "coding_defs.h" #include "assertions.h" -#if USE_INTEL_CRC +#if USE_INTEL_CRC #include "crc.h" #endif /*ref 36-212 v8.6.0 , pp 8-9 */ @@ -159,7 +159,7 @@ unsigned int crc24a (unsigned char * inptr, if ( bitlen % 8 || !USE_INTEL_CRC ) { unsigned int crc = 0; int resbit= (bitlen % 8); - + while (octetlen-- > 0) { // printf("crc24a: in %x => crc %x\n",crc,*inptr); crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)]; @@ -192,7 +192,7 @@ unsigned int crc24b (unsigned char * inptr, int bitlen) { int octetlen = bitlen / 8; /* Change in octets */ - + if ( bitlen % 8 || !USE_INTEL_CRC ) { unsigned int crc = 0; int resbit = (bitlen % 8); diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index ae49f9a4a7..29cba0a557 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -405,7 +405,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z; #ifdef RM_DEBUG - printf("nr_rate_matching_ldpc: E %d, F %d, Foffset %d, k0 %d, Ncb %d, rvidx %d\n", E, F, Foffset,ind, Ncb, rvidx); + printf("nr_rate_matching_ldpc: E %d, F %d, Foffset %d, k0 %d, Ncb %d, rvidx %d, Ilbrm %d\n", E, F, Foffset,ind, Ncb, rvidx, Ilbrm); #endif if (Foffset > E) { @@ -502,7 +502,7 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, } #ifdef RM_DEBUG - printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx); + printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d, Ilbrm %d\n", clear, E, ind, Ncb, rvidx, Ilbrm); #endif if (clear==1) memset(w,0,Ncb*sizeof(int16_t)); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index fb7e89c9ce..f810e8f678 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -206,6 +206,27 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, nr_init_csi_rs(gNB, cfg->cell_config.phy_cell_id.value); + for (int id=0; idnr_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*)); + gNB->nr_srs_info[id]->srs_ls_estimated_channel = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + gNB->nr_srs_info[id]->srs_estimated_channel_freq = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + gNB->nr_srs_info[id]->srs_estimated_channel_time = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + for (i=0;inr_srs_info[id]->srs_received_signal[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + gNB->nr_srs_info[id]->srs_ls_estimated_channel[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + gNB->nr_srs_info[id]->srs_estimated_channel_freq[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + gNB->nr_srs_info[id]->srs_estimated_channel_time[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + } + } + + generate_ul_reference_signal_sequences(SHRT_MAX); + /* Generate low PAPR type 1 sequences for PUSCH DMRS, these are used if transform precoding is enabled. */ generate_lowpapr_typ1_refsig_sequences(SHRT_MAX); @@ -557,6 +578,12 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i); } + for (int i=0; isrs[i] = new_gNB_srs(); + AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i); + } + for (int i=0; inumber_of_nr_ulsch_max; i++) { LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 493bc2c8a2..a88e7484e0 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -20,28 +20,19 @@ */ #include "phy_init.h" -#include "SCHED_UE/sched_UE.h" #include "PHY/phy_extern_nr_ue.h" -//#include "SIMULATION/TOOLS/sim.h" -/*#include "RadioResourceConfigCommonSIB.h" -#include "RadioResourceConfigDedicated.h" -#include "TDD-Config.h" -#include "MBSFN-SubframeConfigList.h"*/ #include "openair1/PHY/defs_RU.h" #include "openair1/PHY/impl_defs_nr.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" -#include +#include "PHY/MODULATION/nr_modulation.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" -//#include "PHY/LTE_REFSIG/lte_refsig.h" -#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" -#include "PHY/INIT/phy_init.h" #include "PHY/NR_REFSIG/pss_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_REFSIG/nr_refsig.h" -#include +#include "PHY/MODULATION/nr_modulation.h" #if 0 void phy_config_harq_ue(module_id_t Mod_id, @@ -140,6 +131,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, NR_UE_PBCH **const pbch_vars = ue->pbch_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; int i,j,k,l,slot,symb; + + NR_UE_SRS **const srs_vars = ue->srs_vars; + int gNB_id; int th_id; uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig @@ -326,6 +320,25 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, prach_vars[gNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH)); pbch_vars[gNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH)); + srs_vars[gNB_id] = (NR_UE_SRS *)malloc16_clear(sizeof(NR_UE_SRS)); + + srs_vars[gNB_id]->active = false; + 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 *) ); + ue->nr_srs_info->srs_ls_estimated_channel = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->nr_srs_info->srs_estimated_channel_freq = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->nr_srs_info->srs_estimated_channel_time = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->nr_srs_info->srs_estimated_channel_time_shifted = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + for (i=0; inb_antennas_rx; i++) { + ue->nr_srs_info->srs_received_signal[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + ue->nr_srs_info->srs_ls_estimated_channel[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + ue->nr_srs_info->srs_estimated_channel_freq[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + ue->nr_srs_info->srs_estimated_channel_time[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + ue->nr_srs_info->srs_estimated_channel_time_shifted[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); + } if (abstraction_flag == 0) { for (th_id=0; th_idframe_parms; crcTableInit(); + init_scrambling_luts(); load_dftslib(); init_context_synchro_nr(frame_parms); generate_ul_reference_signal_sequences(SHRT_MAX); @@ -553,6 +567,5 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) { //generate_16qam_table(); //generate_RIV_tables(); //init_unscrambling_lut(); - //init_scrambling_lut(); //set_taus_seed(1328); } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c index 67d811b753..740d1be501 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c @@ -44,14 +44,13 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, int16_t *d) { - uint32_t i; - uint8_t reset; - uint32_t x1=0, x2=0, s=0; + uint8_t reset = 1; + uint32_t x1 = 0; // x1 is set in lte_gold_generic + uint32_t s = 0; - reset = 1; - x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1 + uint32_t x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1 - for (i=0; i<32; i++) { + for (uint32_t i=0; i<32; i++) { if ((i&0x1f)==0) { s = lte_gold_generic(&x1, &x2, reset); //printf("lte_gold[%d]=%x\n",i,s); diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 1f164748bf..9aaba7fb66 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -36,10 +36,46 @@ //#define DEBUG_CH //#define DEBUG_PUSCH +//#define SRS_DEBUG #define NO_INTERP 1 #define dBc(x,y) (dB_fixed(((int32_t)(x))*(x) + ((int32_t)(y))*(y))) +void freq2time(uint16_t ofdm_symbol_size, + int16_t *freq_signal, + int16_t *time_signal) { + + switch (ofdm_symbol_size) { + case 128: + idft(IDFT_128, freq_signal, time_signal, 1); + break; + case 256: + idft(IDFT_256, freq_signal, time_signal, 1); + break; + case 512: + idft(IDFT_512, freq_signal, time_signal, 1); + break; + case 1024: + idft(IDFT_1024, freq_signal, time_signal, 1); + break; + case 1536: + idft(IDFT_1536, freq_signal, time_signal, 1); + break; + case 2048: + idft(IDFT_2048, freq_signal, time_signal, 1); + break; + case 4096: + idft(IDFT_4096, freq_signal, time_signal, 1); + break; + case 8192: + idft(IDFT_8192, freq_signal, time_signal, 1); + break; + default: + idft(IDFT_512, freq_signal, time_signal, 1); + break; + } +} + int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, unsigned char Ns, unsigned short p, @@ -273,10 +309,10 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch, ul_ch, 8); - + //for (int i= 0; i<16; i++) //printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i)); - + pil += 2; re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size; rxF = (int16_t *)&rxdataF[aarx][(soffset+symbol_offset+nushift+re_offset)]; @@ -898,63 +934,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, #endif // Convert to time domain - - switch (gNB->frame_parms.ofdm_symbol_size) { - case 128: - idft(IDFT_128,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 256: - idft(IDFT_256,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 512: - idft(IDFT_512,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 1024: - idft(IDFT_1024,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 1536: - idft(IDFT_1536,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 2048: - idft(IDFT_2048,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 4096: - idft(IDFT_4096,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - case 8192: - idft(IDFT_8192,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - - default: - idft(IDFT_512,(int16_t*) &ul_ch_estimates[aarx][symbol_offset], - (int16_t*) ul_ch_estimates_time[aarx], - 1); - break; - } - + freq2time(gNB->frame_parms.ofdm_symbol_size, + (int16_t*) &ul_ch_estimates[aarx][symbol_offset], + (int16_t*) ul_ch_estimates_time[aarx]); } #ifdef DEBUG_CH @@ -1091,3 +1073,178 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, }// last symbol check }//Antenna loop } + +uint32_t calc_power(uint16_t *x, uint32_t size) { + uint64_t sum_x = 0; + uint64_t sum_x2 = 0; + for(int k = 0; ksc_list_length == 0) { + LOG_E(NR_PHY, "(%d.%d) nr_srs_info was not generated yet!\n", frame, slot); + return -1; + } + + NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; + int32_t **srs_ls_estimated_channel = nr_srs_info->srs_ls_estimated_channel; + + uint16_t noise_real[frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length]; + uint16_t noise_imag[frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length]; + + int16_t ls_estimated[2]; + + for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) { + + memset(srs_ls_estimated_channel[ant], 0, frame_parms->ofdm_symbol_size*(1<num_symbols)*sizeof(int32_t)); + memset(srs_estimated_channel_freq[ant], 0, frame_parms->ofdm_symbol_size*(1<num_symbols)*sizeof(int32_t)); + + int16_t *srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[0]]; + + for(int sc_idx = 0; sc_idx < nr_srs_info->sc_list_length; sc_idx++) { + + int16_t generated_real = srs_generated_signal[nr_srs_info->sc_list[sc_idx]] & 0xFFFF; + int16_t generated_imag = (srs_generated_signal[nr_srs_info->sc_list[sc_idx]] >> 16) & 0xFFFF; + + int16_t received_real = srs_received_signal[ant][nr_srs_info->sc_list[sc_idx]] & 0xFFFF; + int16_t received_imag = (srs_received_signal[ant][nr_srs_info->sc_list[sc_idx]] >> 16) & 0xFFFF; + + // We know that nr_srs_info->srs_generated_signal_bits bits are enough to represent the generated_real and generated_imag. + // So we only need a nr_srs_info->srs_generated_signal_bits shift to ensure that the result fits into 16 bits. + ls_estimated[0] = (int16_t)(((int32_t)generated_real*received_real + (int32_t)generated_imag*received_imag)>>nr_srs_info->srs_generated_signal_bits); + ls_estimated[1] = (int16_t)(((int32_t)generated_real*received_imag - (int32_t)generated_imag*received_real)>>nr_srs_info->srs_generated_signal_bits); + srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]] = ls_estimated[0] + (((int32_t)ls_estimated[1] << 16) & 0xFFFF0000); + + // Channel interpolation + if(srs_pdu->comb_size == 0) { + if(sc_idx == 0) { // First subcarrier case + // filt8_start is {12288,8192,4096,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt8_start, ls_estimated, srs_estimated_channel16, 8); + } else if(nr_srs_info->sc_list[sc_idx] < nr_srs_info->sc_list[sc_idx - 1]) { // Start of OFDM symbol case + // filt8_start is {12288,8192,4096,0,0,0,0,0} + srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx + 2]] - sizeof(uint64_t); + multadd_real_vector_complex_scalar(filt8_start, ls_estimated, srs_estimated_channel16, 8); + } else if((sc_idx < (nr_srs_info->sc_list_length - 1) && nr_srs_info->sc_list[sc_idx + 1] < nr_srs_info->sc_list[sc_idx]) + || (sc_idx == (nr_srs_info->sc_list_length - 1))) { // End of OFDM symbol or last subcarrier cases + // filt8_end is {4096,8192,12288,16384,0,0,0,0} + multadd_real_vector_complex_scalar(filt8_end, ls_estimated, srs_estimated_channel16, 8); + } else if(sc_idx%2 == 1) { // 1st middle case + // filt8_middle2 is {4096,8192,8192,8192,4096,0,0,0} + multadd_real_vector_complex_scalar(filt8_middle2, ls_estimated, srs_estimated_channel16, 8); + } else if(sc_idx%2 == 0) { // 2nd middle case + // filt8_middle4 is {0,0,4096,8192,8192,8192,4096,0} + multadd_real_vector_complex_scalar(filt8_middle4, ls_estimated, srs_estimated_channel16, 8); + srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]; + } + } else { + if(sc_idx == 0) { // First subcarrier case + // filt16_start is {12288,8192,8192,8192,4096,0,0,0,0,0,0,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt16_start, ls_estimated, srs_estimated_channel16, 16); + } else if(nr_srs_info->sc_list[sc_idx] < nr_srs_info->sc_list[sc_idx - 1]) { // Start of OFDM symbol case + srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx + 1]] - sizeof(uint64_t); + // filt16_start is {12288,8192,8192,8192,4096,0,0,0,0,0,0,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt16_start, ls_estimated, srs_estimated_channel16, 16); + } else if((sc_idx < (nr_srs_info->sc_list_length - 1) && nr_srs_info->sc_list[sc_idx + 1] < nr_srs_info->sc_list[sc_idx]) + || (sc_idx == (nr_srs_info->sc_list_length - 1))) { // End of OFDM symbol or last subcarrier cases + // filt16_end is {4096,8192,8192,8192,12288,16384,16384,16384,0,0,0,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt16_end, ls_estimated, srs_estimated_channel16, 16); + } else { // Middle case + // filt16_middle4 is {4096,8192,8192,8192,8192,8192,8192,8192,4096,0,0,0,0,0,0,0} + multadd_real_vector_complex_scalar(filt16_middle4, ls_estimated, srs_estimated_channel16, 16); + srs_estimated_channel16 = (int16_t *)&srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]; + } + } + +#ifdef SRS_DEBUG + uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12; + int subcarrier_log = nr_srs_info->sc_list[sc_idx]-subcarrier_offset; + if(subcarrier_log < 0) { + subcarrier_log = subcarrier_log + frame_parms->ofdm_symbol_size; + } + if(sc_idx == 0) { + LOG_I(NR_PHY,"______________________________ Rx antenna %i _______________________________\n", ant); + } + if(subcarrier_log%12 == 0) { + LOG_I(NR_PHY,":::::::::::::::::::::::::::::::::::: %i ::::::::::::::::::::::::::::::::::::\n", subcarrier_log/12); + LOG_I(NR_PHY,"\t __genRe________genIm__|____rxRe_________rxIm__|____lsRe________lsIm_\n"); + } + LOG_I(NR_PHY,"(%4i) %6i\t%6i | %6i\t%6i | %6i\t%6i\n", + subcarrier_log, + generated_real, generated_imag, + received_real, received_imag, + ls_estimated[0], ls_estimated[1]); +#endif + } + + // Compute noise + for(int sc_idx = 0; sc_idx < nr_srs_info->sc_list_length; sc_idx++) { + noise_real[ant*nr_srs_info->sc_list_length + sc_idx] = abs((int16_t)((srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]]-srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]) & 0xFFFF)); + noise_imag[ant*nr_srs_info->sc_list_length + sc_idx] = abs((int16_t)(((srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]]-srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]]) >> 16) & 0xFFFF)); + } + + // Convert to time domain + freq2time(gNB->frame_parms.ofdm_symbol_size, + (int16_t*) srs_estimated_channel_freq[ant], + (int16_t*) srs_estimated_channel_time[ant]); + + memcpy(&srs_estimated_channel_time_shifted[ant][0], + &srs_estimated_channel_time[ant][gNB->frame_parms.ofdm_symbol_size>>1], + (gNB->frame_parms.ofdm_symbol_size>>1)*sizeof(int32_t)); + + memcpy(&srs_estimated_channel_time_shifted[ant][gNB->frame_parms.ofdm_symbol_size>>1], + &srs_estimated_channel_time[ant][0], + (gNB->frame_parms.ofdm_symbol_size>>1)*sizeof(int32_t)); + } + + *noise_power = calc_power(noise_real,frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length) + + calc_power(noise_imag,frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length); + +#ifdef SRS_DEBUG + uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12; + uint8_t R = srs_pdu->comb_size == 0 ? 2 : 4; + for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) { + for(int sc_idx = 0; sc_idx < nr_srs_info->sc_list_length; sc_idx++) { + int subcarrier_log = nr_srs_info->sc_list[sc_idx]-subcarrier_offset; + if(subcarrier_log < 0) { + subcarrier_log = subcarrier_log + frame_parms->ofdm_symbol_size; + } + if(sc_idx == 0) { + LOG_I(NR_PHY,"______________________________ Rx antenna %i _______________________________\n", ant); + } + if(subcarrier_log%12 == 0) { + LOG_I(NR_PHY,":::::::::::::::::::::::::::::::::::: %i ::::::::::::::::::::::::::::::::::::\n", subcarrier_log/12); + LOG_I(NR_PHY,"\t __lsRe__________lsIm__|____intRe_______intIm__|____noiRe_______noiIm_\n"); + } + for(int r = 0; rsc_list[sc_idx]+r]&0xFFFF), + (int16_t)((srs_ls_estimated_channel[ant][nr_srs_info->sc_list[sc_idx]+r]>>16)&0xFFFF), + (int16_t)(srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]+r]&0xFFFF), + (int16_t)((srs_estimated_channel_freq[ant][nr_srs_info->sc_list[sc_idx]+r]>>16)&0xFFFF), + noise_real[ant*nr_srs_info->sc_list_length+sc_idx], + noise_imag[ant*nr_srs_info->sc_list_length+sc_idx]); + } + + } + } + LOG_I(NR_PHY,"noise_power = %u\n", *noise_power); +#endif + + return 0; +} \ No newline at end of file diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h index fd3403236e..a01106adb5 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h @@ -62,4 +62,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, uint8_t nr_tti_rx, unsigned char symbol, uint32_t nb_re_pusch); + +int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, + int frame, + int slot, + nfapi_nr_srs_pdu_t *srs_pdu, + nr_srs_info_t *nr_srs_info, + int32_t *srs_generated_signal, + int32_t **srs_received_signal, + int32_t **srs_estimated_channel_freq, + int32_t **srs_estimated_channel_time, + int32_t **srs_estimated_channel_time_shifted, + uint32_t *noise_power); #endif diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index 43ec0c03dc..dab8e04059 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -108,22 +108,22 @@ EXTERN const char phi_M_ZC_6[6*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 */ -/* 0 */ -3, -1, 3, 3, -1, -3, -/* 1 */ -3, 3, -1, -1, 3, -3, -/* 2 */ -3, -3, -3, 3, 1, -3, -/* 3 */ 1, 1, 1, 3, -1, -3, -/* 4 */ 1, 1, 1, -3, -1, 3, -/* 5 */ -3, 1, -1, -3, -3, -3, -/* 6 */ -3, 1, 3, -3, -3, -3, -/* 7 */ -3, -1, 1, -3, 1, -1, -/* 8 */ -3, -1, -3, 1, -3, -3, -/* 9 */ -3, -3, 1, -3, 3, -3, +/* 0 */ -3, -1, 3, 3, -1, -3, +/* 1 */ -3, 3, -1, -1, 3, -3, +/* 2 */ -3, -3, -3, 3, 1, -3, +/* 3 */ 1, 1, 1, 3, -1, -3, +/* 4 */ 1, 1, 1, -3, -1, 3, +/* 5 */ -3, 1, -1, -3, -3, -3, +/* 6 */ -3, 1, 3, -3, -3, -3, +/* 7 */ -3, -1, 1, -3, 1, -1, +/* 8 */ -3, -1, -3, 1, -3, -3, +/* 9 */ -3, -3, 1, -3, 3, -3, /* 10 */ -3, 1, 3, 1, -3, -3, /* 11 */ -3, -1, -3, 1, 1, -3, /* 12 */ 1, 1, 3, -1, -3, 3, /* 13 */ 1, 1, 3, 3, -1, 3, /* 14 */ 1, 1, 1, -3, 3, -1, -/* 15 */ -1, 1, 1, -1, 3, -3, +/* 15 */ 1, 1, 1, -1, 3, -3, /* 16 */ -3, -1, -1, -1, 3, -1, /* 17 */ -3, -3, -1, 1, -1, -3, /* 18 */ -3, -3, -3, 1, -3, -1, @@ -146,36 +146,36 @@ EXTERN const char phi_M_ZC_12[12*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 */ -/* 0 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, -/* 1 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, -/* 2 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, -/* 3 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, -/* 4 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, -/* 5 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, -/* 6 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, -/* 7 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, -/* 8 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, -/* 9 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, -/* 10 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, -/* 11 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, -/* 12 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, -/* 13 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, -/* 14 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, -/* 15 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, -/* 16 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, -/* 17 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, -/* 18 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, +/* 0 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, +/* 1 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, +/* 2 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, +/* 3 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, +/* 4 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, +/* 5 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, +/* 6 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, +/* 7 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, +/* 8 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, +/* 9 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, +/* 10 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, +/* 11 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, +/* 12 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, +/* 13 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, +/* 14 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, +/* 15 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, +/* 16 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, +/* 17 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, +/* 18 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, /* 19 */ -3, -3, 3, -3, -1, 3, 3, 3, -1, -3, 1, -3, -/* 20 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, -/* 21 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, -/* 22 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, -/* 23 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, -/* 24 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, -/* 25 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, -/* 26 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, -/* 27 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, -/* 28 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, -/* 29 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, +/* 20 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, +/* 21 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, +/* 22 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, +/* 23 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, +/* 24 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, +/* 25 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, +/* 26 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, +/* 27 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, +/* 28 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, +/* 29 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, } #endif ; @@ -185,36 +185,36 @@ EXTERN const char phi_M_ZC_18[18*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */ -/* 0 */ 3, -3, 3, -1, 1, 3, -3, -1, -3, -3, -1, -3, 3, 1, -1, 3, -3, 3, -/* 1 */ 3, -3, 1, 1, 3, -1, 1, -1, -1, -3, 1, 1, -1, 3, 3, -3, 3, -1, -/* 2 */ -3, 3, -1, -3, -1, -3, 1, 1, -3, -3, -1, -1, 3, -3, 1, 3, 1, 1, -/* 3 */ 1, 1, -1, -1, -3, -1, 1, -3, -3, -3, 1, -3, -1, -1, 1, -1, 3, 1, -/* 4 */ 1, 1, -3, 3, 3, 1, 3, -3, 3, -1, 1, 1, -1, 1, -3, -3, -1, 3, -/* 5 */ -3, -3, 1, -3, 3, 3, 3, -1, 3, 1, 1, -3, -3, -3, 3, -3, -1, -1, -/* 6 */ -1, 3, -1, -3, 3, 1, -3, -1, 3, -3, -1, -1, 1, 1, 1, -1, -1, -1, -/* 7 */ -3, 1, -3, -3, 1, -3, -3, 3, 1, -3, -1, -3, -3, -3, -1, 1, 1, 3, -/* 8 */ 1, -3, -1, -3, 3, 3, -1, -3, 1, -3, -3, -1, -3, -1, 1, 3, 3, 3, -/* 9 */ -3, 3, 1, -1, -1, -1, -1, 1, -1, 3, 3, -3, -1, 1, 3, -1, 3, -1, -/* 10 */ -3, -3, 1, -1, -1, 1, 1, -3, -1, 3, 3, 3, 3, -1, 3, 1, 3, 1, -/* 11 */ -3, -3, 3, 3, -3, 1, 3, -1, -3, 1, -1, -3, 3, -3, -1, -1, -1, 3, -/* 12 */ -3, -3, 3, 3, 3, 1, -3, 1, 3, 3, 1, -3, -3, 3, -1, -3, -1, 1, -/* 13 */ -3, 3, -1, 1, 3, 1, -3, -1, 1, 1, -3, 1, 3, 3, -1, -3, -3, -3, -/* 14 */ -3, 1, -3, -1, -1, 3, 1, -3, -3, -3, -1, -3, -3, 1, 1, 1, -1, -1, -/* 15 */ -3, -3, 3, 3, 3, -1, -1, -3, -1, -1, -1, 3, 1, -3, -3, -1, 3, -1, -/* 16 */ -3, -1, 3, 3, -1, 3, -1, -3, -1, 1, -1, -3, -1, -1, -1, 3, 3, 1, -/* 17 */ -3, -1, -3, -1, -3, 1, 3, -3, -1, 3, 3, 3, 1, -1, -3, 3, -1, -3, -/* 18 */ -3, 3, 1, -1, -1, 3, -3, -1, 1, 1, 1, 1, 1, -1, 3, -1, -3, -1, -/* 19 */ 3, -1, -3, 1, -3, -3, -3, 3, 3, -1, 1, -3, -1, 3, 1, 1, 3, 3, -/* 20 */ 3, 3, 3, -3, -1, -3, -1, 3, -1, 1, -1, -3, 1, -3, -3, -1, 3, 3, -/* 21 */ 3, -1, 3, 1, -3, -3, -1, 1, -3, -3, 3, 3, 3, 1, 3, -3, 3, -3, -/* 22 */ -3, 1, 1, -3, 1, 1, 3, -3, -1, -3, -1, 3, -3, 3, -1, -1, -1, -3, -/* 23 */ -3, -1, -1, -3, 1, -3, 3, -1, -1, -3, 3, 3, -3, -1, 3, -1, -1, -1, -/* 24 */ -3, -3, -3, 1, -3, 3, 1, 1, 3, -3, -3, 1, 3, -1, 3, -3, -3, 3, -/* 25 */ 1, 1, -3, -3, -3, -3, 1, 3, -3, 3, 3, 1, -3, -1, 3, -1, -3, 1, -/* 26 */ 3, -1, -1, 1, -3, -1, -3, -1, -3, -3, -1, -3, 1, 1, 1, -3, -3, 3, -/* 27 */ 3, 1, -3, 1, -3, 3, 3, -1, -3, -3, -1, -3, -3, 3, -3, -1, 1, 3, +/* 0 */ -1, 3, -1, -3, 3, 1, -3, -1, 3, -3, -1, -1, 1, 1, 1, -1, -1, -1, +/* 1 */ 3, -3, 3, -1, 1, 3, -3, -1, -3, -3, -1, -3, 3, 1, -1, 3, -3, 3, +/* 2 */ -3, 3, 1, -1, -1, 3, -3, -1, 1, 1, 1, 1, 1, -1, 3, -1, -3, -1, +/* 3 */ -3, -3, 3, 3, 3, 1, -3, 1, 3, 3, 1, -3, -3, 3, -1, -3, -1, 1, +/* 4 */ 1, 1, -1, -1, -3, -1, 1, -3, -3, -3, 1, -3, -1, -1, 1, -1, 3, 1, +/* 5 */ 3, -3, 1, 1, 3, -1, 1, -1, -1, -3, 1, 1, -1, 3, 3, -3, 3, -1, +/* 6 */ -3, 3, -1, 1, 3, 1, -3, -1, 1, 1, -3, 1, 3, 3, -1, -3, -3, -3, +/* 7 */ 1, 1, -3, 3, 3, 1, 3, -3, 3, -1, 1, 1, -1, 1, -3, -3, -1, 3, +/* 8 */ -3, 1, -3, -3, 1, -3, -3, 3, 1, -3, -1, -3, -3, -3, -1, 1, 1, 3, +/* 9 */ 3, -1, 3, 1, -3, -3, -1, 1, -3, -3, 3, 3, 3, 1, 3, -3, 3, -3, +/* 10 */ -3, -3, -3, 1, -3, 3, 1, 1, 3, -3, -3, 1, 3, -1, 3, -3, -3, 3, +/* 11 */ -3, -3, 3, 3, 3, -1, -1, -3, -1, -1, -1, 3, 1, -3, -3, -1, 3, -1, +/* 12 */ -3, -1, -3, -3, 1, 1, -1, -3, -1, -3, -1, -1, 3, 3, -1, 3, 1, 3, +/* 13 */ 1, 1, -3, -3, -3, -3, 1, 3, -3, 3, 3, 1, -3, -1, 3, -1, -3, 1, +/* 14 */ -3, 3, -1, -3, -1, -3, 1, 1, -3, -3, -1, -1, 3, -3, 1, 3, 1, 1, +/* 15 */ 3, 1, -3, 1, -3, 3, 3, -1, -3, -3, -1, -3, -3, 3, -3, -1, 1, 3, +/* 16 */ -3, -1, -3, -1, -3, 1, 3, -3, -1, 3, 3, 3, 1, -1, -3, 3, -1, -3, +/* 17 */ -3, -1, 3, 3, -1, 3, -1, -3, -1, 1, -1, -3, -1, -1, -1, 3, 3, 1, +/* 18 */ -3, 1, -3, -1, -1, 3, 1, -3, -3, -3, -1, -3, -3, 1, 1, 1, -1, -1, +/* 19 */ 3, 3, 3, -3, -1, -3, -1, 3, -1, 1, -1, -3, 1, -3, -3, -1, 3, 3, +/* 20 */ -3, 1, 1, -3, 1, 1, 3, -3, -1, -3, -1, 3, -3, 3, -1, -1, -1, -3, +/* 21 */ 1, -3, -1, -3, 3, 3, -1, -3, 1, -3, -3, -1, -3, -1, 1, 3, 3, 3, +/* 22 */ -3, -3, 1, -1, -1, 1, 1, -3, -1, 3, 3, 3, 3, -1, 3, 1, 3, 1, +/* 23 */ 3, -1, -3, 1, -3, -3, -3, 3, 3, -1, 1, -3, -1, 3, 1, 1, 3, 3, +/* 24 */ 3, -1, -1, 1, -3, -1, -3, -1, -3, -3, -1, -3, 1, 1, 1, -3, -3, 3, +/* 25 */ -3, -3, 1, -3, 3, 3, 3, -1, 3, 1, 1, -3, -3, -3, 3, -3, -1, -1, +/* 26 */ -3, -1, -1, -3, 1, -3, 3, -1, -1, -3, 3, 3, -3, -1, 3, -1, -1, -1, +/* 27 */ -3, -3, 3, 3, -3, 1, 3, -1, -3, 1, -1, -3, 3, -3, -1, -1, -1, 3, /* 28 */ -1, -3, 1, -3, -3, -3, 1, 1, 3, 3, -3, 3, 3, -3, -1, 3, -3, 1, -/* 29 */ -3, -1, -3, -3, 1, 1, -1, -3, -1, -3, -1, -1, 3, 3, -1, 3, 1, 3, +/* 29 */ -3, 3, 1, -1, -1, -1, -1, 1, -1, 3, 3, -3, -1, 1, 3, -1, 3, -1, } #endif ; @@ -224,36 +224,36 @@ EXTERN const char phi_M_ZC_24[24*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ -/* 0 */ -1, -3, 3, 1, 1, -3, 1, -3, -3, 1, -3, -1, -1, 3, -3, 3, 3, 3, -3, 1, 3, 3, -3, -3, -/* 1 */ -1, -3, 3, -1, 3, 1, 3, -1, 1, -3, -1, -3, -1, 1, 3, -3, -1, -3, 3, 3, 3, -3, -3, -3, -/* 2 */ -3, 3, 1, 3, -1, 1, -3, 1, -3, 1, -1, -3, -1, -3, -3, -3, -3, -1, -1, -1, 1, 1, -3, -3, -/* 3 */ 3, -1, 3, -1, 1, -3, 1, 1, -3, -3, 3, -3, -1, -1, -1, -1, -1, -3, -3, -1, 1, 1, -3, -3, -/* 4 */ 1, -3, 3, -1, -3, -1, 3, 3, 1, -1, 1, 1, 3, -3, -1, -3, -3, -3, -1, 3, -3, -1, -3, -3, -/* 5 */ 3, -1, 1, -1, 3, -3, 1, 1, 3, -1, -3, 3, 1, -3, 3, -1, -1, -1, -1, 1, -3, -3, -3, -3, -/* 6 */ -3, 3, -1, 3, 1, -1, -1, -1, 3, 3, 1, 1, 1, 3, 3, 1, -3, -3, -1, 1, -3, 1, 3, -3, -/* 7 */ -3, -1, 1, -3, -3, 1, 1, -3, 3, -1, -1, -3, 1, 3, 1, -1, -3, -1, -3, 1, -3, -3, -3, -3, -/* 8 */ -3, 1, -3, 1, -3, -3, 1, -3, 1, -3, -3, -3, -3, -3, 1, -3, -3, 1, 1, -3, 1, 1, -3, -3, -/* 9 */ 3, -3, -3, -1, 3, 3, -3, -1, 3, 1, 1, 1, 3, -1, 3, -3, -1, 3, -1, 3, 1, -1, -3, -3, -/* 10 */ -3, -3, -1, -1, -1, -3, 1, -1, -3, -1, 3, -3, 1, -3, 3, -3, 3, 3, 1, -1, -1, 1, -3, -3, -/* 11 */ -3, -3, 3, 3, 1, -1, -1, -1, 1, -3, -1, 1, -1, 3, -3, -1, -3, -1, -1, 1, -3, 3, -1, -3, -/* 12 */ -3, -3, 1, -1, 3, 3, -3, -1, 1, -1, -1, 1, 1, -1, -1, 3, -3, 1, -3, 1, -1, -1, -1, -3, -/* 13 */ -3, 1, -3, 3, -1, -1, -1, -3, 3, 1, -1, -3, -1, 1, 3, -1, 1, -1, 1, -3, -3, -3, -3, -3, -/* 14 */ -3, -3, -3, -1, 3, -3, 3, 1, 3, 1, -3, -1, -1, -3, 1, 1, 3, 1, -1, -3, 3, 1, 3, -3, -/* 15 */ 1, 1, -1, -3, -1, 1, 1, -3, 1, -1, 1, -3, 3, -3, -3, 3, -1, -3, 1, 3, -3, 1, -3, -3, -/* 16 */ -3, 3, -1, 3, -1, 3, 3, 1, 1, -3, 1, 3, -3, 3, -3, -3, -1, 1, 3, -3, -1, -1, -3, -3, -/* 17 */ -1, -3, -3, 1, -1, -1, -3, 1, 3, -1, -3, -1, -1, -3, 1, 1, 3, 1, -3, -1, -1, 3, -3, -3, -/* 18 */ -3, 1, -3, 1, -3, 1, 1, 3, 1, -3, -3, -1, 1, 3, -1, -3, 3, 1, -1, -3, -3, -3, -3, -3, -/* 19 */ 3, -3, 3, -1, -3, 1, 3, 1, -1, -1, -3, -1, 3, -3, 3, -1, -1, 3, 3, -3, -3, 3, -3, -3, -/* 20 */ -1, 3, -3, -3, -1, 3, -1, -1, 1, 3, 1, 3, -1, -1, -3, 1, 3, 1, -1, -3, 1, -1, -3, -3, -/* 21 */ -3, 1, -3, -1, -1, 3, 1, 3, -3, 1, -1, 3, 3, -1, -3, 3, -3, -1, -1, -3, -3, -3, 3, -3, -/* 22 */ -3, -1, -1, -3, 1, -3, -3, -1, -1, 3, -1, 1, -1, 3, 1, -3, -1, 3, 1, 1, -1, -1, -3, -3, -/* 23 */ -3, 1, -3, 3, -3, 1, -3, 3, 1, -1, -3, -1, -3, -3, -3, -3, 1, 3, -1, 1, 3, 3, 3, -3, -/* 24 */ -3, -1, 1, -3, -1, -1, 1, 1, 1, 3, 3, -1, 1, -1, 1, -1, -1, -3, -3, -3, 3, 1, -1, -3, -/* 25 */ 3, -3, -1, 1, 3, -1, -1, -3, -1, 3, -1, -3, -1, -3, 3, -1, 3, 1, 1, -3, 3, -3, -3, -3, -/* 26 */ -3, 1, 3, -1, 1, -1, 3, -3, 3, -1, -3, -1, -3, 3, -1, -1, -1, -3, -1, -1, -3, 3, 3, -3, -/* 27 */ -3, 3, -1, -3, -1, -1, -1, 3, -1, -1, 3, -3, -1, 3, -3, 3, -3, -1, 3, 1, 1, -1, -3, -3, -/* 28 */ -3, 1, -1, -3, -3, -1, 1, -3, -1, -3, 1, 1, -1, 1, 1, 3, 3, 3, -1, 1, -1, 1, -1, -3, -/* 29 */ -1, 3, -1, -1, 3, 3, -1, -1, -1, 3, -1, -3, 1, 3, 1, 1, -3, -3, -3, -1, -3, -1, -3, -3, +/* 0 */ -1, -3, 3, -1, 3, 1, 3, -1, 1, -3, -1, -3, -1, 1, 3, -3, -1, -3, 3, 3, 3, -3, -3, -3, +/* 1 */ -1, -3, 3, 1, 1, -3, 1, -3, -3, 1, -3, -1, -1, 3, -3, 3, 3, 3, -3, 1, 3, 3, -3, -3, +/* 2 */ -1, -3, -3, 1, -1, -1, -3, 1, 3, -1, -3, -1, -1, -3, 1, 1, 3, 1, -3, -1, -1, 3, -3, -3, +/* 3 */ 1, -3, 3, -1, -3, -1, 3, 3, 1, -1, 1, 1, 3, -3, -1, -3, -3, -3, -1, 3, -3, -1, -3, -3, +/* 4 */ -1, 3, -3, -3, -1, 3, -1, -1, 1, 3, 1, 3, -1, -1, -3, 1, 3, 1, -1, -3, 1, -1, -3, -3, +/* 5 */ -3, -1, 1, -3, -3, 1, 1, -3, 3, -1, -1, -3, 1, 3, 1, -1, -3, -1, -3, 1, -3, -3, -3, -3, +/* 6 */ -3, 3, 1, 3, -1, 1, -3, 1, -3, 1, -1, -3, -1, -3, -3, -3, -3, -1, -1, -1, 1, 1, -3, -3, +/* 7 */ -3, 1, 3, -1, 1, -1, 3, -3, 3, -1, -3, -1, -3, 3, -1, -1, -1, -3, -1, -1, -3, 3, 3, -3, +/* 8 */ -3, 1, -3, 3, -1, -1, -1, -3, 3, 1, -1, -3, -1, 1, 3, -1, 1, -1, 1, -3, -3, -3, -3, -3, +/* 9 */ 1, 1, -1, -3, -1, 1, 1, -3, 1, -1, 1, -3, 3, -3, -3, 3, -1, -3, 1, 3, -3, 1, -3, -3, +/* 10 */ -3, -3, -3, -1, 3, -3, 3, 1, 3, 1, -3, -1, -1, -3, 1, 1, 3, 1, -1, -3, 3, 1, 3, -3, +/* 11 */ -3, 3, -1, 3, 1, -1, -1, -1, 3, 3, 1, 1, 1, 3, 3, 1, -3, -3, -1, 1, -3, 1, 3, -3, +/* 12 */ 3, -3, 3, -1, -3, 1, 3, 1, -1, -1, -3, -1, 3, -3, 3, -1, -1, 3, 3, -3, -3, 3, -3, -3, +/* 13 */ -3, 3, -1, 3, -1, 3, 3, 1, 1, -3, 1, 3, -3, 3, -3, -3, -1, 1, 3, -3, -1, -1, -3, -3, +/* 14 */ -3, 1, -3, -1, -1, 3, 1, 3, -3, 1, -1, 3, 3, -1, -3, 3, -3, -1, -1, -3, -3, -3, 3, -3, +/* 15 */ -3, -1, -1, -3, 1, -3, -3, -1, -1, 3, -1, 1, -1, 3, 1, -3, -1, 3, 1, 1, -1, -1, -3, -3, +/* 16 */ -3, -3, 1, -1, 3, 3, -3, -1, 1, -1, -1, 1, 1, -1, -1, 3, -3, 1, -3, 1, -1, -1, -1, -3, +/* 17 */ 3, -1, 3, -1, 1, -3, 1, 1, -3, -3, 3, -3, -1, -1, -1, -1, -1, -3, -3, -1, 1, 1, -3, -3, +/* 18 */ 3, 1, -3, 1, -3, -3, 1, -3, 1, -3, -3, -3, -3, -3, 1, -3, -3, 1, 1, -3, 1, 1, -3, -3, +/* 19 */ -3, -3, 3, 3, 1, -1, -1, -1, 1, -3, -1, 1, -1, 3, -3, -1, -3, -1, -1, 1, -3, 3, -1, -3, +/* 20 */ -3, -3, -1, -1, -1, -3, 1, -1, -3, -1, 3, -3, 1, -3, 3, -3, 3, 3, 1, -1, -1, 1, -3, -3, +/* 21 */ 3, -1, 1, -1, 3, -3, 1, 1, 3, -1, -3, 3, 1, -3, 3, -1, -1, -1, -1, 1, -3, -3, -3, -3, +/* 22 */ -3, 1, -3, 3, -3, 1, -3, 3, 1, -1, -3, -1, -3, -3, -3, -3, 1, 3, -1, 1, 3, 3, 3, -3, +/* 23 */ -3, -1, 1, -3, -1, -1, 1, 1, 1, 3, 3, -1, 1, -1, 1, -1, -1, -3, -3, -3, 3, 1, -1, -3, +/* 24 */ -3, 3, -1, -3, -1, -1, -1, 3, -1, -1, 3, -3, -1, 3, -3, 3, -3, -1, 3, 1, 1, -1, -3, -3, +/* 25 */ -3, 1, -1, -3, -3, -1, 1, -3, -1, -3, 1, 1, -1, 1, 1, 3, 3, 3, -1, 1, -1, 1, -1, -3, +/* 26 */ -1, 3, -1, -1, 3, 3, -1, -1, -1, 3, -1, -3, 1, 3, 1, 1, -3, -3, -3, -1, -3, -1, -3, -3, +/* 27 */ 3, -3, -3, -1, 3, 3, -3, -1, 3, 1, 1, 1, 3, -1, 3, -3, -1, 3, -1, 3, 1, -1, -3, -3, +/* 28 */ -3, 1, -3, 1, -3, 1, 1, 3, 1, -3, -3, -1, 1, 3, -1, -3, 3, 1, -1, -3, -3, -3, -3, -3, +/* 29 */ 3, -3, -1, 1, 3, -1, -1, -3, -1, 3, -1, -3, -1, -3, 3, -1, 3, 1, 1, -3, 3, -3, -3, -3, } #endif ; diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 8c1d2ac683..b530dcf482 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -35,7 +35,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS frame_parms=gNB->frame_parms; int32_t **txdataF = gNB->common_vars.txdataF; - int txdataF_offset = (slot%2)*frame_parms.samples_per_slot_wCP; + int txdataF_offset = slot*frame_parms.samples_per_slot_wCP; uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; //*8(max allocation per RB)*2(QPSK)) int csi_rs_length = frame_parms.N_RB_DL<<4; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index f26464fd70..d233eb9ba6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -66,12 +66,11 @@ void nr_pdcch_scrambling(uint32_t *in, } } -void nr_generate_dci(PHY_VARS_gNB *gNB, - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, - uint32_t **gold_pdcch_dmrs, - int32_t *txdataF, - int16_t amp, - NR_DL_FRAME_PARMS *frame_parms) { +void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, + uint32_t **gold_pdcch_dmrs, + int32_t *txdataF, + int16_t amp, + NR_DL_FRAME_PARMS *frame_parms) { int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(16))); // 3 for the max coreset duration uint16_t cset_start_sc; @@ -84,7 +83,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int n_rb; // compute rb_offset and n_prb based on frequency allocation - nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); + nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL]; + nr_fill_cce_list(cce_list,0,pdcch_pdu_rel15); get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); cset_start_sc = frame_parms->first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB; @@ -175,7 +175,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int reg_list_order[NR_MAX_PDCCH_AGG_LEVEL] = {}; for (int p = 0; p < NR_MAX_PDCCH_AGG_LEVEL; p++) { for(int p2 = 0; p2 < dci_pdu->AggregationLevel; p2++) { - if(gNB->cce_list[d][p2].reg_list[0].reg_idx == p * NR_NB_REG_PER_CCE) { + if(cce_list[d][p2].reg_list[0].reg_idx == p * NR_NB_REG_PER_CCE) { reg_list_order[reg_list_index] = p2; reg_list_index++; break; @@ -191,7 +191,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) { - k = cset_start_sc + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx; + k = cset_start_sc + cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx; if (k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; @@ -200,9 +200,9 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) - dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx) * 3; + dmrs_idx = (cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx) * 3; else - dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx + rb_offset) * 3; + dmrs_idx = (cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx + rb_offset) * 3; k_prime = 0; @@ -250,21 +250,16 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, } // for (int d=0;dnumDlDci;d++) } -void nr_generate_dci_top(PHY_VARS_gNB *gNB, - nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, - nfapi_nr_dl_tti_pdcch_pdu *ul_dci_pdu, - uint32_t **gold_pdcch_dmrs, - int32_t *txdataF, - int16_t amp, - NR_DL_FRAME_PARMS *frame_parms) { +void nr_generate_dci_top(processingData_L1tx_t *msgTx, + uint32_t **gold_pdcch_dmrs, + int32_t *txdataF, + int16_t amp, + NR_DL_FRAME_PARMS *frame_parms) { - AssertFatal(pdcch_pdu!=NULL || ul_dci_pdu!=NULL,"At least one pointer has to be !NULL\n"); + for (int i=0; inum_ul_pdcch; i++) + nr_generate_dci(&msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms); + for (int i=0; inum_dl_pdcch; i++) + nr_generate_dci(&msgTx->pdcch_pdu[i].pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms); - if (pdcch_pdu) { - nr_generate_dci(gNB,&pdcch_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms); - } - if (ul_dci_pdu) { - nr_generate_dci(gNB,&ul_dci_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms); - } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.h b/openair1/PHY/NR_TRANSPORT/nr_dci.h index 07baaf2728..bdc8509d12 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.h @@ -29,13 +29,11 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format, nfapi_nr_rnti_type_e rnti_type, uint16_t N_RB); -void nr_generate_dci_top(PHY_VARS_gNB *gNB, - nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, - nfapi_nr_dl_tti_pdcch_pdu *ul_pdcch_pdu, - uint32_t **gold_pdcch_dmrs, - int32_t *txdataF, - int16_t amp, - NR_DL_FRAME_PARMS *frame_parms); +void nr_generate_dci_top(processingData_L1tx_t *msgTx, + uint32_t **gold_pdcch_dmrs, + int32_t *txdataF, + int16_t amp, + NR_DL_FRAME_PARMS *frame_parms); void nr_pdcch_scrambling(uint32_t *in, uint32_t size, @@ -57,6 +55,6 @@ void nr_fill_ul_dci(PHY_VARS_gNB *gNB, int slot, nfapi_nr_ul_dci_request_pdus_t *pdcch_pdu); -void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m,nfapi_nr_dl_tti_pdcch_pdu_rel15_t *); +void nr_fill_cce_list(nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL], uint8_t m,nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15); #endif //__PHY_NR_TRANSPORT_DCI__H diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index 1675045443..8d5eb4a660 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -119,7 +119,7 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint16_t n_shift, uint8_t m) { */ -void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15) { +void nr_fill_cce_list(nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL], uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15) { nr_cce_t* cce; nr_reg_t* reg; @@ -156,7 +156,7 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r if (pdcch_pdu_rel15->dci_pdu[d].RNTI != 0xFFFF) LOG_D(PHY, "CCE list generation for candidate %d: bundle size %d ilv size %d CceIndex %d\n", m, bsize, R, pdcch_pdu_rel15->dci_pdu[d].CceIndex); for (uint8_t cce_idx=0; cce_idxcce_list[d][cce_idx]; + cce = &cce_list[d][cce_idx]; cce->cce_idx = pdcch_pdu_rel15->dci_pdu[d].CceIndex + cce_idx; LOG_D(PHY, "cce_idx %d\n", cce->cce_idx); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index b70b07f215..104aee94f0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -47,70 +47,11 @@ void nr_pdsch_codeword_scrambling(uint8_t *in, uint8_t q, uint32_t Nid, uint32_t n_RNTI, - uint32_t* out) { - - uint8_t reset, b_idx; - uint32_t x1, x2, s=0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_CODEWORD_SCRAMBLING, 1); - reset = 1; - x2 = (n_RNTI<<15) + (q<<14) + Nid; - - for (int i=0; i>b_idx)&1))<>5)+((size&0x1f) > 0 ? 1 : 0)); i++) { - in32=_mm256_movemask_epi8(_mm256_slli_epi16(((__m256i*)in)[i],7)); - out[i]=(in32^s); - //printf("in[%d] %x => %x\n",i,in32,out[i]); - s=lte_gold_generic(&x1, &x2, 0); - } -#elif defined(__SSE4__) - _m128i *in128; - for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++) { - in128=&((__m128i*)in)[i<<1]; - ((uint16_t*)&in32)[0] = _mm128_movemask_epi8(_mm256_slli_epi16(in128[0],7)); - ((uint16_t*)&in32)[1] = _mm128_movemask_epi8(_mm256_slli_epi16(in128[1],7)); - out[i]=(in32^s); - s=lte_gold_generic(&x1, &x2, 0); - } - //#elsif defined(__arm__) || defined(__aarch64) - -#else - nr_pdsch_codeword_scrambling(in, - size, - q, - Nid, - n_RNTI, - out); -#endif -} - - void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) { @@ -182,12 +123,13 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * rel15->nrOfLayers] __attribute__((aligned(32))); bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * rel15->nrOfLayers); start_meas(dlsch_encoding_stats); - nr_dlsch_encoding(gNB, - harq->pdu, frame, slot, dlsch, frame_parms, output, - tinput,tprep,tparity,toutput, - dlsch_rate_matching_stats, - dlsch_interleaving_stats, - dlsch_segmentation_stats); + + if (nr_dlsch_encoding(gNB, + harq->pdu, frame, slot, dlsch, frame_parms,output,tinput,tprep,tparity,toutput, + dlsch_rate_matching_stats, + dlsch_interleaving_stats, + dlsch_segmentation_stats) == -1) + return; stop_meas(dlsch_encoding_stats); #ifdef DEBUG_DLSCH printf("PDSCH encoding:\nPayload:\n"); @@ -212,12 +154,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, for (int q=0; qNrOfCodewords; q++) memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t)); for (int q=0; qNrOfCodewords; q++) - nr_pdsch_codeword_scrambling_optim(output, - encoded_length, - q, - rel15->dataScramblingId, - rel15->rnti, - scrambled_output[q]); + nr_pdsch_codeword_scrambling(output, + encoded_length, + q, + rel15->dataScramblingId, + rel15->rnti, + scrambled_output[q]); stop_meas(dlsch_scrambling_stats); #ifdef DEBUG_DLSCH @@ -275,10 +217,10 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; - int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; + 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; layernrOfLayers; layer++) - txdataF_precoding[layer] = (int16_t *)malloc16(2*2*14*frame_parms->ofdm_symbol_size*sizeof(int16_t)); + 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", @@ -377,12 +319,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, /* Map DMRS Symbol */ if ( (dmrs_symbol_map & (1 << l)) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", - dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); #endif dmrs_idx++; k_prime++; @@ -390,8 +332,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, n+=(k_prime)?0:1; } else if(is_ptrs_re){ - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; #ifdef DEBUG_DLSCH_MAPPING printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d, mod_ptrs: %d %d\n", ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], @@ -401,19 +343,19 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } /* Map DATA Symbol */ else if( ptrs_symbol || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (amp * tx_layers[ap][m<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); #endif m++; } /* mute RE */ else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; } if (++k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; @@ -429,7 +371,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } // fix the alignment issues later, use 64-bit SIMD below instead of 128. if (0/*(frame_parms->N_RB_DL&1)==0*/) { - __m128i *txF=(__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc+txdataF_offset)<<1)]; + __m128i *txF=(__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; __m128i *txl = (__m128i*)&tx_layers[ap][m<<1]; __m128i amp128=_mm_set1_epi16(amp); @@ -438,7 +380,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } //RE loop, first part m+=upper_limit; if (remaining_re > 0) { - txF = (__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+txdataF_offset)<<1)]; + txF = (__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size)<<1)]; txl = (__m128i*)&tx_layers[ap][m<<1]; for (int i=0; i<(remaining_re>>2); i++) { txF[i] = _mm_mulhrs_epi16(amp128,txl[i]); @@ -446,7 +388,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } } else { - __m64 *txF=(__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc+txdataF_offset)<<1)]; + __m64 *txF=(__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; __m64 *txl = (__m64*)&tx_layers[ap][m<<1]; __m64 amp64=_mm_set1_pi16(amp); @@ -456,31 +398,31 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, #ifdef DEBUG_DLSCH_MAPPING if ((i&1) > 0) printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, start_sc+(i>>1), txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + (2*txdataF_offset)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1 + (2*txdataF_offset)]); + m, l, start_sc+(i>>1), txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]); #endif /* handle this, mute RE */ /*else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; }*/ } //RE loop, first part m+=upper_limit; if (remaining_re > 0) { - txF = (__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+txdataF_offset)<<1)]; + txF = (__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size)<<1)]; txl = (__m64*)&tx_layers[ap][m<<1]; for (int i=0; i<(remaining_re>>1); i++) { txF[i] = _mm_mulhrs_pi16(amp64,txl[i]); #ifdef DEBUG_DLSCH_MAPPING if ((i&1) > 0) printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, i>>1, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + (2*txdataF_offset)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1 + (2*txdataF_offset)]); + m, l, i>>1, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]); #endif /* handle this, mute RE */ /*else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; }*/ } //RE loop, second part } // @@ -517,7 +459,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, if (pmi == 0) {//unitary Precoding if(apnrOfLayers) memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], - (void*)&txdataF_precoding[ap][2*(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], @@ -558,7 +500,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } for (int i=0; iofdm_symbol_size + k; - int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); + int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset); ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1]; #ifdef DEBUG_DLSCH_MAPPING diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index b47deec646..420638b7eb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -110,7 +110,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, a_segments = a_segments/273 +1; } - uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment + uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t)); AssertFatal(dlsch, "cannot allocate dlsch\n"); bzero(dlsch,sizeof(NR_gNB_DLSCH_t)); @@ -262,7 +262,7 @@ void ldpc8blocks( void *p) { #ifdef DEBUG_DLSCH_CODING for (int i =0; i<16; i++) - printf("output ratematching e[%d]= %d r_offset %u\n", i,harq->e[i+r_offset], r_offset); + printf("output ratematching e[%d]= %d r_offset %u\n", i,e[i], r_offset); #endif nr_interleaving_ldpc(E, @@ -384,11 +384,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //d_tmp[r] = &harq->d[r][0]; //channel_input[r] = &harq->d[r][0]; #ifdef DEBUG_DLSCH_CODING - LOG_D(PHY,"Encoder: B %d F %d \n",harq->B, impp->F); + LOG_D(PHY,"Encoder: B %d F %d \n",harq->B, impp.F); LOG_D(PHY,"start ldpc encoder segment %d/%d\n",r,impp.n_segments); LOG_D(PHY,"input %d %d %d %d %d \n", harq->c[r][0], harq->c[r][1], harq->c[r][2],harq->c[r][3], harq->c[r][4]); - for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++) { + for (int cnt =0 ; cnt < 22*(*impp.Zc)/8; cnt ++) { LOG_D(PHY,"%d ", harq->c[r][cnt]); } @@ -419,6 +419,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req=pullTpool(&nf, gNB->threadPool); delNotifiedFIFO_elt(req); nbJobs--; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT); return 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index a4cec432de..bf5edccb1b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -219,8 +219,7 @@ void nr_init_pbch_interleaver(uint8_t *interleaver) { *(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_ssb++); } -int nr_generate_pbch(NR_gNB_PBCH *pbch, - nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, +int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, uint8_t *interleaver, int32_t *txdataF, int16_t amp, @@ -239,6 +238,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, uint64_t a_reversed=0; LOG_D(PHY, "PBCH generation started\n"); ///Payload generation + NR_gNB_PBCH m_pbch; + NR_gNB_PBCH *pbch = &m_pbch; memset((void *)pbch, 0, sizeof(NR_gNB_PBCH)); pbch->pbch_a=0; uint8_t ssb_index = ssb_pdu->ssb_pdu_rel15.SsbBlockIndex; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pss.c b/openair1/PHY/NR_TRANSPORT/nr_pss.c index 535ce99143..8564efe3de 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pss.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pss.c @@ -24,55 +24,47 @@ //#define NR_PSS_DEBUG -int nr_generate_pss( int16_t *d_pss, - int32_t *txdataF, +int nr_generate_pss( int32_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t* config, NR_DL_FRAME_PARMS *frame_parms) { - int i,k,l,m; - int16_t a; int16_t x[NR_PSS_LENGTH]; const int x_initial[7] = {0, 1, 1 , 0, 1, 1, 1}; - uint8_t Nid2 = config->cell_config.phy_cell_id.value % 3; - /// Sequence generation - for (i=0; i < 7; i++) + for (int i=0; i < 7; i++) x[i] = x_initial[i]; - for (i=0; i < (NR_PSS_LENGTH - 7); i++) { + for (int i=0; i < (NR_PSS_LENGTH - 7); i++) { x[i+7] = (x[i + 4] + x[i]) %2; } - for (i=0; i < NR_PSS_LENGTH; i++) { - m = (i + 43*Nid2)%(NR_PSS_LENGTH); - d_pss[i] = (1 - 2*x[m]) * 23170; - } - #ifdef NR_PSS_DEBUG write_output("d_pss.m", "d_pss", (void*)d_pss, NR_PSS_LENGTH, 1, 0); printf("PSS: ofdm_symbol_size %d, first_carrier_offset %d\n",frame_parms->ofdm_symbol_size,frame_parms->first_carrier_offset); #endif /// Resource mapping - a = amp; - // PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from - k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and - if (k>= frame_parms->ofdm_symbol_size) k-=frame_parms->ofdm_symbol_size; + // PSS occupies a predefined position (subcarriers 56-182, symbol 0) within the SSB block starting from + int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and + if (k>= frame_parms->ofdm_symbol_size) k-=frame_parms->ofdm_symbol_size; - l = ssb_start_symbol; + int l = ssb_start_symbol; - for (m = 0; m < NR_PSS_LENGTH; m++) { - // printf("pss: writing position k %d / %d\n",k,frame_parms->ofdm_symbol_size); - ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_pss[m]) >> 15; - k++; + uint8_t Nid2 = config->cell_config.phy_cell_id.value % 3; + for (int i = 0; i < NR_PSS_LENGTH; i++) { + int m = (i + 43*Nid2)%(NR_PSS_LENGTH); + int16_t d_pss = (1 - 2*x[m]) * 23170; + // printf("pss: writing position k %d / %d\n",k,frame_parms->ofdm_symbol_size); + ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (((int16_t)amp) * d_pss) >> 15; + k++; - if (k >= frame_parms->ofdm_symbol_size) - k-=frame_parms->ofdm_symbol_size; - } + if (k >= frame_parms->ofdm_symbol_size) + k-=frame_parms->ofdm_symbol_size; + } #ifdef NR_PSS_DEBUG LOG_M("pss_0.m", "pss_0", diff --git a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c new file mode 100644 index 0000000000..b68ad2d89f --- /dev/null +++ b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c @@ -0,0 +1,107 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_transport_common_proto.h" +#include "PHY/NR_REFSIG/nr_refsig.h" +#include "common/utils/LOG/vcd_signal_dumper.h" + +void nr_codeword_scrambling(uint8_t *in, + uint32_t size, + uint8_t q, + uint32_t Nid, + uint32_t n_RNTI, + uint32_t* out) +{ + uint32_t x1; + uint32_t x2 = (n_RNTI<<15) + (q<<14) + Nid; + uint32_t s = 0; + +#if defined(__AVX2__) + s=lte_gold_generic(&x1, &x2, 1); + for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++) { + __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]); + s=lte_gold_generic(&x1, &x2, 0); + } +#elif defined(__SSE4__) + s=lte_gold_generic(&x1, &x2, 1); + __m128i *in128; + for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++) { + in128=&((__m128i*)in)[i<<1]; + uint32_t in32; + ((uint16_t*)&in32)[0] = _mm_movemask_epi8(_mm_slli_epi16(in128[0],7)); + ((uint16_t*)&in32)[1] = _mm_movemask_epi8(_mm_slli_epi16(in128[1],7)); + out[i]=(in32^s); + s=lte_gold_generic(&x1, &x2, 0); + } +//#elsif defined(__arm__) || defined(__aarch64) +#else + uint8_t reset = 1; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_CODEWORD_SCRAMBLING, 1); + for (int i = 0; i < size; i++) { + const uint8_t b_idx = i&0x1f; + if (b_idx==0) { + s = lte_gold_generic(&x1, &x2, reset); + reset = 0; + if (i) + out++; + } + *out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<> 5) + ((size & 0x1f) > 0 ? 1 : 0)); i++, j += 4) { + llr128[j] = _mm_mullo_epi16(llr128[j],byte2m128i[s8[0]]); + llr128[j+1] = _mm_mullo_epi16(llr128[j+1],byte2m128i[s8[1]]); + llr128[j+2] = _mm_mullo_epi16(llr128[j+2],byte2m128i[s8[2]]); + llr128[j+3] = _mm_mullo_epi16(llr128[j+3],byte2m128i[s8[3]]); + s = lte_gold_generic(&x1, &x2, 0); + } +#else + uint8_t reset = 1; + + for (uint32_t i=0; i>(i&0x1f))&1)==1) + llr[i] = -llr[i]; + } +#endif +} diff --git a/openair1/PHY/NR_TRANSPORT/nr_sss.c b/openair1/PHY/NR_TRANSPORT/nr_sss.c index de92237f6c..5181f6bac1 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_sss.c +++ b/openair1/PHY/NR_TRANSPORT/nr_sss.c @@ -23,42 +23,34 @@ //#define NR_SSS_DEBUG -int nr_generate_sss( int16_t *d_sss, - int32_t *txdataF, +int nr_generate_sss( int32_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t* config, NR_DL_FRAME_PARMS *frame_parms) { - int i,k,l; - int m0, m1; - int Nid, Nid1, Nid2; - //int16_t a; - int16_t x0[NR_SSS_LENGTH], x1[NR_SSS_LENGTH]; + int16_t x0[NR_SSS_LENGTH]; + int16_t x1[NR_SSS_LENGTH]; const int x0_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; const int x1_initial[7] = { 1, 0, 0, 0, 0, 0, 0 }; /// Sequence generation - Nid = config->cell_config.phy_cell_id.value; - Nid2 = Nid % 3; - Nid1 = (Nid - Nid2)/3; + int Nid = config->cell_config.phy_cell_id.value; + int Nid2 = Nid % 3; + int Nid1 = (Nid - Nid2)/3; - for ( i=0 ; i < 7 ; i++) { + for (int i=0; i < 7; i++) { x0[i] = x0_initial[i]; x1[i] = x1_initial[i]; } - for ( i=0 ; i < NR_SSS_LENGTH - 7 ; i++) { + for (int i=0; i < NR_SSS_LENGTH - 7; i++) { x0[i+7] = (x0[i + 4] + x0[i]) % 2; x1[i+7] = (x1[i + 1] + x1[i]) % 2; } - m0 = 15*(Nid1/112) + (5*Nid2); - m1 = Nid1 % 112; - - for (i = 0; i < NR_SSS_LENGTH ; i++) { - d_sss[i] = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 23170; - } + int m0 = 15*(Nid1/112) + (5*Nid2); + int m1 = Nid1 % 112; #ifdef NR_SSS_DEBUG write_output("d_sss.m", "d_sss", (void*)d_sss, NR_SSS_LENGTH, 1, 1); @@ -66,17 +58,18 @@ int nr_generate_sss( int16_t *d_sss, /// Resource mapping - // SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from - k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and - l = ssb_start_symbol + 2; + // SSS occupies a predefined position (subcarriers 56-182, symbol 2) within the SSB block starting from + int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and + int l = ssb_start_symbol + 2; - for (int m = 0; m < NR_SSS_LENGTH; m++) { - ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (amp * d_sss[m]) >> 15; - k++; + for (int i = 0; i < NR_SSS_LENGTH; i++) { + int16_t d_sss = (1 - 2*x0[(i + m0) % NR_SSS_LENGTH] ) * (1 - 2*x1[(i + m1) % NR_SSS_LENGTH] ) * 23170; + ((int16_t*)txdataF)[2*(l*frame_parms->ofdm_symbol_size + k)] = (((int16_t)amp) * d_sss) >> 15; + k++; - if (k >= frame_parms->ofdm_symbol_size) - k-=frame_parms->ofdm_symbol_size; - } + if (k >= frame_parms->ofdm_symbol_size) + k-=frame_parms->ofdm_symbol_size; + } #ifdef NR_SSS_DEBUG // write_output("sss_0.m", "sss_0", (void*)txdataF[0][l*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h index 02e594e76a..2daf2af1fb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h @@ -77,6 +77,15 @@ void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map); void init_nr_prach_tables(int N_ZC); +void nr_codeword_scrambling(uint8_t *in, + uint32_t size, + uint8_t q, + uint32_t Nid, + uint32_t n_RNTI, + uint32_t* out); + +void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI); + /**@}*/ void init_pucch2_luts(void); diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index d9cc2be07c..f54d5e6707 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -44,8 +44,7 @@ @param @returns 0 on success */ -int nr_generate_pss(int16_t *d_pss, - int32_t *txdataF, +int nr_generate_pss(int32_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -57,8 +56,7 @@ int nr_generate_pss(int16_t *d_pss, @param @returns 0 on success */ -int nr_generate_sss(int16_t *d_sss, - int32_t *txdataF, +int nr_generate_sss(int32_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -83,8 +81,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, @param @returns 0 on success */ -int nr_generate_pbch(NR_gNB_PBCH *pbch, - nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, +int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, uint8_t *interleaver, int32_t *txdataF, int16_t amp, @@ -310,6 +307,24 @@ int nr_find_pucch(uint16_t rnti, int slot, PHY_VARS_gNB *gNB); +NR_gNB_SRS_t *new_gNB_srs(void); + +int nr_find_srs(uint16_t rnti, + int frame, + int slot, + PHY_VARS_gNB *gNB); + +void nr_fill_srs(PHY_VARS_gNB *gNB, + int frame, + int slot, + nfapi_nr_srs_pdu_t *srs_pdu); + +int nr_get_srs_signal(PHY_VARS_gNB *gNB, + int frame, + int slot, + nfapi_nr_srs_pdu_t *srs_pdu, + nr_srs_info_t *nr_srs_info, + int32_t **srs_received_signal); void init_prach_list(PHY_VARS_gNB *gNB); void init_prach_ru_list(RU_t *ru); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index c7c7fdd2d4..3e3137739e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -33,7 +33,6 @@ #include #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" -#include "PHY/NR_REFSIG/nr_refsig.h" int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { @@ -81,59 +80,9 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, } -void nr_ulsch_unscrambling(int16_t* llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI) { - - uint8_t reset; - uint32_t x1, x2, s=0; - - reset = 1; - x2 = (n_RNTI<<15) + Nid; - - for (uint32_t i=0; i>(i&0x1f))&1)==1) - llr[i] = -llr[i]; - } -} - -void nr_ulsch_unscrambling_optim(int16_t* llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI) { - -#if defined(__x86_64__) || defined(__i386__) - uint32_t x1, x2, s=0; - - x2 = (n_RNTI<<15) + Nid; - - uint8_t *s8=(uint8_t *)&s; - __m128i *llr128 = (__m128i*)llr; - int j=0; - s = lte_gold_generic(&x1, &x2, 1); - - for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++,j+=4) { - llr128[j] = _mm_mullo_epi16(llr128[j],byte2m128i[s8[0]]); - llr128[j+1] = _mm_mullo_epi16(llr128[j+1],byte2m128i[s8[1]]); - llr128[j+2] = _mm_mullo_epi16(llr128[j+2],byte2m128i[s8[2]]); - llr128[j+3] = _mm_mullo_epi16(llr128[j+3],byte2m128i[s8[3]]); - s = lte_gold_generic(&x1, &x2, 0); - } -#else - - nr_ulsch_unscrambling(llr, - size, - q, - Nid, - n_RNTI); -#endif +void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n_RNTI) +{ + nr_codeword_unscrambling(llr, size, 0, Nid, n_RNTI); } void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) { diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h index 80c10d74b1..f7bb3be577 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h @@ -69,18 +69,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, @param n_RNTI, CRNTI */ -void nr_ulsch_unscrambling(int16_t* llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI); - - -void nr_ulsch_unscrambling_optim(int16_t* llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI); +void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n_RNTI); void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 38b4465de8..4b5b2c1417 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -119,7 +119,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint a_segments = a_segments/273 +1; } - uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment + uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t)); ulsch->max_ldpc_iterations = max_ldpc_iterations; @@ -463,7 +463,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,1); harq_process->TBS = pusch_pdu->pusch_data.tb_size; - harq_process->round = nr_rv_round_map[pusch_pdu->pusch_data.rv_index]; + harq_process->round = nr_rv_to_round(pusch_pdu->pusch_data.rv_index); harq_process->new_rx = false; // flag to indicate if this is a new reception for this harq (initialized to false) if (harq_process->round == 0) { diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index b44f7e3b02..c0812428e2 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -328,7 +328,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n", mcs[i],seq_index,corr_re[0][0],corr_im[0][0], 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0])); - if (pucch_pdu->nr_of_symbols==2) + if (pucch_pdu->nr_of_symbols==2) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n", mcs[i],seq_index,corr_re[0][1],corr_im[0][1], 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1])); @@ -431,9 +431,11 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->num_harq = 1; uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); + uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %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, energy %f, sync_pos %d\n", frame,slot,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,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); + if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; @@ -447,6 +449,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->num_harq = 2; uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); + 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 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", diff --git a/openair1/PHY/NR_TRANSPORT/srs_rx.c b/openair1/PHY/NR_TRANSPORT/srs_rx.c new file mode 100644 index 0000000000..c16becdb20 --- /dev/null +++ b/openair1/PHY/NR_TRANSPORT/srs_rx.c @@ -0,0 +1,139 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/NR_TRANSPORT/srs_rx.c + * \brief Top-level routines for getting the SRS physical channel + * \date 2021 + * \version 1.0 + */ + +#include +#include +#include +#include + +#include "PHY/impl_defs_nr.h" +#include "PHY/defs_nr_common.h" +#include "PHY/defs_gNB.h" +#include +#include "common/utils/LOG/log.h" + +#include "nfapi/oai_integration/vendor_ext.h" + +#include "T.h" + +//#define SRS_DEBUG + +NR_gNB_SRS_t *new_gNB_srs(void){ + NR_gNB_SRS_t *srs; + srs = (NR_gNB_SRS_t *)malloc16(sizeof(NR_gNB_SRS_t)); + srs->active = 0; + return (srs); +} + +int nr_find_srs(uint16_t rnti, + int frame, + int slot, + PHY_VARS_gNB *gNB) { + + AssertFatal(gNB!=NULL,"gNB is null\n"); + int index = -1; + + for (int i=0; isrs[i]!=NULL,"gNB->srs[%d] is null\n",i); + if ((gNB->srs[i]->active>0) && + (gNB->srs[i]->srs_pdu.rnti==rnti) && + (gNB->srs[i]->frame==frame) && + (gNB->srs[i]->slot==slot)) return(i); + else if ((gNB->srs[i]->active == 0) && (index==-1)) index=i; + } + + if (index==-1) + LOG_E(MAC,"SRS list is full\n"); + + return(index); +} + +void nr_fill_srs(PHY_VARS_gNB *gNB, + int frame, + int slot, + nfapi_nr_srs_pdu_t *srs_pdu) { + + int id = nr_find_srs(srs_pdu->rnti,frame,slot,gNB); + AssertFatal( (id>=0) && (idrnti,id); + + NR_gNB_SRS_t *srs = gNB->srs[id]; + srs->frame = frame; + srs->slot = slot; + srs->active = 1; + memcpy((void*)&srs->srs_pdu, (void*)srs_pdu, sizeof(nfapi_nr_srs_pdu_t)); +} + +int nr_get_srs_signal(PHY_VARS_gNB *gNB, + int frame, + int slot, + nfapi_nr_srs_pdu_t *srs_pdu, + nr_srs_info_t *nr_srs_info, + int32_t **srs_received_signal) { + + if(nr_srs_info->sc_list_length == 0) { + LOG_E(NR_PHY, "(%d.%d) nr_srs_info was not generated yet!\n", frame, slot); + return -1; + } + + int32_t **rxdataF = gNB->common_vars.rxdataF; + NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; + + uint16_t n_symbols = (slot&3)*frame_parms->symbols_per_slot; // number of symbols until this slot + uint8_t l0 = frame_parms->symbols_per_slot - 1 - srs_pdu->time_start_position; // starting symbol in this slot + uint64_t symbol_offset = (n_symbols+l0)*frame_parms->ofdm_symbol_size; + + int32_t *rx_signal; + for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) { + + memset(srs_received_signal[ant], 0, frame_parms->ofdm_symbol_size*sizeof(int32_t)); + rx_signal = &rxdataF[ant][symbol_offset]; + + for(int sc_idx = 0; sc_idx < nr_srs_info->sc_list_length; sc_idx++) { + srs_received_signal[ant][nr_srs_info->sc_list[sc_idx]] = rx_signal[nr_srs_info->sc_list[sc_idx]]; + +#ifdef SRS_DEBUG + uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12; + int subcarrier_log = nr_srs_info->sc_list[sc_idx]-subcarrier_offset; + if(subcarrier_log < 0) { + subcarrier_log = subcarrier_log + frame_parms->ofdm_symbol_size; + } + if(sc_idx == 0) { + LOG_I(NR_PHY,"________ Rx antenna %i ________\n", ant); + } + if(subcarrier_log%12 == 0) { + LOG_I(NR_PHY,"::::::::::::: %i :::::::::::::\n", subcarrier_log/12); + } + LOG_I(NR_PHY,"(%i) \t%i\t%i\n", + subcarrier_log, + (int16_t)(srs_received_signal[ant][nr_srs_info->sc_list[sc_idx]]&0xFFFF), + (int16_t)((srs_received_signal[ant][nr_srs_info->sc_list[sc_idx]]>>16)&0xFFFF)); +#endif + } + } + return 0; +} \ No newline at end of file diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c index 65ae288252..0c520aabe7 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.c @@ -260,3 +260,26 @@ short filt8_avlip5[8] = { short filt8_avlip6[8] = { 13653,15019,16384,16384,16384,16384,16384,16384}; + +// Comb size 2 +short filt8_start[8] = { + 12288,8192,4096,0,0,0,0,0}; + +short filt8_middle2[8] = { + 4096,8192,8192,8192,4096,0,0,0}; + +short filt8_middle4[8] = { + 0,0,4096,8192,8192,8192,4096,0}; + +short filt8_end[8] = { + 4096,8192,12288,16384,0,0,0,0}; + +// Comb size 4 +short filt16_start[16] = { + 12288,8192,8192,8192,4096,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_middle4[16] = { + 4096,8192,8192,8192,8192,8192,8192,8192,4096,0,0,0,0,0,0,0}; + +short filt16_end[16] = { + 4096,8192,8192,8192,12288,16384,16384,16384,0,0,0,0,0,0,0,0}; \ No newline at end of file diff --git a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h index e28736b51d..72d1318545 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h +++ b/openair1/PHY/NR_UE_ESTIMATION/filt16a_32.h @@ -182,4 +182,15 @@ extern short filt8_avlip4[8]; extern short filt8_avlip5[8]; extern short filt8_avlip6[8]; + +/*Comb size 2*/ +extern short filt8_start[8]; +extern short filt8_middle2[8]; +extern short filt8_middle4[8]; +extern short filt8_end[8]; + +/*Comb size 4*/ +extern short filt16_start[16]; +extern short filt16_middle4[16]; +extern short filt16_end[16]; #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 5bdea8be38..877b458ce7 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -124,7 +124,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint a_segments = (a_segments/273)+1; } - uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment + uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment dlsch = (NR_UE_DLSCH_t *)malloc16(sizeof(NR_UE_DLSCH_t)); if (dlsch) { @@ -177,25 +177,9 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint return(NULL); } -void nr_dlsch_unscrambling(int16_t *llr, - uint32_t size, - uint8_t q, - uint32_t Nid, - uint32_t n_RNTI) { - uint8_t reset; - uint32_t x1, x2, s=0; - reset = 1; - x2 = (n_RNTI<<15) + (q<<14) + Nid; - - for (int i=0; i>(i&0x1f))&1)==1) - llr[i] = -llr[i]; - } +void nr_dlsch_unscrambling(int16_t *llr, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI) +{ + nr_codeword_unscrambling(llr, size, q, Nid, n_RNTI); } bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool last, notifiedFIFO_t *nf_p) { @@ -204,6 +188,10 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch; int r = rdata->segment_r; + merge_meas(&phy_vars_ue->dlsch_deinterleaving_stats, &rdata->ts_deinterleave); + merge_meas(&phy_vars_ue->dlsch_rate_unmatching_stats, &rdata->ts_rate_unmatch); + merge_meas(&phy_vars_ue->dlsch_ldpc_decoding_stats, &rdata->ts_ldpc_decode); + bool decodeSuccess = (rdata->decodeIterations < (1+dlsch->max_ldpc_iterations)); if (decodeSuccess) { @@ -242,7 +230,6 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool //LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", // phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); harq_process->ack = 0; - harq_process->round++; if (harq_process->round >= dlsch->Mlimit) { harq_process->status = SCH_IDLE; harq_process->round = 0; @@ -267,12 +254,6 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool void nr_processDLSegment(void* arg) { ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) arg; NR_UE_DLSCH_t *dlsch = rdata->dlsch; -#if UE_TIMING_TRACE //TBD - PHY_VARS_NR_UE *phy_vars_ue = rdata->phy_vars_ue; - time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats; - time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats; - time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats; -#endif NR_DL_UE_HARQ_t *harq_process= rdata->harq_process; t_nrLDPC_dec_params *p_decoderParms = &rdata->decoderParms; int length_dec; @@ -301,7 +282,7 @@ void nr_processDLSegment(void* arg) { __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; - uint8_t Ilbrm = 0; + uint8_t Ilbrm = 1; Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb" Kr_bytes = Kr>>3; @@ -312,23 +293,21 @@ void nr_processDLSegment(void* arg) { t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; -#if UE_TIMING_TRACE - start_meas(dlsch_deinterleaving_stats); -#endif + 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, 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); -#if UE_TIMING_TRACE - stop_meas(dlsch_deinterleaving_stats); -#endif -#if UE_TIMING_TRACE - start_meas(dlsch_rate_unmatching_stats); -#endif + stop_meas(&rdata->ts_deinterleave); + + start_meas(&rdata->ts_rate_unmatch); /* LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,E %d, F %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", harq_pid,r, G,E,harq_process->F, Kr*3, @@ -355,22 +334,17 @@ void nr_processDLSegment(void* arg) { harq_process->F, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) { //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT); -#if UE_TIMING_TRACE - stop_meas(dlsch_rate_unmatching_stats); -#endif + stop_meas(&rdata->ts_rate_unmatch); LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); rdata->decodeIterations = dlsch->max_ldpc_iterations + 1; - return; - } else { -#if UE_TIMING_TRACE - stop_meas(dlsch_rate_unmatching_stats); -#endif + return; } + stop_meas(&rdata->ts_rate_unmatch); r_offset += E; if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) { - LOG_I(PHY,"decoder input(segment %u) :",r); + LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0; its_ldpc_decode); //set first 2*Z_c bits to zeros memset(&z[0],0,2*harq_process->Z*sizeof(int16_t)); //set Filler bits @@ -445,9 +417,7 @@ void nr_processDLSegment(void* arg) { harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; } -#if UE_TIMING_TRACE - stop_meas(dlsch_turbo_decoding_stats); -#endif + stop_meas(&rdata->ts_ldpc_decode); } } @@ -478,6 +448,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // HARQ stats phy_vars_ue->dl_stats[harq_process->round]++; + LOG_D(PHY,"Round %d RV idx %d\n",harq_process->round,harq_process->rvidx); uint8_t kc; uint32_t Tbslbrm;// = 950984; uint16_t nb_rb;// = 30; @@ -653,6 +624,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, rdata->offset = offset; rdata->dlsch = dlsch; rdata->dlsch_id = 0; + reset_meas(&rdata->ts_deinterleave); + reset_meas(&rdata->ts_rate_unmatch); + reset_meas(&rdata->ts_ldpc_decode); pushTpool(&(pool_dl),req); nbDecode++; LOG_D(PHY,"Added a block to decode, in pipe: %d\n",nbDecode); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index c6fa85e726..a57399c717 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -32,9 +32,6 @@ #include "PHY/phy_extern_nr_ue.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "nr_transport_proto_ue.h" -//#include "SCHED/defs.h" -//#include "PHY/defs.h" -//#include "extern.h" #include "PHY/sse_intrin.h" #include "T.h" #include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 2963ad5010..8917a8bc1b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -196,8 +196,7 @@ char prefix_string[2][9] = {"NORMAL","EXTENDED"}; int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, - int n_frames, int sa, - int dlsch_parallel) + int n_frames, int sa) { int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2, @@ -528,8 +527,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, SI_PDSCH, ue->dlsch_SI[gnb_id], NULL, - &ue->dlsch_SI_errors[gnb_id], - dlsch_parallel); + &ue->dlsch_SI_errors[gnb_id]); // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gnb_id]->active = 0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 3cb002f9e1..239731208e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1055,14 +1055,15 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, @param[in] size, of input bits @param[in] Nid, cell id @param[in] n_RNTI, CRNTI + @param[in] uci_on_pusch whether UCI placeholder bits need to be scrambled (true -> no optimized scrambling) @param[out] out, the scrambled bits */ - void nr_pusch_codeword_scrambling(uint8_t *in, - uint32_t size, - uint32_t Nid, - uint32_t n_RNTI, - uint32_t* out); + uint32_t size, + uint32_t Nid, + uint32_t n_RNTI, + bool uci_on_pusch, + uint32_t* out); /** \brief Perform the following functionalities: - encoding @@ -1423,8 +1424,7 @@ void generate_RIV_tables(void); int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *phy_vars_ue, int n_frames, - int sa, - int dlsch_parallel); + int sa); /*! \brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index f275304185..60ab552449 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -118,7 +118,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, a_segments = a_segments/273 +1; } - uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment + uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t)); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3cdd07dc43..66d839726e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -53,12 +53,12 @@ //extern int32_t uplink_counter; -void nr_pusch_codeword_scrambling(uint8_t *in, - uint32_t size, - uint32_t Nid, - uint32_t n_RNTI, - uint32_t* out) { - +void nr_pusch_codeword_scrambling_uci(uint8_t *in, + uint32_t size, + uint32_t Nid, + uint32_t n_RNTI, + uint32_t* out) +{ uint8_t reset, b_idx; uint32_t x1, x2, s=0, temp_out; @@ -89,7 +89,19 @@ void nr_pusch_codeword_scrambling(uint8_t *in, *out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<Nid_cell, rnti, - scrambled_output); // assume one codeword for the moment - + false, + scrambled_output); ///////////// ////////////////////////////////////////////////////////////////////////// diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c index 4109950df6..f3a953c9a8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c @@ -38,7 +38,6 @@ #undef DEFINE_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H #include "PHY/defs_nr_UE.h" -//#include "extern.h" #include "PHY/NR_REFSIG/ss_pbch_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" @@ -47,11 +46,13 @@ #include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" #undef DEFINE_VARIABLES_SRS_MODULATION_NR_H +//#define SRS_DEBUG + /******************************************************************* * * NAME : generate_srs * -* PARAMETERS : pointer to resource set +* PARAMETERS : pointer to srs config pdu * pointer to transmit buffer * amplitude scaling for this physical signal * slot number of transmission @@ -73,84 +74,94 @@ * - no antenna switching* * *********************************************************************/ -int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *txptr, - int16_t amp, - UE_nr_rxtx_proc_t *proc) +int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu, + NR_DL_FRAME_PARMS *frame_parms, + int32_t *txptr, + nr_srs_info_t *nr_srs_info, + int16_t amp, + int frame_number, + int slot_number) { uint8_t n_SRS_cs_max; - uint8_t u, v_nu; + uint8_t u; + uint8_t v_nu; uint32_t f_gh = 0; - SRS_Resource_t *p_SRS_Resource; - int frame_number = proc->frame_tx; - int slot_number = proc->nr_slot_tx; - uint16_t n_SRS, n_SRS_cs_i; + uint16_t n_SRS; + uint16_t n_SRS_cs_i; double alpha_i; uint8_t K_TC_p; - uint16_t n_b[B_SRS_NUMBER], F_b, subcarrier; - uint8_t N_b, k_0_overbar_p; + uint16_t n_b[B_SRS_NUMBER]; + uint16_t F_b; + uint16_t subcarrier; + uint8_t N_b; + uint8_t k_0_overbar_p; - if (p_srs_resource_set->p_srs_ResourceList[0] == NULL) { - LOG_E(PHY,"generate_srs: No resource associated with the SRS resource set!\n"); - return (-1); - } - else { - if (p_srs_resource_set->number_srs_Resource <= MAX_NR_OF_SRS_RESOURCES_PER_SET) { - p_SRS_Resource = p_srs_resource_set->p_srs_ResourceList[0]; - } - else { - LOG_E(PHY,"generate_srs: resource number of this resource set %d exceeds maximum supported value %d!\n", p_srs_resource_set->number_srs_Resource, MAX_NR_OF_SRS_RESOURCES_PER_SET); - return (-1); - } + // get parameters from srs_config_pdu + uint8_t B_SRS = srs_config_pdu->bandwidth_index; + uint8_t C_SRS = srs_config_pdu->config_index; + uint8_t b_hop = srs_config_pdu->frequency_hopping; + uint8_t K_TC = 2<comb_size; + uint8_t K_TC_overbar = srs_config_pdu->comb_offset; // FFS_TODO_NR is this parameter for K_TC_overbar ?? + uint8_t n_SRS_cs = srs_config_pdu->cyclic_shift; + uint8_t n_ID_SRS = srs_config_pdu->sequence_id; + uint8_t n_shift = srs_config_pdu->frequency_position; // it adjusts the SRS allocation to align with the common resource block grid in multiples of four + uint8_t n_RRC = srs_config_pdu->frequency_shift; + uint8_t groupOrSequenceHopping = srs_config_pdu->group_or_sequence_hopping; + uint8_t l_offset = srs_config_pdu->time_start_position; + uint16_t T_SRS = srs_config_pdu->t_srs; + uint16_t T_offset = srs_config_pdu->t_offset; // FFS_TODO_NR to check interface with RRC + uint8_t R = 1<num_repetitions; + uint8_t N_ap = 1<num_ant_ports; // antenna port for transmission + uint8_t N_symb_SRS = 1<num_symbols; // consecutive OFDM symbols + uint8_t l0 = frame_parms->symbols_per_slot - 1 - l_offset; // starting position in the time domain + uint8_t k_0_p; // frequency domain starting position + + uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_config_pdu->bwp_start*N_SC_RB; + + if(nr_srs_info) { + nr_srs_info->sc_list_length = 0; + nr_srs_info->srs_generated_signal_bits = log2_approx(amp); } - if (p_srs_resource_set->resourceType != periodic) { - LOG_E(PHY,"generate_srs: only SRS periodic is supported up to now!\n"); - return (-1); - } - /* get parameters from SRS resource configuration */ - uint8_t B_SRS = p_SRS_Resource->freqHopping_b_SRS; - uint8_t C_SRS = p_SRS_Resource->freqHopping_c_SRS; - uint8_t b_hop = p_SRS_Resource->freqHopping_b_hop; - uint8_t K_TC = p_SRS_Resource->transmissionComb; - uint8_t K_TC_overbar = p_SRS_Resource->combOffset; /* FFS_TODO_NR is this parameter for K_TC_overbar ?? */ - uint8_t n_SRS_cs = p_SRS_Resource->cyclicShift; - uint8_t n_ID_SRS = p_SRS_Resource->sequenceId; - uint8_t n_shift = p_SRS_Resource->freqDomainPosition; /* it adjusts the SRS allocation to align with the common resource block grid in multiples of four */ - uint8_t n_RRC = p_SRS_Resource->freqDomainShift; - uint8_t groupOrSequenceHopping = p_SRS_Resource->groupOrSequenceHopping; - - uint8_t l_offset = p_SRS_Resource->resourceMapping_startPosition; - - uint16_t T_SRS = srs_period[p_SRS_Resource->SRS_Periodicity]; - uint16_t T_offset = p_SRS_Resource->SRS_Offset;; /* FFS_TODO_NR to check interface with RRC */ - uint8_t R = p_SRS_Resource->resourceMapping_repetitionFactor; - - /* TS 38.211 6.4.1.4.1 SRS resource */ - uint8_t N_ap = (uint8_t)p_SRS_Resource->nrof_SrsPorts; /* antenna port for transmission */ - uint8_t N_symb_SRS = p_SRS_Resource->resourceMapping_nrofSymbols; /* consecutive OFDM symbols */ - uint8_t l0 = N_SYMB_SLOT - 1 - l_offset; /* starting position in the time domain */ - uint8_t k_0_p; /* frequency domain starting position */ +#ifdef SRS_DEBUG + LOG_I(NR_PHY,"Frame = %i, slot = %i\n", frame_number, slot_number); + LOG_I(NR_PHY,"B_SRS = %i\n", B_SRS); + LOG_I(NR_PHY,"C_SRS = %i\n", C_SRS); + LOG_I(NR_PHY,"b_hop = %i\n", b_hop); + LOG_I(NR_PHY,"K_TC = %i\n", K_TC); + LOG_I(NR_PHY,"K_TC_overbar = %i\n", K_TC_overbar); + LOG_I(NR_PHY,"n_SRS_cs = %i\n", n_SRS_cs); + LOG_I(NR_PHY,"n_ID_SRS = %i\n", n_ID_SRS); + LOG_I(NR_PHY,"n_shift = %i\n", n_shift); + LOG_I(NR_PHY,"n_RRC = %i\n", n_RRC); + LOG_I(NR_PHY,"groupOrSequenceHopping = %i\n", groupOrSequenceHopping); + LOG_I(NR_PHY,"l_offset = %i\n", l_offset); + LOG_I(NR_PHY,"T_SRS = %i\n", T_SRS); + LOG_I(NR_PHY,"T_offset = %i\n", T_offset); + LOG_I(NR_PHY,"R = %i\n", R); + LOG_I(NR_PHY,"N_ap = %i\n", N_ap); + LOG_I(NR_PHY,"N_symb_SRS = %i\n", N_symb_SRS); + LOG_I(NR_PHY,"l0 = %i\n", l0); +#endif if (N_ap != port1) { - LOG_E(PHY, "generate_srs: this number of antenna ports %d is not yet supported!\n", N_ap); + LOG_E(NR_PHY, "generate_srs: this number of antenna ports %d is not yet supported!\n", N_ap); return (-1); } if (N_symb_SRS != 1) { - LOG_E(PHY, "generate_srs: this number of srs symbol %d is not yet supported!\n", N_symb_SRS); + LOG_E(NR_PHY, "generate_srs: this number of srs symbol %d is not yet supported!\n", N_symb_SRS); return (-1); } if (groupOrSequenceHopping != neitherHopping) { - LOG_E(PHY, "generate_srs: sequence hopping is not yet supported!\n"); + LOG_E(NR_PHY, "generate_srs: sequence hopping is not yet supported!\n"); return (-1); } if (R == 0) { - LOG_E(PHY, "generate_srs: this parameter repetition factor %d is not consistent !\n", R); + LOG_E(NR_PHY, "generate_srs: this parameter repetition factor %d is not consistent !\n", R); return (-1); } else if (R > N_symb_SRS) { - LOG_E(PHY, "generate_srs: R %d can not be greater than N_symb_SRS %d !\n", R, N_symb_SRS); + LOG_E(NR_PHY, "generate_srs: R %d can not be greater than N_symb_SRS %d !\n", R, N_symb_SRS); return (-1); } /* see 38211 6.4.1.4.2 Sequence generation */ @@ -163,15 +174,15 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, // delta = 1; /* delta = log2(K_TC) */ } else { - LOG_E(PHY, "generate_srs: SRS unknown value for K_TC %d !\n", K_TC); + LOG_E(NR_PHY, "generate_srs: SRS unknown value for K_TC %d !\n", K_TC); return (-1); } if (n_SRS_cs >= n_SRS_cs_max) { - LOG_E(PHY, "generate_srs: inconsistent parameter n_SRS_cs %d >= n_SRS_cs_max %d !\n", n_SRS_cs, n_SRS_cs_max); + LOG_E(NR_PHY, "generate_srs: inconsistent parameter n_SRS_cs %d >= n_SRS_cs_max %d !\n", n_SRS_cs, n_SRS_cs_max); return (-1); } if (T_SRS == 0) { - LOG_E(PHY, "generate_srs: inconsistent parameter T_SRS %d can not be equal to zero !\n", T_SRS); + LOG_E(NR_PHY, "generate_srs: inconsistent parameter T_SRS %d can not be equal to zero !\n", T_SRS); return (-1); } else @@ -180,7 +191,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, while (srs_periodicity[index] != T_SRS) { index++; if (index == SRS_PERIODICITY) { - LOG_E(PHY, "generate_srs: inconsistent parameter T_SRS %d not specified !\n", T_SRS); + LOG_E(NR_PHY, "generate_srs: inconsistent parameter T_SRS %d not specified !\n", T_SRS); return (-1); } } @@ -202,10 +213,9 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, /* A UE may be configured to transmit an SRS resource on adjacent symbols within the last six symbols of a slot, */ /* where all antenna ports of the SRS resource are mapped to each symbol of the resource */ - uint8_t l = p_index; if (l >= N_symb_SRS) { - LOG_E(PHY, "generate_srs: number of antenna ports %d and number of srs symbols %d are different !\n", N_ap, N_symb_SRS); + LOG_E(NR_PHY, "generate_srs: number of antenna ports %d and number of srs symbols %d are different !\n", N_ap, N_symb_SRS); } switch(groupOrSequenceHopping) { @@ -247,7 +257,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, } default: { - LOG_E(PHY, "generate_srs: unknown hopping setting %d !\n", groupOrSequenceHopping); + LOG_E(NR_PHY, "generate_srs: unknown hopping setting %d !\n", groupOrSequenceHopping); return (-1); } } @@ -274,7 +284,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, N_b = 1; } /* periodicity and offset */ - if (p_srs_resource_set->resourceType == aperiodic) { + if (srs_config_pdu->resource_type == aperiodic) { n_SRS = l/R; } else { @@ -315,7 +325,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, k_0_p += K_TC * M_sc_b_SRS * n_b[b]; } - subcarrier = (frame_parms->first_carrier_offset) + k_0_p; + subcarrier = subcarrier_offset + k_0_p; if (subcarrier>frame_parms->ofdm_symbol_size) { subcarrier -= frame_parms->ofdm_symbol_size; } @@ -327,7 +337,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, } if (ul_allocated_re[M_sc_b_SRS_index] != M_sc_b_SRS) { - LOG_E(PHY, "generate_srs: srs uplink allocation %d can not be found! \n", M_sc_b_SRS); + LOG_E(NR_PHY, "generate_srs: srs uplink allocation %d can not be found! \n", M_sc_b_SRS); return (-1); } @@ -363,13 +373,31 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, txptr[subcarrier] = (real_amp & 0xFFFF) + ((imag_amp<<16)&0xFFFF0000); + if(nr_srs_info) { + nr_srs_info->sc_list[nr_srs_info->sc_list_length] = subcarrier; + nr_srs_info->sc_list_length++; + } + +#ifdef SRS_DEBUG + int subcarrier_log = subcarrier-subcarrier_offset; + if(subcarrier_log < 0) { + subcarrier_log = subcarrier_log + frame_parms->ofdm_symbol_size; + } + if( subcarrier_log%12 == 0 ) { + LOG_I(NR_PHY,"------------ %d ------------\n", subcarrier_log/12); + } + LOG_I(NR_PHY,"(%d) \t%i\t%i\n", subcarrier_log, (int16_t)(real_amp&0xFFFF), (int16_t)(imag_amp&0xFFFF)); +#endif + subcarrier += (K_TC); /* subcarrier increment */ - if (subcarrier >= frame_parms->ofdm_symbol_size) + if (subcarrier >= frame_parms->ofdm_symbol_size) { subcarrier=subcarrier-frame_parms->ofdm_symbol_size; + } + } /* process next symbol */ - txptr = txptr + frame_parms->ofdm_symbol_size; + //txptr = txptr + frame_parms->ofdm_symbol_size; } return (0); @@ -377,40 +405,7 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, /******************************************************************* * -* NAME : is_srs_period_nr -* -* PARAMETERS : pointer to resource set -* pointer to transmit buffer -* amplitude scaling for this physical signal -* slot number of transmission -* RETURN : 0 if it is a valid slot for transmitting srs -* -1 if srs should not be transmitted -* -* DESCRIPTION : for periodic, -* -*********************************************************************/ -int is_srs_period_nr(SRS_Resource_t *p_SRS_Resource, NR_DL_FRAME_PARMS *frame_parms, int frame_tx, int slot_tx) -{ - uint16_t T_SRS = srs_period[p_SRS_Resource->SRS_Periodicity]; - uint16_t T_offset = p_SRS_Resource->SRS_Offset; /* FFS_TODO_NR to check interface */ - - if (T_offset > T_SRS) { - LOG_E(PHY,"is_srs_occasion_nr: T_offset %d is greater than T_SRS %d!\n", T_offset, T_SRS); - return (-1); - } - - int16_t N_slot_frame = frame_parms->slots_per_frame; - if ((N_slot_frame*frame_tx + slot_tx - T_offset)%T_SRS == 0) { - return (0); - } - else { - return (-1); - } -} - -/******************************************************************* -* -* NAME : ue_srs_procedure_nr +* NAME : ue_srs_procedures_nr * * PARAMETERS : pointer to ue context * pointer to rxtx context* @@ -422,54 +417,51 @@ int is_srs_period_nr(SRS_Resource_t *p_SRS_Resource, NR_DL_FRAME_PARMS *frame_pa * send srs according to current configuration * *********************************************************************/ -int ue_srs_procedure_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id) +int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) { + + if(!ue->srs_vars[0]->active) { + return -1; + } + ue->srs_vars[0]->active = false; + + nfapi_nr_srs_pdu_t *srs_config_pdu = (nfapi_nr_srs_pdu_t*)&ue->srs_vars[0]->srs_config_pdu; + +#ifdef SRS_DEBUG + LOG_I(NR_PHY,"Frame = %i, slot = %i\n", proc->frame_tx, proc->nr_slot_tx); + LOG_I(NR_PHY,"srs_config_pdu->rnti = 0x%04x\n", srs_config_pdu->rnti); + LOG_I(NR_PHY,"srs_config_pdu->handle = %u\n", srs_config_pdu->handle); + LOG_I(NR_PHY,"srs_config_pdu->bwp_size = %u\n", srs_config_pdu->bwp_size); + LOG_I(NR_PHY,"srs_config_pdu->bwp_start = %u\n", srs_config_pdu->bwp_start); + LOG_I(NR_PHY,"srs_config_pdu->subcarrier_spacing = %u\n", srs_config_pdu->subcarrier_spacing); + LOG_I(NR_PHY,"srs_config_pdu->cyclic_prefix = %u (0: Normal; 1: Extended)\n", srs_config_pdu->cyclic_prefix); + LOG_I(NR_PHY,"srs_config_pdu->num_ant_ports = %u (0 = 1 port, 1 = 2 ports, 2 = 4 ports)\n", srs_config_pdu->num_ant_ports); + LOG_I(NR_PHY,"srs_config_pdu->num_symbols = %u (0 = 1 symbol, 1 = 2 symbols, 2 = 4 symbols)\n", srs_config_pdu->num_symbols); + LOG_I(NR_PHY,"srs_config_pdu->num_repetitions = %u (0 = 1, 1 = 2, 2 = 4)\n", srs_config_pdu->num_repetitions); + LOG_I(NR_PHY,"srs_config_pdu->time_start_position = %u\n", srs_config_pdu->time_start_position); + LOG_I(NR_PHY,"srs_config_pdu->config_index = %u\n", srs_config_pdu->config_index); + LOG_I(NR_PHY,"srs_config_pdu->sequence_id = %u\n", srs_config_pdu->sequence_id); + LOG_I(NR_PHY,"srs_config_pdu->bandwidth_index = %u\n", srs_config_pdu->bandwidth_index); + LOG_I(NR_PHY,"srs_config_pdu->comb_size = %u (0 = comb size 2, 1 = comb size 4, 2 = comb size 8)\n", srs_config_pdu->comb_size); + LOG_I(NR_PHY,"srs_config_pdu->comb_offset = %u\n", srs_config_pdu->comb_offset); + LOG_I(NR_PHY,"srs_config_pdu->cyclic_shift = %u\n", srs_config_pdu->cyclic_shift); + LOG_I(NR_PHY,"srs_config_pdu->frequency_position = %u\n", srs_config_pdu->frequency_position); + LOG_I(NR_PHY,"srs_config_pdu->frequency_shift = %u\n", srs_config_pdu->frequency_shift); + LOG_I(NR_PHY,"srs_config_pdu->frequency_hopping = %u\n", srs_config_pdu->frequency_hopping); + LOG_I(NR_PHY,"srs_config_pdu->group_or_sequence_hopping = %u (0 = No hopping, 1 = Group hopping groupOrSequenceHopping, 2 = Sequence hopping)\n", srs_config_pdu->group_or_sequence_hopping); + LOG_I(NR_PHY,"srs_config_pdu->resource_type = %u (0: aperiodic, 1: semi-persistent, 2: periodic)\n", srs_config_pdu->resource_type); + LOG_I(NR_PHY,"srs_config_pdu->t_srs = %u\n", srs_config_pdu->t_srs); + LOG_I(NR_PHY,"srs_config_pdu->t_offset = %u\n", srs_config_pdu->t_offset); +#endif + NR_DL_FRAME_PARMS *frame_parms = &(ue->frame_parms); - SRS_NR *p_srs_nr = &(ue->frame_parms.srs_nr); - SRS_ResourceSet_t *p_srs_resource_set = frame_parms->srs_nr.p_SRS_ResourceSetList[p_srs_nr->active_srs_Resource_Set]; - int generate_srs = 0; + uint16_t symbol_offset = (frame_parms->symbols_per_slot - 1 - srs_config_pdu->time_start_position)*frame_parms->ofdm_symbol_size; - /* is there any resource set which has been configurated ? */ - if (p_srs_nr->number_srs_Resource_Set != 0) { - - /* what is the current active resource set ? */ - if (p_srs_nr->active_srs_Resource_Set > MAX_NR_OF_SRS_RESOURCE_SET) { - LOG_W(PHY,"phy_procedures_UE_TX: srs active %d greater than maximum %d!\n", p_srs_nr->active_srs_Resource_Set, MAX_NR_OF_SRS_RESOURCE_SET); - } - else { - /* SRS resource set configurated ? */ - if (p_srs_resource_set != NULL) { - - SRS_Resource_t *p_srs_resource = frame_parms->srs_nr.p_SRS_ResourceSetList[p_srs_nr->active_srs_Resource_Set]->p_srs_ResourceList[0]; - - /* SRS resource configurated ? */ - if (p_srs_resource != NULL) { - if (p_srs_resource_set->resourceType == periodic) { - if (is_srs_period_nr(p_srs_resource, frame_parms, proc->frame_tx, proc->nr_slot_tx) == 0) { - generate_srs = 1; - } - } - } - else { - LOG_W(PHY,"phy_procedures_UE_TX: no configurated srs resource!\n"); - } - } - } - } - if (generate_srs == 1) { - int16_t txptr = AMP; - uint16_t nsymb = (ue->frame_parms.Ncp==0) ? 14:12; - uint16_t symbol_offset = (int)ue->frame_parms.ofdm_symbol_size*((proc->nr_slot_tx*nsymb)+(nsymb-1)); - if (generate_srs_nr(p_srs_resource_set, frame_parms, &ue->common_vars.txdataF[eNB_id][symbol_offset], txptr, proc) == 0) { - return 0; - } - else - { - return (-1); - } - } - else { - return (-1); + if (generate_srs_nr(srs_config_pdu, frame_parms, &ue->common_vars.txdataF[gNB_id][symbol_offset], ue->nr_srs_info, + AMP, proc->frame_tx, proc->nr_slot_tx) == 0) { + return 0; + } else { + return -1; } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h index 86fd7fcc91..e43bbe4934 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h @@ -136,15 +136,19 @@ EXTERN const uint16_t srs_periodicity[SRS_PERIODICITY] /** \brief This function generates the sounding reference symbol (SRS) for the uplink according to 38.211 6.4.1.4 Sounding reference signal @param frame_parms NR DL Frame parameters @param txdataF pointer to the frequency domain TX signal + @param nr_srs_info pointer to the srs info structure @param amp amplitude of generated signal - @param proc pointer to the transmit parameters + @param frame_number frame number + @param slot_number slot number @returns 0 on success -1 on error with message */ -int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, - NR_DL_FRAME_PARMS *frame_parms, - int32_t *txptr, - int16_t amp, - UE_nr_rxtx_proc_t *proc); +int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu, + NR_DL_FRAME_PARMS *frame_parms, + int32_t *txptr, + nr_srs_info_t *nr_srs_info, + int16_t amp, + int frame_number, + int slot_number); /** \brief This function checks for periodic srs if srs should be transmitted in this slot * @param p_SRS_Resource pointer to active resource @@ -155,13 +159,14 @@ int32_t generate_srs_nr(SRS_ResourceSet_t *p_srs_resource_set, int is_srs_period_nr(SRS_Resource_t *p_SRS_Resource, NR_DL_FRAME_PARMS *frame_parms, int frame_tx, int slot_tx); + /** \brief This function processes srs configuration * @param ue context @param rxtx context - @param current eNB identifier + @param current gNB_id identifier @returns 0 if srs is transmitted -1 otherwise */ -int ue_srs_procedure_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id); +int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id); #undef EXTERN #undef INIT_VARIABLES_SRS_MODULATION_NR_H diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 56d8299470..ed4e9a125f 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -142,6 +142,7 @@ static inline void start_meas(time_stats_t *ts) { } else { ts->in = rdtsc_oai(); } + if ((ts->trials&16383)<10) ts->max=0; } } @@ -178,6 +179,16 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) { } } +static inline void merge_meas(time_stats_t *dst_ts, time_stats_t *src_ts) +{ + if (!opp_enabled) + return; + dst_ts->trials += src_ts->trials; + dst_ts->diff += src_ts->diff; + if (src_ts->max > dst_ts->max) + dst_ts->max = src_ts->max; +} + extern notifiedFIFO_t measur_fifo; #define CPUMEASUR_SECTION "cpumeasur" diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 6959052f74..3a9c58e133 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -395,6 +395,16 @@ typedef struct { nfapi_nr_pucch_pdu_t pucch_pdu; } NR_gNB_PUCCH_t; +typedef struct { + uint8_t active; + /// Frame where current SRS pdu was received + uint32_t frame; + /// Slot where current SRS pdu was received + uint32_t slot; + /// ULSCH PDU + nfapi_nr_srs_pdu_t srs_pdu; +} NR_gNB_SRS_t; + typedef struct { /// \brief Pointers (dynamic) to the received data in the time domain. /// - first index: rx antenna [0..nb_antennas_rx[ @@ -751,11 +761,11 @@ typedef struct PHY_VARS_gNB_s { // nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu; uint16_t num_pdsch_rnti[80]; NR_gNB_PBCH pbch; - nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL]; NR_gNB_COMMON common_vars; NR_gNB_PRACH prach_vars; NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX]; + NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX]; 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 @@ -769,14 +779,14 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX]; t_nrPolar_params *uci_polarParams; + /// SRS variables + nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX]; + uint8_t pbch_configured; char gNB_generate_rar; // PUCCH0 Look-up table for cyclic-shifts NR_gNB_PUCCH0_LUT_t pucch0_lut; - /// NR synchronization sequences - int16_t d_pss[NR_PSS_LENGTH]; - int16_t d_sss[NR_SSS_LENGTH]; /// PBCH DMRS sequence uint32_t nr_gold_pbch_dmrs[2][64][NR_PBCH_DMRS_LENGTH_DWORD]; @@ -867,6 +877,7 @@ typedef struct PHY_VARS_gNB_s { time_stats_t rx_pusch_stats; time_stats_t ul_indication_stats; + time_stats_t schedule_response_stats; time_stats_t ulsch_decoding_stats; time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_ldpc_decoding_stats; @@ -891,7 +902,7 @@ typedef struct PHY_VARS_gNB_s { notifiedFIFO_t *resp_RU_tx; tpool_t *threadPool; int nbDecode; - uint8_t pusch_proc_threads; + uint8_t thread_pool_size; int number_of_nr_dlsch_max; int number_of_nr_ulsch_max; void * scopeData; @@ -952,12 +963,14 @@ typedef struct processingData_L1tx { int slot; openair0_timestamp timestamp_tx; PHY_VARS_gNB *gNB; - nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu; - nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu; + nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; + nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; NR_gNB_SSB_t ssb[64]; uint16_t num_pdsch_slot; + int num_dl_pdcch; + int num_ul_pdcch; time_stats_t phy_proc_tx; } processingData_L1tx_t; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 06d066fb51..10c00fcb7f 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -706,6 +706,11 @@ typedef struct { fapi_nr_ul_config_prach_pdu prach_pdu; } NR_UE_PRACH; +typedef struct { + bool active; + fapi_nr_ul_config_srs_pdu srs_config_pdu; +} NR_UE_SRS; + // structure used for multiple SSB detection typedef struct NR_UE_SSB { uint8_t i_ssb; // i_ssb between 0 and 7 (it corresponds to ssb_index only for Lmax=4,8) @@ -815,6 +820,7 @@ typedef struct { NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRACH *prach_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_LAYERS>4 ? 2:1]; // two RxTx Threads @@ -967,6 +973,8 @@ typedef struct { /// PUSCH contention-based access vars PUSCH_CA_CONFIG_DEDICATED pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola + /// SRS variables + nr_srs_info_t *nr_srs_info; //#if defined(UPGRADE_RAT_NR) #if 1 @@ -1004,6 +1012,8 @@ typedef struct { time_stats_t phy_proc_tx; time_stats_t phy_proc_rx[RX_NB_TH]; + time_stats_t ue_ul_indication_stats; + uint32_t use_ia_receiver; time_stats_t ofdm_mod_stats; @@ -1012,7 +1022,6 @@ typedef struct { time_stats_t ulsch_modulation_stats; time_stats_t ulsch_segmentation_stats; time_stats_t ulsch_rate_matching_stats; - time_stats_t ulsch_turbo_encoding_stats; time_stats_t ulsch_interleaving_stats; time_stats_t ulsch_multiplexing_stats; @@ -1025,6 +1034,7 @@ typedef struct { time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; time_stats_t dlsch_procedures_stat[RX_NB_TH]; + time_stats_t rx_pdsch_stats; time_stats_t ofdm_demod_stats; time_stats_t dlsch_rx_pdcch_stats; time_stats_t rx_dft_stats; @@ -1033,13 +1043,13 @@ typedef struct { time_stats_t dlsch_decoding_stats[2]; time_stats_t dlsch_demodulation_stats; time_stats_t dlsch_rate_unmatching_stats; - time_stats_t dlsch_turbo_decoding_stats; + time_stats_t dlsch_ldpc_decoding_stats; time_stats_t dlsch_deinterleaving_stats; time_stats_t dlsch_llr_stats; time_stats_t dlsch_llr_stats_parallelization[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; time_stats_t dlsch_unscrambling_stats; time_stats_t dlsch_rate_matching_stats; - time_stats_t dlsch_turbo_encoding_stats; + time_stats_t dlsch_ldpc_encoding_stats; time_stats_t dlsch_interleaving_stats; time_stats_t dlsch_tc_init_stats; time_stats_t dlsch_tc_alpha_stats; @@ -1098,6 +1108,9 @@ typedef struct LDPCDecode_ue_s { int offset; int Tbslbrm; int decodeIterations; + time_stats_t ts_deinterleave; + time_stats_t ts_rate_unmatch; + time_stats_t ts_ldpc_decode; } ldpcDecode_ue_t; #include "SIMULATION/ETH_TRANSPORT/defs.h" diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index a3f143c733..c7c0ec2c46 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -89,11 +89,22 @@ #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 NR_RX_NB_TH 1 #define NR_NB_TH_SLOT 2 extern const uint8_t nr_rv_round_map[4]; -extern const uint8_t nr_rv_round_map_ue[4]; + +static inline +uint8_t nr_rv_to_round(uint8_t rv) +{ + for (uint8_t round = 0; round < 4; round++) { + if (nr_rv_round_map[round] == rv) + return round; + } + return 0; +} typedef enum { NR_MU_0=0, @@ -220,6 +231,19 @@ typedef struct { uint8_t init_msg1; } NR_PRACH_RESOURCES_t; +typedef struct { + uint16_t sc_list_length; + uint16_t *sc_list; + uint8_t srs_generated_signal_bits; + int32_t *srs_generated_signal; + int32_t **srs_received_signal; + int32_t **srs_ls_estimated_channel; + int32_t **srs_estimated_channel_freq; + int32_t **srs_estimated_channel_time; + int32_t **srs_estimated_channel_time_shifted; + uint32_t *noise_power; +} nr_srs_info_t; + typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS; typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp); diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 59d8216679..87d193b4a3 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -211,10 +211,10 @@ typedef enum { srs_sl2560 = 16 } SRS_Periodicity_t; -#define NB_SRS_PERIOD (17) +#define NB_SRS_PERIOD (18) static const uint16_t srs_period[NB_SRS_PERIOD] -= { 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560} += { 0, 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560} ; /// SRS_Resource of SRS_Config information element from 38.331 RRC specifications diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 7819e04b5e..2dbaa738dc 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -148,6 +148,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id); gNB = RC.gNB[Mod_id]; + start_meas(&gNB->schedule_response_stats); + nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int slot_type = nr_slot_select(cfg,frame,slot); @@ -164,10 +166,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ res = pullTpool(gNB->L1_tx_free, gNB->threadPool); processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); - int pdcch_received=0; msgTx->num_pdsch_slot=0; - msgTx->pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0; - msgTx->ul_pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0; + msgTx->num_dl_pdcch=0; + msgTx->num_ul_pdcch=number_ul_dci_pdu; msgTx->slot = slot; msgTx->frame = frame; @@ -181,16 +182,14 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ break; case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: - AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n"); - msgTx->pdcch_pdu = dl_tti_pdu->pdcch_pdu; - - pdcch_received = 1; + LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); + msgTx->pdcch_pdu[msgTx->num_dl_pdcch] = dl_tti_pdu->pdcch_pdu; + msgTx->num_dl_pdcch++; break; case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); - handle_nfapi_nr_csirs_pdu(msgTx,frame,slot, - &dl_tti_pdu->csi_rs_pdu); + handle_nfapi_nr_csirs_pdu(msgTx,frame,slot,&dl_tti_pdu->csi_rs_pdu); break; case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: @@ -201,13 +200,13 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ pduIndex,TX_req->pdu_list[pduIndex].num_TLV); uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; AssertFatal(msgTx->num_pdsch_slot < gNB->number_of_nr_dlsch_max,"Number of PDSCH PDUs %d exceeded the limit %d\n", - msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max); + msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max); handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu); } } - if (number_ul_dci_pdu > 0) - msgTx->ul_pdcch_pdu = UL_dci_req->ul_dci_pdu_list[number_ul_dci_pdu-1]; // copy the last pdu + for (int i=0; iul_pdcch_pdu[i] = UL_dci_req->ul_dci_pdu_list[i]; pushNotifiedFIFO(gNB->L1_tx_filled,res); } @@ -228,6 +227,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu); if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu); break; + case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: + LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot); + nr_fill_srs(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].srs_pdu); + break; } } } @@ -246,6 +249,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ if (number_dl_pdu>0) oai_nfapi_dl_tti_req(DL_req); - } - + } + stop_meas(&gNB->schedule_response_stats); } diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 3f4c2f71fb..4d3174007a 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -155,7 +155,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { int aa = 0;//physical antenna number int ret = 0; int ofdm_mask_full = (1<<(ru->nb_tx*2))-1; - int txdataF_offset = ((tti_tx%2)*fp->samples_per_slot_wCP); + int txdataF_offset = (tti_tx*fp->samples_per_slot_wCP); if (nr_slot_select(cfg,frame_tx,slot) == NR_UPLINK_SLOT) return; for (aa=0; aanb_tx; aa++) memset(ru->common.txdataF[aa],0,fp->samples_per_slot_wCP*sizeof(int32_t)); @@ -300,7 +300,7 @@ static void *nr_feptx_thread(void *param) { ofdm_mask_full = (1<<(ru->nb_tx*2))-1; if(ru->num_gNB != 0){ - txdataF_offset = ((slot%2)*fp->samples_per_slot_wCP); + txdataF_offset = (slot*fp->samples_per_slot_wCP); ////////////precoding//////////// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 1); @@ -464,7 +464,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { int32_t ***bw; int i=0; int slot_tx = tti_tx; - int txdataF_offset = ((tti_tx%2)*fp->samples_per_slot_wCP); + int txdataF_offset = (tti_tx*fp->samples_per_slot_wCP); start_meas(&ru->precoding_stats); AssertFatal(ru->nb_log_antennas > 0,"ru->nb_log_antennas is 0!\n"); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 581ab626cd..0625895ebe 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -19,19 +19,13 @@ * contact@openairinterface.org */ -#include "PHY/phy_extern.h" #include "PHY/defs_gNB.h" #include "sched_nr.h" -#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_ulsch.h" #include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/NR_ESTIMATION/nr_ul_estimation.h" -#include "PHY/NR_UE_TRANSPORT/pucch_nr.h" -#include "SCHED/sched_eNB.h" -#include "sched_nr.h" -#include "SCHED/sched_common_extern.h" #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h" #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h" #include "fapi_nr_l1.h" @@ -39,6 +33,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "PHY/INIT/phy_init.h" #include "PHY/MODULATION/nr_modulation.h" +#include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" #include "T.h" #include "executables/nr-softmodem.h" #include "executables/softmodem-common.h" @@ -74,7 +69,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ int **txdataF = gNB->common_vars.txdataF; uint8_t ssb_index, n_hf; uint16_t ssb_start_symbol; - int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; + int txdataF_offset = slot*fp->samples_per_slot_wCP; uint16_t slots_per_hf = (fp->slots_per_frame)>>1; if (slotd_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_pss(&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); if (cfg->carrier_config.num_tx_ant.value <= 4) nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); @@ -114,8 +109,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value; } - nr_generate_pbch(&gNB->pbch, - &ssb_pdu, + nr_generate_pbch(&ssb_pdu, gNB->nr_pbch_interleaver, &txdataF[0][txdataF_offset], AMP, @@ -134,7 +128,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int offset = gNB->CC_id; - int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; + int txdataF_offset = slot*fp->samples_per_slot_wCP; if ((cfg->cell_config.frame_duplex_type.value == TDD) && (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return; @@ -159,18 +153,15 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0); - int num_dl_dci = msgTx->pdcch_pdu.pdcch_pdu_rel15.numDlDci; - int num_ul_dci = msgTx->ul_pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci; + int num_pdcch_pdus = msgTx->num_ul_pdcch + msgTx->num_dl_pdcch; - if (num_dl_dci > 0 || num_ul_dci > 0) { - LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n", - gNB->Mod_id, frame, slot, num_ul_dci, num_dl_dci); + if (num_pdcch_pdus > 0) { + LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL PDCCH PDUs %d/%d)\n", + gNB->Mod_id, frame, slot, msgTx->num_ul_pdcch, msgTx->num_dl_pdcch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1); - nr_generate_dci_top(gNB, - num_dl_dci > 0 ? &msgTx->pdcch_pdu : NULL, - num_ul_dci > 0 ? &msgTx->ul_pdcch_pdu.pdcch_pdu : NULL, + nr_generate_dci_top(msgTx, gNB->nr_gold_pdcch_dmrs[slot], &gNB->common_vars.txdataF[0][txdataF_offset], AMP, fp); @@ -187,7 +178,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, for (int i=0;icsirs_pdu[i]; - if ((csirs->active == 1)) { + if (csirs->active == 1) { LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = csirs->csirs_pdu.csi_rs_pdu_rel15; nr_generate_csi_rs(gNB, AMP, csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot); @@ -195,8 +186,6 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, } } - if (do_meas==1) stop_meas(&msgTx->phy_proc_tx); - // if ((frame&127) == 0) dump_pdsch_stats(gNB); //apply the OFDM symbol rotation here @@ -205,21 +194,10 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0); - //pthread_mutex_unlock(&mutextest); + if (do_meas==1) stop_meas(&msgTx->phy_proc_tx); } - - -/* - - if ((cfg->subframe_config.duplex_mode.value == TDD) && - ((nr_slot_select(fp,frame,slot)&NR_DOWNLINK_SLOT)==SF_DL)) return; - - // VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,1); - -*/ - void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req); NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; @@ -373,11 +351,10 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH //------------------- ULSCH unscrambling ------------------- //---------------------------------------------------------- start_meas(&gNB->ulsch_unscrambling_stats); - nr_ulsch_unscrambling_optim(gNB->pusch_vars[ULSCH_id]->llr, - G, - 0, - pusch_pdu->data_scrambling_id, - pusch_pdu->rnti); + nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id]->llr, + G, + pusch_pdu->data_scrambling_id, + pusch_pdu->rnti); stop_meas(&gNB->ulsch_unscrambling_stats); //---------------------------------------------------------- //--------------------- ULSCH decoding --------------------- @@ -605,6 +582,20 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } + for (int i=0;isrs[i]; + if (srs) { + if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { + nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu; + for(int symbol = 0; symbol<(1<num_symbols); symbol++) { + for(rb = srs_pdu->bwp_start; rb < (srs_pdu->bwp_start+srs_pdu->bwp_size); rb++) { + gNB->rb_mask_ul[gNB->frame_parms.symbols_per_slot-srs_pdu->time_start_position-1+symbol][rb>>5] |= 1<<(rb&31); + } + } + } + } + } + } void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { @@ -812,6 +803,43 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } } + + for (int i=0;isrs[i]; + if (srs) { + if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) { + + LOG_D(NR_PHY, "(%d.%d) gNB is waiting for SRS, id = %i\n", frame_rx, slot_rx, i); + + nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu; + + // At least currently, the configuration is constant, so it is enough to generate the sequence just once. + if(gNB->nr_srs_info[i]->sc_list_length == 0) { + generate_srs_nr(srs_pdu, &gNB->frame_parms, gNB->nr_srs_info[i]->srs_generated_signal, gNB->nr_srs_info[i], AMP, frame_rx, slot_rx); + } + + nr_get_srs_signal(gNB,frame_rx,slot_rx,srs_pdu, gNB->nr_srs_info[i], gNB->nr_srs_info[i]->srs_received_signal); + + nr_srs_channel_estimation(gNB,frame_rx,slot_rx,srs_pdu, + gNB->nr_srs_info[i], + gNB->nr_srs_info[i]->srs_generated_signal, + gNB->nr_srs_info[i]->srs_received_signal, + gNB->nr_srs_info[i]->srs_estimated_channel_freq, + gNB->nr_srs_info[i]->srs_estimated_channel_time, + gNB->nr_srs_info[i]->srs_estimated_channel_time_shifted, + gNB->nr_srs_info[i]->noise_power); + + T(T_GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE, T_INT(0), T_INT(srs_pdu->rnti), T_INT(frame_rx), T_INT(0), T_INT(0), + T_BUFFER(gNB->nr_srs_info[i]->srs_estimated_channel_freq[0], gNB->frame_parms.ofdm_symbol_size*sizeof(int32_t))); + + T(T_GNB_PHY_UL_TIME_CHANNEL_ESTIMATE, T_INT(0), T_INT(srs_pdu->rnti), T_INT(frame_rx), T_INT(0), T_INT(0), + T_BUFFER(gNB->nr_srs_info[i]->srs_estimated_channel_time_shifted[0], gNB->frame_parms.ofdm_symbol_size*sizeof(int32_t))); + + srs->active = 0; + } + } + } + stop_meas(&gNB->phy_proc_rx); // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS if ((frame_rx&127) == 0 && slot_rx==19) { diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index b3527365a5..b85d4c1b50 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -358,31 +358,12 @@ int16_t nr_pucch_power_cntl(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t s */ void nr_pusch_power_cntl(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag); -/*! \brief This function implements the power control mechanism for SRS from 36.213. - @param phy_vars_ue PHY variables - @param proc Pointer to proc descriptor - @param eNB_id Index of eNB - @param j index of type of PUSCH (SPS, Normal, Msg3) - @returns Transmit power - */ -void nr_srs_power_cntl(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag); - void nr_get_cqipmiri_params(PHY_VARS_NR_UE *ue,uint8_t eNB_id); - - - - - void nr_dump_dlsch(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid); void nr_dump_dlsch_SI(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe); void nr_dump_dlsch_ra(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe); - -int nr_is_srs_occasion_common(NR_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); - -void nr_compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); - void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx); int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx); @@ -425,8 +406,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - int *dlsch_errors, - uint8_t dlsch_parallel); + int *dlsch_errors); int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index b0b1a0f261..9b87716145 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -336,6 +336,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ /* PUCCH */ fapi_nr_ul_config_pucch_pdu *pucch_config_pdu; LOG_D(PHY, "%d.%d ul B 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); + /* SRS */ + fapi_nr_ul_config_srs_pdu *srs_config_pdu; switch (pdu_type){ @@ -411,6 +413,15 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ 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; + case (FAPI_NR_UL_CONFIG_TYPE_SRS): + // srs config pdu + srs_config_pdu = &ul_config->ul_config_list[i].srs_config_pdu; + memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->srs_config_pdu), (void*)srs_config_pdu, sizeof(fapi_nr_ul_config_srs_pdu)); + PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->active = true; + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; + break; + default: ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more pdu_done++; // count the no of pdu processed diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 9dc82ee358..4afe5f41d3 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -349,7 +349,7 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int dl_harq->DCINdi = ndi; break; case 1: - dl_harq->round = 2; + dl_harq->round = 3; dl_harq->status = ACTIVE; dl_harq->first_rx = 0; if (dl_harq->DCINdi != ndi) { @@ -373,7 +373,7 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int dl_harq->status = SCH_IDLE; break; case 3: - dl_harq->round = 3; + dl_harq->round = 2; dl_harq->status = ACTIVE; dl_harq->first_rx = 0; if (dl_harq->DCINdi != ndi) { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index b9fd217b27..5e9a4efb01 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -38,15 +38,12 @@ #include "PHY/defs_nr_UE.h" #include "PHY/phy_extern_nr_ue.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" -#include "SCHED_NR_UE/defs.h" -#include "SCHED_NR_UE/pucch_uci_ue_nr.h" +#include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" #include "SCHED_NR/extern.h" #include "SCHED_NR_UE/phy_sch_processing_time.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h" -#include "PHY/NR_TRANSPORT/nr_dci.h" #ifdef EMOS #include "SCHED/phy_procedures_emos.h" #endif @@ -60,6 +57,7 @@ //#define NR_PDCCH_SCHED_DEBUG //#define NR_PUCCH_SCHED //#define NR_PUCCH_SCHED_DEBUG +//#define NR_PDSCH_DEBUG #ifndef PUCCH #define PUCCH @@ -78,8 +76,6 @@ fifo_dump_emos_UE emos_dump_UE; char nr_mode_string[NUM_UE_MODE][20] = {"NOT SYNCHED","PRACH","RAR","RA_WAIT_CR", "PUSCH", "RESYNCH"}; -const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3}; - #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706) extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; #endif @@ -286,7 +282,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); - start_meas(&ue->phy_proc_tx); if (ue->UE_mode[gNB_id] <= PUSCH){ @@ -295,7 +290,10 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, 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); } + } + if (ue->UE_mode[gNB_id] == PUSCH) { + ue_srs_procedures_nr(ue, proc, gNB_id); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); @@ -495,187 +493,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][gNB_id]; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &pdcch_vars->pdcch_config[n_ss]; - /* - // unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active -#ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_ue_pdcch_procedures() \n"); -#endif + start_meas(&ue->dlsch_rx_pdcch_stats); - int frame_rx = proc->frame_rx; - int nr_slot_rx = proc->nr_slot_rx; - NR_DCI_ALLOC_t dci_alloc_rx[8]; - - //uint8_t next1_thread_id = proc->thread_id== (RX_NB_TH-1) ? 0:(proc->thread_id+1); - //uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); - - - // table dci_fields_sizes_cnt contains dci_fields_sizes for each time a dci is decoded in the slot - // each element represents the size in bits for each dci field, for each decoded dci -> [dci_cnt-1] - // each time a dci is decode at dci_cnt, the values of the table dci_fields_sizes[i][j] will be copied at table dci_fields_sizes_cnt[dci_cnt-1][i][j] - // table dci_fields_sizes_cnt[dci_cnt-1][i][j] will then be used in function nr_extract_dci_info - uint8_t dci_fields_sizes_cnt[MAX_NR_DCI_DECODED_SLOT][NBR_NR_DCI_FIELDS][NBR_NR_FORMATS]; - - int nb_searchspace_active=0; - NR_UE_PDCCH **pdcch_vars = ue->pdcch_vars[proc->thread_id]; - NR_UE_PDCCH *pdcch_vars2 = ue->pdcch_vars[proc->thread_id][gNB_id]; - // s in TS 38.212 Subclause 10.1, for each active BWP the UE can deal with 10 different search spaces - // Higher layers have updated the number of searchSpaces with are active in the current slot and this value is stored in variable nb_searchspace_total - int nb_searchspace_total = pdcch_vars2->nb_search_space; - - pdcch_vars[gNB_id]->crnti = 0x1234; //to be check how to set when using loop memory - - uint16_t c_rnti=pdcch_vars[gNB_id]->crnti; - uint16_t cs_rnti=0,new_rnti=0,tc_rnti=0; - uint16_t p_rnti=P_RNTI; - uint16_t si_rnti=SI_RNTI; - uint16_t ra_rnti=99; - uint16_t sp_csi_rnti=0,sfi_rnti=0,int_rnti=0,tpc_pusch_rnti=0,tpc_pucch_rnti=0,tpc_srs_rnti=0; //FIXME - uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES] = - {c_rnti,cs_rnti,new_rnti,tc_rnti,p_rnti,si_rnti,ra_rnti,sp_csi_rnti,sfi_rnti,int_rnti,tpc_pusch_rnti,tpc_pucch_rnti,tpc_srs_rnti}; - #ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> there is a bug in FAPI to calculate nb_searchspace_total=%d\n",nb_searchspace_total); - #endif - if (nb_searchspace_total>1) nb_searchspace_total=1; // to be removed when fixing bug in FAPI - #ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> there is a bug in FAPI to calculate nb_searchspace_total so we set it to 1...\n"); - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> the number of searchSpaces active in the current slot(%d) is %d) \n", - nr_slot_rx,nb_searchspace_total); - #endif - - //FK: we define dci_ind and dl_indication as local variables, this way the call to the mac should be thread safe - fapi_nr_dci_indication_t dci_ind; - nr_downlink_indication_t dl_indication; - - // p in TS 38.212 Subclause 10.1, for each active BWP the UE can deal with 3 different CORESETs (including coresetId 0 for common search space) - //int nb_coreset_total = NR_NBR_CORESET_ACT_BWP; - unsigned int dci_cnt=0; - // this table contains 56 (NBR_NR_DCI_FIELDS) elements for each dci field and format described in TS 38.212. Each element represents the size in bits for each dci field - //uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS] = {{0}}; - // this is the UL bandwidth part. FIXME! To be defined where this value comes from - // uint16_t n_RB_ULBWP = 106; - // this is the DL bandwidth part. FIXME! To be defined where this value comes from - - // First we have to identify each searchSpace active at a time and do PDCCH monitoring corresponding to current searchSpace - // Up to 10 searchSpaces can be configured to UE (s<=10) - for (nb_searchspace_active=0; nb_searchspace_activesearchSpace[nb_searchspace_active].monitoringSlotPeriodicityAndOffset; - //if (sl_period_offset_mon == nr_sl1) { - //do_pdcch_monitoring_current_slot=1; // PDCCH monitoring in every slot - //} else if (nr_slot_rx%(uint16_t)sl_period_offset_mon == pdcch_vars2->searchSpace[nb_searchspace_active].monitoringSlotPeriodicityAndOffset_offset) { - //do_pdcch_monitoring_current_slot=1; // PDCCH monitoring in every monitoringSlotPeriodicityAndOffset slot with offset - //} - - // FIXME - // For PDCCH monitoring when overlap with SS/PBCH according to 38.213 v15.1.0 Section 10 - // To be implemented LATER !!! - - //int _offset,_index,_M; - //int searchSpace_id = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceId; - - - #ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> nb_searchspace_active=%d do_pdcch_monitoring_current_slot=%d (to be removed)\n", - nb_searchspace_active, - do_pdcch_monitoring_current_slot); - #endif - -// if (do_pdcch_monitoring_current_slot) { - // the searchSpace indicates that we need to monitor PDCCH in current nr_slot_rx - // get the parameters describing the current SEARCHSPACE - // the CORESET id applicable to the current SearchSpace - //int searchSpace_coreset_id = pdcch_vars2->searchSpace[nb_searchspace_active].controlResourceSetId; - // FIXME this variable is a bit string (14 bits) identifying every OFDM symbol in a slot. - // at the moment we will not take into consideration this variable and we will consider that the OFDM symbol offset is always the first OFDM in a symbol - uint16_t symbol_within_slot_mon = pdcch_vars2->searchSpace[nb_searchspace_active].monitoringSymbolWithinSlot; - // get the remaining parameters describing the current SEARCHSPACE: // FIXME! To be defined where we get this information from - //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L1 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel1; - //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L2 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel2; - //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L4 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel4; - //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L8 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel8; - //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L16 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel16; - // FIXME! A table of five enum elements - // searchSpaceType indicates whether this is a common search space or a UE-specific search space - //int searchSpaceType = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceType.type; - NR_SEARCHSPACE_TYPE_t searchSpaceType = ue_specific;//common; - #ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> searchSpaceType=%d is hardcoded THIS HAS TO BE FIXED!!!\n", - searchSpaceType); - #endif - - //while ((searchSpace_coreset_id != pdcch_vars2->coreset[nb_coreset_active].controlResourceSetId) && (nb_coreset_active= nb_coreset_total) return 0; // the coreset_id could not be found. There is a problem - } - - - - //we do not need these parameters yet - - // get the parameters describing the current CORESET - //int coreset_duration = pdcch_vars2->coreset[nb_coreset_active].duration; - //uint64_t coreset_freq_dom = pdcch_vars2->coreset[nb_coreset_active].frequencyDomainResources; - //int coreset_shift_index = pdcch_vars2->coreset[nb_coreset_active].cce_reg_mappingType.shiftIndex; - // NR_UE_CORESET_REG_bundlesize_t coreset_bundlesize = pdcch_vars2->coreset[nb_coreset_active].cce_reg_mappingType.reg_bundlesize; - // NR_UE_CORESET_interleaversize_t coreset_interleaversize = pdcch_vars2->coreset[nb_coreset_active].cce_reg_mappingType.interleaversize; - // NR_UE_CORESET_precoder_granularity_t precoder_granularity = pdcch_vars2->coreset[nb_coreset_active].precoderGranularity; - // int tci_statesPDCCH = pdcch_vars2->coreset[nb_coreset_active].tciStatesPDCCH; - // int tci_present = pdcch_vars2->coreset[nb_coreset_active].tciPresentInDCI; - // uint16_t pdcch_DMRS_scrambling_id = pdcch_vars2->coreset[nb_coreset_active].pdcchDMRSScramblingID; - - - // A set of PDCCH candidates for a UE to monitor is defined in terms of PDCCH search spaces. - // Searchspace types: - // Type0-PDCCH common search space for a DCI format with CRC scrambled by a SI-RNTI - // number of consecutive resource blocks and a number of consecutive symbols for - // the control resource set of the Type0-PDCCH common search space from - // the four most significant bits of RMSI-PDCCH-Config as described in Tables 13-1 through 13-10 - // and determines PDCCH monitoring occasions - // from the four least significant bits of RMSI-PDCCH-Config, - // included in MasterInformationBlock, as described in Tables 13-11 through 13-15 - // Type0A-PDCCH common search space for a DCI format with CRC scrambled by a SI-RNTI - // Type1-PDCCH common search space for a DCI format with CRC scrambled by a RA-RNTI, or a TC-RNTI, or a C-RNTI - // Type2-PDCCH common search space for a DCI format with CRC scrambled by a P-RNTI - // Type3-PDCCH common search space for a DCI format with CRC scrambled by INT-RNTI, or SFI-RNTI, - // or TPC-PUSCH-RNTI, or TPC-PUCCH-RNTI, or TPC-SRS-RNTI, or C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI - - - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_IN); - start_meas(&ue->dlsch_rx_pdcch_stats); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); -#ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_rx_pdcch with gNB_id=%d (nb_coreset_active=%d, (symbol_within_slot_mon&0x3FFF)=%d, searchSpaceType=%d)\n", - gNB_id,nb_coreset_active,(symbol_within_slot_mon&0x3FFF), - searchSpaceType); -#endif - nr_rx_pdcch(ue, - frame_rx, - nr_slot_rx, - gNB_id, - //(ue->frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, - SISO, - ue->high_speed_flag, - ue->is_secondary_ue, - nb_coreset_active, - (symbol_within_slot_mon&0x3FFF), - searchSpaceType); -#ifdef NR_PDCCH_SCHED_DEBUG - printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_rx_pdcch(nb_coreset_active=%d, (symbol_within_slot_mon&0x3FFF)=%d, searchSpaceType=%d)\n", - nb_coreset_active,(symbol_within_slot_mon&0x3FFF), - searchSpaceType); -#endif - - */ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); nr_rx_pdcch(ue, proc, rel15); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); @@ -708,46 +527,10 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, ue->pdcch_vars[proc->thread_id][gNB_id]->dci_received += dci_cnt; dci_ind->number_of_dcis = dci_cnt; - /* - for (int i=0; iframe_parms.frame_type, - dci_alloc_rx[i].dci_length, - dci_alloc_rx[i].rnti, - dci_alloc_rx[i].dci_pdu, - &dci_ind.dci_list[i].dci, - dci_fields_sizes_cnt[i], - dci_alloc_rx[i].format, - nr_slot_rx, - pdcch_vars2->n_RB_BWP[nb_searchspace_active], - pdcch_vars2->n_RB_BWP[nb_searchspace_active], - crc_scrambled_values); - - if(status == 0) { - LOG_W(PHY,"<-NR_PDCCH_PHY_PROCEDURES_UE (nr_ue_pdcch_procedures)-> bad DCI %d !!! \n",dci_alloc_rx[i].format); - return(-1); - } - - LOG_D(PHY,"<-NR_PDCCH_PHY_PROCEDURES_UE (nr_ue_pdcch_procedures)-> Ending function nr_extract_dci_info()\n"); - - - - } // end for loop dci_cnt - */ - - // fill dl_indication message - nr_fill_dl_indication(&dl_indication, dci_ind, NULL, proc, ue, gNB_id); - // send to mac - ue->if_inst->dl_indication(&dl_indication, NULL); + // fill dl_indication message + nr_fill_dl_indication(&dl_indication, dci_ind, NULL, proc, ue, gNB_id); + // send to mac + ue->if_inst->dl_indication(&dl_indication, NULL); stop_meas(&ue->dlsch_rx_pdcch_stats); @@ -822,6 +605,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ first_symbol_with_data++; } + start_meas(&ue->rx_pdsch_stats); for (m = s0; m < (s1 + s0); m++) { dual_stream_UE = 0; @@ -861,6 +645,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ proc->first_symbol_available = 1; } } // CRNTI active + stop_meas(&ue->rx_pdsch_stats); } return 0; } @@ -871,8 +656,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - int *dlsch_errors, - uint8_t dlsch_parallel) { + int *dlsch_errors) { if (dlsch0==NULL) AssertFatal(0,"dlsch0 should be defined at this level \n"); @@ -1001,12 +785,9 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, harq_pid, pdsch==PDSCH?1:0, dlsch0->harq_processes[harq_pid]->TBS>256?1:0); - if( dlsch_parallel) { - LOG_T(PHY,"dlsch decoding is parallelized, ret = %d\n", ret); - } - else { - LOG_T(PHY,"Sequential dlsch decoding , ret = %d\n", ret); - } + + LOG_T(PHY,"dlsch decoding, ret = %d\n", ret); + if(retmax_ldpc_iterations+1) dec = true; @@ -1081,13 +862,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, harq_pid, pdsch==PDSCH?1:0,//proc->decoder_switch, dlsch1->harq_processes[harq_pid]->TBS>256?1:0); - if(dlsch_parallel) { - LOG_T(PHY,"CW dlsch decoding is parallelized, ret1 = %d\n", ret1); - } - else { - - LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1); - } + LOG_T(PHY,"CW dlsch decoding, ret1 = %d\n", ret1); stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); if (cpumeas(CPUMEAS_GETSTATE)) { @@ -1601,6 +1376,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *fp = &ue->frame_parms; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); + start_meas(&ue->phy_proc_rx[proc->thread_id]); LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d (energy %d dB)****** \n", frame_rx%1024, nr_slot_rx, @@ -1782,8 +1558,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, SI_PDSCH, ue->dlsch_SI[gNB_id], NULL, - &ue->dlsch_SI_errors[gNB_id], - dlsch_parallel); + &ue->dlsch_SI_errors[gNB_id]); // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gNB_id]->active = 0; @@ -1807,8 +1582,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, P_PDSCH, ue->dlsch_p[gNB_id], NULL, - &ue->dlsch_p_errors[gNB_id], - dlsch_parallel); + &ue->dlsch_p_errors[gNB_id]); // deactivate dlsch once dlsch proc is done ue->dlsch_p[gNB_id]->active = 0; @@ -1831,8 +1605,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, RA_PDSCH, ue->dlsch_ra[gNB_id], NULL, - &ue->dlsch_ra_errors[gNB_id], - dlsch_parallel); + &ue->dlsch_ra_errors[gNB_id]); // deactivate dlsch once dlsch proc is done ue->dlsch_ra[gNB_id]->active = 0; @@ -1858,8 +1631,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, PDSCH, ue->dlsch[proc->thread_id][gNB_id][0], dlsch1, - &ue->dlsch_errors[gNB_id], - dlsch_parallel); + &ue->dlsch_errors[gNB_id]); stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]); if (cpumeas(CPUMEAS_GETSTATE)) { @@ -1874,91 +1646,49 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } -start_meas(&ue->generic_stat); + start_meas(&ue->generic_stat); -#if 0 + if (nr_slot_rx==9) { + if (frame_rx % 10 == 0) { + if ((ue->dlsch_received[gNB_id] - ue->dlsch_received_last[gNB_id]) != 0) + ue->dlsch_fer[gNB_id] = (100*(ue->dlsch_errors[gNB_id] - ue->dlsch_errors_last[gNB_id]))/(ue->dlsch_received[gNB_id] - ue->dlsch_received_last[gNB_id]); - if(nr_slot_rx==5 && ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid]->nb_rb > 20){ - //write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); - //write_output("llr.m","llr", &ue->pdsch_vars[proc->thread_id][gNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); - - write_output("rxdataF0_current.m" , "rxdataF0", &ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0],14*fp->ofdm_symbol_size,1,1); - //write_output("rxdataF0_previous.m" , "rxdataF0_prev_sss", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*fp->ofdm_symbol_size,1,1); - - //write_output("rxdataF0_previous.m" , "rxdataF0_prev", &ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF[0][0],14*fp->ofdm_symbol_size,1,1); - - write_output("dl_ch_estimates.m", "dl_ch_estimates_sfn5", &ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].dl_ch_estimates[0][0][0],14*fp->ofdm_symbol_size,1,1); - write_output("dl_ch_estimates_ext.m", "dl_ch_estimatesExt_sfn5", &ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[0][0],14*fp->N_RB_DL*12,1,1); - write_output("rxdataF_comp00.m","rxdataF_comp00", &ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_comp0[0][0],14*fp->N_RB_DL*12,1,1); - //write_output("magDLFirst.m", "magDLFirst", &phy_vars_ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_mag0[0][0],14*fp->N_RB_DL*12,1,1); - //write_output("magDLSecond.m", "magDLSecond", &phy_vars_ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_magb0[0][0],14*fp->N_RB_DL*12,1,1); - - AssertFatal (0,""); - } -#endif - - // duplicate harq structure -/* - uint8_t current_harq_pid = ue->dlsch[proc->thread_id][gNB_id][0]->current_harq_pid; - NR_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[current_harq_pid]; - NR_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[next1_thread_id][gNB_id][0]->harq_processes[current_harq_pid]; - NR_DL_UE_HARQ_t *harq_processes_dest1 = ue->dlsch[next2_thread_id][gNB_id][0]->harq_processes[current_harq_pid]; - */ - /*nr_harq_status_t *current_harq_ack = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_ack[nr_slot_rx]; - nr_harq_status_t *harq_ack_dest = &ue->dlsch[next1_thread_id][gNB_id][0]->harq_ack[nr_slot_rx]; - nr_harq_status_t *harq_ack_dest1 = &ue->dlsch[next2_thread_id][gNB_id][0]->harq_ack[nr_slot_rx]; -*/ - - //copy_harq_proc_struct(harq_processes_dest, current_harq_processes); -//copy_ack_struct(harq_ack_dest, current_harq_ack); - -//copy_harq_proc_struct(harq_processes_dest1, current_harq_processes); -//copy_ack_struct(harq_ack_dest1, current_harq_ack); - -if (nr_slot_rx==9) { - if (frame_rx % 10 == 0) { - if ((ue->dlsch_received[gNB_id] - ue->dlsch_received_last[gNB_id]) != 0) - ue->dlsch_fer[gNB_id] = (100*(ue->dlsch_errors[gNB_id] - ue->dlsch_errors_last[gNB_id]))/(ue->dlsch_received[gNB_id] - ue->dlsch_received_last[gNB_id]); - - ue->dlsch_errors_last[gNB_id] = ue->dlsch_errors[gNB_id]; - ue->dlsch_received_last[gNB_id] = ue->dlsch_received[gNB_id]; - } + ue->dlsch_errors_last[gNB_id] = ue->dlsch_errors[gNB_id]; + ue->dlsch_received_last[gNB_id] = ue->dlsch_received[gNB_id]; + } - ue->bitrate[gNB_id] = (ue->total_TBS[gNB_id] - ue->total_TBS_last[gNB_id])*100; - ue->total_TBS_last[gNB_id] = ue->total_TBS[gNB_id]; - LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", - ue->Mod_id,frame_rx,ue->total_TBS[gNB_id], - ue->total_TBS_last[gNB_id],(float) ue->bitrate[gNB_id]/1000.0); + ue->bitrate[gNB_id] = (ue->total_TBS[gNB_id] - ue->total_TBS_last[gNB_id])*100; + ue->total_TBS_last[gNB_id] = ue->total_TBS[gNB_id]; + LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", + ue->Mod_id,frame_rx,ue->total_TBS[gNB_id], + ue->total_TBS_last[gNB_id],(float) ue->bitrate[gNB_id]/1000.0); #if UE_AUTOTEST_TRACE - if ((frame_rx % 100 == 0)) { - LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[gNB_id]/1000.0, frame_rx); - } + if ((frame_rx % 100 == 0)) { + LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[gNB_id]/1000.0, frame_rx); + } #endif - } + } -stop_meas(&ue->generic_stat); -if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); + stop_meas(&ue->generic_stat); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); #ifdef EMOS -phy_procedures_emos_UE_RX(ue,slot,gNB_id); + phy_procedures_emos_UE_RX(ue,slot,gNB_id); #endif -VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); -stop_meas(&ue->phy_proc_rx[proc->thread_id]); -if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); + stop_meas(&ue->phy_proc_rx[proc->thread_id]); + if (cpumeas(CPUMEAS_GETSTATE)) + LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); - -//#endif //pdsch - -LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_slot_rx); -return (0); + LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_slot_rx); + return (0); } diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 060edc77f5..0c26989c29 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -59,8 +59,7 @@ double cpuf; //uint8_t nfapi_mode = 0; uint16_t NB_UE_INST = 1; -uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; -uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; +uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; @@ -119,7 +118,7 @@ int main(int argc, char **argv) double DS_TDL = .03; cpuf = get_cpu_freq_GHz(); char gNBthreads[128]="n"; - + if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == 0) { exit_fun("[NR_DLSCHSIM] Error, configuration module init failed\n"); } @@ -532,12 +531,12 @@ int main(int argc, char **argv) //if (i<16) // printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]); - + if (output[i] == 0) modulated_input[i] = 1.0; ///sqrt(2); //QPSK else modulated_input[i] = -1.0; ///sqrt(2); - + //if (i<16) printf("modulated_input[%d] = %d\n",i,modulated_input[i]); //SNR =10; SNR_lin = pow(10, SNR / 10.0); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 6a2aba5944..b8f51f8e95 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -280,7 +280,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, UE_info->CellGroup[0], sched_ctrl->active_bwp, NULL, - /* tda = */ 0, + /* tda = */ 2, dci_format, ps); @@ -777,7 +777,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 6, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 6, 0, 0, 0, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); @@ -1053,8 +1053,6 @@ int main(int argc, char **argv) while ((roundack==0)) { - memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int)); - memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int)); clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot); UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].ndi = !(trial&1); @@ -1062,7 +1060,7 @@ int main(int argc, char **argv) UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].round = round; for (int i=0; iUE_info.num_pdcch_cand[0][i] = 0; + gNB_mac->pdcch_cand[i] = 0; if (css_flag == 0) { nr_schedule_ue_spec(0, frame, slot); @@ -1104,7 +1102,7 @@ int main(int argc, char **argv) else phy_procedures_gNB_TX(msgDataTx,frame,slot,1); - int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP; + int txdataF_offset = slot * frame_parms->samples_per_slot_wCP; if (n_trials==1) { LOG_M("txsigF0.m","txsF0=", &gNB->common_vars.txdataF[0][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2413a86912..c6b547cd79 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -63,8 +63,7 @@ uint16_t NB_UE_INST = 1; // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; -uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; -uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; +uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} @@ -91,8 +90,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - int *dlsch_errors, - uint8_t dlsch_parallel) { + int *dlsch_errors) { return false; } @@ -714,7 +712,7 @@ int main(int argc, char **argv) } if (UE->is_synchronized == 0) { UE_nr_rxtx_proc_t proc={0}; - ret = nr_initial_sync(&proc, UE, 1, 0, 0); + ret = nr_initial_sync(&proc, UE, 1, 0); printf("nr_initial_sync1 returns %d\n",ret); if (ret<0) n_errors++; } diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 213924e5fd..d07469a4b7 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -56,8 +56,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; double cpuf; //uint8_t nfapi_mode = 0; uint16_t NB_UE_INST = 1; -uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; -uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; +uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; // needed for some functions PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}}; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index aaf37c9fd1..1211407749 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -56,8 +56,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} -uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; -uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; +uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; double cpuf; //uint8_t nfapi_mode = 0; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 3028db21e4..7b7b9f5d3e 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -244,7 +244,6 @@ nrUE_params_t *get_nrUE_params(void) { // needed for some functions uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; -//const uint8_t nr_rv_round_map[4] = {0, 2, 1, 3}; channel_desc_t *UE2gNB[NUMBER_OF_UE_MAX][NUMBER_OF_gNB_MAX]; @@ -721,7 +720,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0, 0, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c index aedb5729a3..34ea68bc61 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c @@ -229,7 +229,7 @@ int test_srs_periodicity(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc) for (int slot_tx = 0; slot_tx < frame_parms->slots_per_frame; slot_tx++) { proc->frame_tx = frame_tx; proc->nr_slot_tx = slot_tx; - if (ue_srs_procedure_nr( ue, proc, 0) == 0) { + if (ue_srs_procedures_nr( ue, proc, 0) == 0) { printf("test_srs_periodicity srs at frame %d slot %d \n", frame_tx, slot_tx); } } diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 63a581b37b..769bc7d01d 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -417,6 +417,7 @@ typedef struct NRRrcConfigurationReq_s { int pusch_AntennaPorts; int minRXTXTIME; int do_CSIRS; + int do_SRS; int pusch_TargetSNRx10; int pucch_TargetSNRx10; } gNB_RrcConfigurationReq; diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 6545408b9b..90cd9aae29 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -46,7 +46,7 @@ #define CONFIG_STRING_L1_LOCAL_N_PORTD "local_n_portd" #define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd" #define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference" -#define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads" +#define CONFIG_STRING_L1_THREAD_POOL_SIZE "thread_pool_size" #define CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR "ofdm_offset_divisor" #define CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD "pucch0_dtx_threshold" #define CONFIG_STRING_L1_PRACH_DTX_THRESHOLD "prach_dtx_threshold" @@ -65,8 +65,8 @@ {CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:4, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR, NULL, 0, uptr:NULL, defuintval:8, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_THREAD_POOL_SIZE, "Maximum number of CPU cores for L1 processing (either max HW CPU cores or this value is used)", 0, uptr:NULL, defintval:4, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_OFDM_OFFSET_DIVISOR, NULL, 0, uptr:NULL, defuintval:8, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:150, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ @@ -80,7 +80,7 @@ #define L1_REMOTE_N_PORTC_IDX 6 #define L1_LOCAL_N_PORTD_IDX 7 #define L1_REMOTE_N_PORTD_IDX 8 -#define L1_PUSCH_PROC_THREADS 9 +#define L1_THREAD_POOL_SIZE 9 #define L1_OFDM_OFFSET_DIVISOR 10 #define L1_PUCCH0_DTX_THRESHOLD 11 #define L1_PRACH_DTX_THRESHOLD 12 diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9710dd1814..db9614b13f 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -653,7 +653,7 @@ void RCconfig_NR_L1(void) { RC.gNB[j]->Mod_id = j; } - RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr); + RC.gNB[j]->thread_pool_size = *(L1_ParamList.paramarray[j][L1_THREAD_POOL_SIZE].uptr); RC.gNB[j]->ofdm_offset_divisor = *(L1_ParamList.paramarray[j][L1_OFDM_OFFSET_DIVISOR].uptr); RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr); RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr); @@ -1166,6 +1166,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; printf("Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr; + printf("Do SRS %d\n",*GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).do_SRS = *GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; NRRRC_CONFIGURATION_REQ (msg_p).scd = scd; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 5b879e04f6..cde7819e25 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -118,6 +118,7 @@ typedef enum { #define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts" #define GNB_CONFIG_STRING_SIB1TDA "sib1_tda" #define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS" +#define GNB_CONFIG_STRING_DOSRS "do_SRS" #define GNB_CONFIG_STRING_NRCELLID "nr_cellid" #define GNB_CONFIG_STRING_MINRXTXTIME "min_rxtxtime" #define GNB_CONFIG_STRING_ULPRBBLACKLIST "ul_prbblacklist" @@ -147,6 +148,7 @@ typedef enum { {GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DOSRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ {GNB_CONFIG_STRING_MINRXTXTIME, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_ULPRBBLACKLIST, NULL, 0, strptr:NULL, defstrval:"", TYPE_STRING, 0} \ @@ -171,9 +173,10 @@ typedef enum { #define GNB_PUSCH_ANTENNAPORTS_IDX 16 #define GNB_SIB1_TDA_IDX 17 #define GNB_DO_CSIRS_IDX 18 -#define GNB_NRCELLID_IDX 19 -#define GNB_MINRXTXTIME_IDX 20 -#define GNB_ULPRBBLACKLIST_IDX 21 +#define GNB_DO_SRS_IDX 19 +#define GNB_NRCELLID_IDX 20 +#define GNB_MINRXTXTIME_IDX 21 +#define GNB_ULPRBBLACKLIST_IDX 22 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 3f4be9dd58..942e3afad1 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2495,6 +2495,61 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { return 4; } +/******************************************************************* +* +* NAME : get_nr_srs_offset +* +* PARAMETERS : periodicityAndOffset for SRS +* +* RETURN : the offset parameter for SRS +* +*********************************************************************/ + +uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset) { + + switch(periodicityAndOffset.present) { + case NR_SRS_PeriodicityAndOffset_PR_sl1: + return periodicityAndOffset.choice.sl1; + case NR_SRS_PeriodicityAndOffset_PR_sl2: + return periodicityAndOffset.choice.sl2; + case NR_SRS_PeriodicityAndOffset_PR_sl4: + return periodicityAndOffset.choice.sl4; + case NR_SRS_PeriodicityAndOffset_PR_sl5: + return periodicityAndOffset.choice.sl5; + case NR_SRS_PeriodicityAndOffset_PR_sl8: + return periodicityAndOffset.choice.sl8; + case NR_SRS_PeriodicityAndOffset_PR_sl10: + return periodicityAndOffset.choice.sl10; + case NR_SRS_PeriodicityAndOffset_PR_sl16: + return periodicityAndOffset.choice.sl16; + case NR_SRS_PeriodicityAndOffset_PR_sl20: + return periodicityAndOffset.choice.sl20; + case NR_SRS_PeriodicityAndOffset_PR_sl32: + return periodicityAndOffset.choice.sl32; + case NR_SRS_PeriodicityAndOffset_PR_sl40: + return periodicityAndOffset.choice.sl40; + case NR_SRS_PeriodicityAndOffset_PR_sl64: + return periodicityAndOffset.choice.sl64; + case NR_SRS_PeriodicityAndOffset_PR_sl80: + return periodicityAndOffset.choice.sl80; + case NR_SRS_PeriodicityAndOffset_PR_sl160: + return periodicityAndOffset.choice.sl160; + case NR_SRS_PeriodicityAndOffset_PR_sl320: + return periodicityAndOffset.choice.sl320; + case NR_SRS_PeriodicityAndOffset_PR_sl640: + return periodicityAndOffset.choice.sl640; + case NR_SRS_PeriodicityAndOffset_PR_sl1280: + return periodicityAndOffset.choice.sl1280; + case NR_SRS_PeriodicityAndOffset_PR_sl2560: + return periodicityAndOffset.choice.sl2560; + case NR_SRS_PeriodicityAndOffset_PR_NOTHING: + LOG_W(NR_MAC,"NR_SRS_PeriodicityAndOffset_PR_NOTHING\n"); + return 0; + default: + return 0; + } +} + // Set the transform precoding status according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16: // - "UE procedure for applying transform precoding on PUSCH" uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 8182e1c930..91450fc796 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -119,6 +119,8 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); +uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset); + void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, NR_MIB_t *mib, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 22a13d223b..44bd8f0ce3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -57,6 +57,8 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" +//#define SRS_DEBUG + static prach_association_pattern_t prach_assoc_pattern; static ssb_list_info_t ssb_list; @@ -894,6 +896,133 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } +// Periodic SRS scheduling +bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slot) { + + bool srs_scheduled = false; + + NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); + + NR_SRS_Config_t *srs_config = NULL; + if (mac->cg && + mac->cg->spCellConfig && + mac->cg->spCellConfig->spCellConfigDedicated && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { + srs_config = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; + } else { + return false; + } + + for(int rs = 0; rs < srs_config->srs_ResourceSetToAddModList->list.count; rs++) { + + // Find periodic resource set + NR_SRS_ResourceSet_t *srs_resource_set = srs_config->srs_ResourceSetToAddModList->list.array[rs]; + if(srs_resource_set->resourceType.present != NR_SRS_ResourceSet__resourceType_PR_periodic) { + continue; + } + + // Find the corresponding srs resource + NR_SRS_Resource_t *srs_resource = NULL; + for(int r1 = 0; r1 < srs_resource_set->srs_ResourceIdList->list.count; r1++) { + for (int r2 = 0; r2 < srs_config->srs_ResourceToAddModList->list.count; r2++) { + if ((*srs_resource_set->srs_ResourceIdList->list.array[r1] == srs_config->srs_ResourceToAddModList->list.array[r2]->srs_ResourceId) && + (srs_config->srs_ResourceToAddModList->list.array[r2]->resourceType.present == NR_SRS_Resource__resourceType_PR_periodic)) { + srs_resource = srs_config->srs_ResourceToAddModList->list.array[r2]; + break; + } + } + } + + if(srs_resource == NULL) { + continue; + } + + NR_BWP_t ubwp = mac->ULbwp[0] ? + mac->ULbwp[0]->bwp_Common->genericParameters : + mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters; + + uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; + uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); + + int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing]; + + // Check if UE should transmit the SRS + if((frame*n_slots_frame+slot-offset)%period == 0) { + + fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot); + fapi_nr_ul_config_srs_pdu *srs_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].srs_config_pdu; + + srs_config_pdu->rnti = mac->crnti; + srs_config_pdu->handle = 0; + srs_config_pdu->bwp_size = NRRIV2BW(ubwp.locationAndBandwidth, MAX_BWP_SIZE);; + srs_config_pdu->bwp_start = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth, MAX_BWP_SIZE);; + srs_config_pdu->subcarrier_spacing = ubwp.subcarrierSpacing; + srs_config_pdu->cyclic_prefix = 0; + srs_config_pdu->num_ant_ports = srs_resource->nrofSRS_Ports; + srs_config_pdu->num_symbols = srs_resource->resourceMapping.nrofSymbols; + srs_config_pdu->num_repetitions = srs_resource->resourceMapping.repetitionFactor; + srs_config_pdu->time_start_position = srs_resource->resourceMapping.startPosition; + srs_config_pdu->config_index = srs_resource->freqHopping.c_SRS; + srs_config_pdu->sequence_id = srs_resource->sequenceId; + srs_config_pdu->bandwidth_index = srs_resource->freqHopping.b_SRS; + srs_config_pdu->comb_size = srs_resource->transmissionComb.present - 1; + + switch(srs_resource->transmissionComb.present) { + case NR_SRS_Resource__transmissionComb_PR_n2: + srs_config_pdu->comb_offset = srs_resource->transmissionComb.choice.n2->combOffset_n2; + srs_config_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n2->cyclicShift_n2; + break; + case NR_SRS_Resource__transmissionComb_PR_n4: + srs_config_pdu->comb_offset = srs_resource->transmissionComb.choice.n4->combOffset_n4; + srs_config_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n4->cyclicShift_n4; + break; + default: + LOG_W(NR_MAC, "Invalid or not implemented comb_size!\n"); + } + + srs_config_pdu->frequency_position = srs_resource->freqDomainPosition; + srs_config_pdu->frequency_shift = srs_resource->freqDomainShift; + srs_config_pdu->frequency_hopping = srs_resource->freqHopping.b_hop; + srs_config_pdu->group_or_sequence_hopping = srs_resource->groupOrSequenceHopping; + srs_config_pdu->resource_type = srs_resource->resourceType.present - 1; + srs_config_pdu->t_srs = period; + srs_config_pdu->t_offset = offset; + +#ifdef SRS_DEBUG + LOG_I(NR_MAC,"Frame = %i, slot = %i\n", frame, slot); + LOG_I(NR_MAC,"srs_config_pdu->rnti = 0x%04x\n", srs_config_pdu->rnti); + LOG_I(NR_MAC,"srs_config_pdu->handle = %u\n", srs_config_pdu->handle); + LOG_I(NR_MAC,"srs_config_pdu->bwp_size = %u\n", srs_config_pdu->bwp_size); + LOG_I(NR_MAC,"srs_config_pdu->bwp_start = %u\n", srs_config_pdu->bwp_start); + LOG_I(NR_MAC,"srs_config_pdu->subcarrier_spacing = %u\n", srs_config_pdu->subcarrier_spacing); + LOG_I(NR_MAC,"srs_config_pdu->cyclic_prefix = %u (0: Normal; 1: Extended)\n", srs_config_pdu->cyclic_prefix); + LOG_I(NR_MAC,"srs_config_pdu->num_ant_ports = %u (0 = 1 port, 1 = 2 ports, 2 = 4 ports)\n", srs_config_pdu->num_ant_ports); + LOG_I(NR_MAC,"srs_config_pdu->num_symbols = %u (0 = 1 symbol, 1 = 2 symbols, 2 = 4 symbols)\n", srs_config_pdu->num_symbols); + LOG_I(NR_MAC,"srs_config_pdu->num_repetitions = %u (0 = 1, 1 = 2, 2 = 4)\n", srs_config_pdu->num_repetitions); + LOG_I(NR_MAC,"srs_config_pdu->time_start_position = %u\n", srs_config_pdu->time_start_position); + LOG_I(NR_MAC,"srs_config_pdu->config_index = %u\n", srs_config_pdu->config_index); + LOG_I(NR_MAC,"srs_config_pdu->sequence_id = %u\n", srs_config_pdu->sequence_id); + LOG_I(NR_MAC,"srs_config_pdu->bandwidth_index = %u\n", srs_config_pdu->bandwidth_index); + LOG_I(NR_MAC,"srs_config_pdu->comb_size = %u (0 = comb size 2, 1 = comb size 4, 2 = comb size 8)\n", srs_config_pdu->comb_size); + LOG_I(NR_MAC,"srs_config_pdu->comb_offset = %u\n", srs_config_pdu->comb_offset); + LOG_I(NR_MAC,"srs_config_pdu->cyclic_shift = %u\n", srs_config_pdu->cyclic_shift); + LOG_I(NR_MAC,"srs_config_pdu->frequency_position = %u\n", srs_config_pdu->frequency_position); + LOG_I(NR_MAC,"srs_config_pdu->frequency_shift = %u\n", srs_config_pdu->frequency_shift); + LOG_I(NR_MAC,"srs_config_pdu->frequency_hopping = %u\n", srs_config_pdu->frequency_hopping); + LOG_I(NR_MAC,"srs_config_pdu->group_or_sequence_hopping = %u (0 = No hopping, 1 = Group hopping groupOrSequenceHopping, 2 = Sequence hopping)\n", srs_config_pdu->group_or_sequence_hopping); + LOG_I(NR_MAC,"srs_config_pdu->resource_type = %u (0: aperiodic, 1: semi-persistent, 2: periodic)\n", srs_config_pdu->resource_type); + LOG_I(NR_MAC,"srs_config_pdu->t_srs = %u\n", srs_config_pdu->t_srs); + LOG_I(NR_MAC,"srs_config_pdu->t_offset = %u\n", srs_config_pdu->t_offset); +#endif + + fill_ul_config(ul_config, frame, slot, FAPI_NR_UL_CONFIG_TYPE_SRS); + srs_scheduled = true; + } + } + return srs_scheduled; +} + // Performs : // 1. TODO: Call RRC for link status return to PHY // 2. TODO: Perform SR/BSR procedures for scheduling feedback @@ -962,6 +1091,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in if (!ul_config) { LOG_E(NR_MAC, "mac->ul_config is null!\n"); } + + // Periodic SRS scheduling + nr_ue_periodic_srs_scheduling(mod_id, frame_tx, slot_tx); + // Schedule ULSCH only if the current frame and slot match those in ul_config_req // AND if a UL grant (UL DCI or Msg3) has been received (as indicated by num_pdus) if (ul_config){ @@ -1052,7 +1185,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } if (dl_info) { - return (CONNECTION_OK); + return (UE_CONNECTION_OK); } module_id_t mod_id = ul_info->module_id; frame_t txFrameP = ul_info->frame_tx; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ae3a3bba24..7b89e4e993 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -536,7 +536,6 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (CellGroup) { const NR_ServingCellConfig_t *servingCellConfig = CellGroup->spCellConfig->spCellConfigDedicated; - const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; if(bwpList) { AssertFatal(bwpList->list.count > 0, "downlinkBWP_ToAddModList has no BWPs!\n"); @@ -607,6 +606,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ra->msg3_dcch_dtch = false; LOG_I(NR_MAC,"Added new RA process for UE RNTI %04x with initial CellGroup\n", rnti); } else { // CellGroup has been updated + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon; const int UE_id = find_nr_UE_id(Mod_idP,rnti); int target_ss; UE_info->CellGroup[UE_id] = CellGroup; @@ -627,19 +627,30 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } // update coreset/searchspace void *bwpd = NULL; + NR_BWP_t *genericParameters = NULL; target_ss = NR_SearchSpace__searchSpaceType_PR_common; if ((sched_ctrl->active_bwp)) { target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; bwpd = (void*)sched_ctrl->active_bwp->bwp_Dedicated; + genericParameters = &sched_ctrl->active_bwp->bwp_Common->genericParameters; } else if (CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated && (CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)) { target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; bwpd = (void*)CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP; + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; } + else + AssertFatal(1==0,"Either initial BWP or active BWP should always be present\n"); sched_ctrl->search_space = get_searchspace(scc, bwpd, target_ss); sched_ctrl->coreset = get_coreset(Mod_idP, scc, bwpd, sched_ctrl->search_space, target_ss); + sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[Mod_idP], + sched_ctrl->search_space, + sched_ctrl->coreset, + scc, + genericParameters, + NULL); sched_ctrl->maxL = 2; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 87c1dee1e5..ba854608c5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -55,6 +55,7 @@ #include #include +const uint8_t nr_rv_round_map[4] = { 0, 2, 3, 1 }; uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; uint8_t vnf_first_sched_entry = 1; @@ -67,7 +68,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; nfapi_nr_dl_tti_request_t *DL_req = &gNB->DL_req[0]; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t ***pdcch = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t ***)gNB->pdcch_pdu_idx[CC_idP]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t **pdcch = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t **)gNB->pdcch_pdu_idx[CC_idP]; nfapi_nr_ul_tti_request_t *future_ul_tti_req = &gNB->UL_tti_req_ahead[CC_idP][(slotP + num_slots - 1) % num_slots]; nfapi_nr_ul_dci_request_t *UL_dci_req = &gNB->UL_dci_req[0]; @@ -80,7 +81,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, DL_req[CC_idP].dl_tti_request_body.nPDUs = 0; DL_req[CC_idP].dl_tti_request_body.nGroup = 0; //DL_req[CC_idP].dl_tti_request_body.transmission_power_pcfich = 6000; - memset(pdcch, 0, sizeof(**pdcch) * MAX_NUM_BWP * MAX_NUM_CORESET); + memset(pdcch, 0, sizeof(*pdcch) * MAX_NUM_CORESET); UL_dci_req[CC_idP].SFN = frameP; UL_dci_req[CC_idP].Slot = slotP; @@ -272,12 +273,10 @@ bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ - //pthread_mutex_lock(&mutextest); protocol_ctxt_t ctxt={0}; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); - const int bwp_id = 1; char stats_output[16384]; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; @@ -308,13 +307,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); } - memset(RC.nrmac[module_idP]->cce_list[0][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 - memset(RC.nrmac[module_idP]->cce_list[0][1],0,MAX_NUM_CCE*sizeof(int)); // coreset1 on initialBWP - memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1 - NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; - for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) - for (int i=0; inum_pdcch_cand[UE_id][i] = 0; + for (int i=0; ipdcch_cand[i] = 0; for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { //mbsfn_status[CC_id] = 0; @@ -384,6 +378,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if (slot == 0) nr_csi_meas_reporting(module_idP, frame, slot); + // Schedule SRS: check in slot 0 for the whole frame + if (slot == 0) + nr_schedule_srs(module_idP, frame); + // This schedule RA procedure if not in phy_test mode // Otherwise already consider 5G already connected if (get_softmodem_params()->phy_test == 0) { @@ -394,7 +392,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_schedule_ulsch(module_idP, frame, slot); // This schedules the DCI for Downlink and PDSCH - nr_schedule_ue_spec(module_idP, frame, slot); + start_meas(&gNB->schedule_dlsch); + nr_schedule_ue_spec(module_idP, frame, slot); + stop_meas(&gNB->schedule_dlsch); nr_schedule_pucch(module_idP, 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 4172374ee8..4261020f76 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -587,12 +587,15 @@ void nr_initiate_ra_proc(module_id_t module_idP, NR_SearchSpaceId_t ra_SearchSpace = 0; struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = NULL; + NR_BWP_t *genericParameters = NULL; if(bwp) { commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; ra_SearchSpace = *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + genericParameters = &bwp->bwp_Common->genericParameters; } else { commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; ra_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; } AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); @@ -605,6 +608,14 @@ void nr_initiate_ra_proc(module_id_t module_idP, AssertFatal(ra->ra_ss!=NULL,"SearchSpace cannot be null for RA\n"); + ra->coreset = get_coreset(module_idP, scc, bwp, ra->ra_ss, NR_SearchSpace__searchSpaceType_PR_common); + ra->sched_pdcch = set_pdcch_structure(nr_mac, + ra->ra_ss, + ra->coreset, + scc, + genericParameters, + NULL); + // retrieving ra pdcch monitoring period and offset find_monitoring_periodicity_offset_common(ra->ra_ss, &monitoring_slot_period, &monitoring_offset); @@ -781,13 +792,13 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t // generation of DCI 0_0 to schedule msg3 retransmission NR_SearchSpace_t *ss = ra->ra_ss; - NR_ControlResourceSet_t *coreset = get_coreset(module_idP, scc, NULL, ss, NR_SearchSpace__searchSpaceType_PR_common); + NR_ControlResourceSet_t *coreset = ra->coreset; AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg3 retransmission\n"); nfapi_nr_ul_dci_request_t *ul_dci_req = &nr_mac->UL_dci_req[CC_id]; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &ul_dci_req->ul_dci_pdu_list[ul_dci_req->numPdus]; memset(ul_dci_request_pdu, 0, sizeof(nfapi_nr_ul_dci_request_pdus_t)); @@ -795,8 +806,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; ul_dci_req->numPdus += 1; - nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL); - nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, coreset, genericParameters, &ra->sched_pdcch); + nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } uint8_t aggregation_level; @@ -807,7 +818,13 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t if(nr_of_candidates>0) break; } AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); - int CCEIndex = allocate_nr_CCEs(nr_mac, NULL, coreset, aggregation_level, 0, 0, nr_of_candidates); + int CCEIndex = find_pdcch_candidate(nr_mac, + CC_id, + aggregation_level, + nr_of_candidates, + &ra->sched_pdcch, + coreset, + 0); if (CCEIndex < 0) { LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); return; @@ -848,6 +865,13 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t ra->bwp_id); // Mark the corresponding RBs as used + + fill_pdcch_vrb_map(nr_mac, + CC_id, + &ra->sched_pdcch, + CCEIndex, + aggregation_level); + for (int rb = 0; rb < ra->msg3_nb_rb; rb++) { vrb_map_UL[rbStart + BWPStart + rb] = 1; } @@ -1165,13 +1189,19 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra BWPSize = type0_PDCCH_CSS_config->num_rbs; } - coreset = get_coreset(module_idP, scc, bwp, ss, NR_SearchSpace__searchSpaceType_PR_common); + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + + coreset = ra->coreset; AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg2\n"); uint16_t *vrb_map = cc[CC_id].vrb_map; for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { - if (vrb_map[BWPStart + rbStart + i]) { + if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(startSymbolIndex, nrOfSymbols)) { rbStart += i; i = 0; } @@ -1197,18 +1227,20 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra if(nr_of_candidates>0) break; } AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); - int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); + + int CCEIndex = find_pdcch_candidate(nr_mac, + CC_id, + aggregation_level, + nr_of_candidates, + &ra->sched_pdcch, + coreset, + 0); + if (CCEIndex < 0) { LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); return; } - // Calculate number of symbols - int startSymbolIndex, nrOfSymbols; - const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); - LOG_D(NR_MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",startSymbolIndex,nrOfSymbols); int mappingtype = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType; @@ -1217,7 +1249,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -1225,8 +1257,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, coreset, genericParameters, &ra->sched_pdcch); + nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -1385,9 +1417,14 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Slot = slotP; - // Mark the corresponding RBs as used + // Mark the corresponding symbols RBs as used + fill_pdcch_vrb_map(nr_mac, + CC_id, + &ra->sched_pdcch, + CCEIndex, + aggregation_level); for (int rb = 0; rb < rbSize; rb++) { - vrb_map[BWPStart + rb + rbStart] = 1; + vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols); } ra->state = WAIT_Msg3; @@ -1424,7 +1461,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; } - coreset = get_coreset(module_idP, scc, bwp, ss, NR_SearchSpace__searchSpaceType_PR_common); + coreset = ra->coreset; AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg4\n"); @@ -1481,7 +1518,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra if(nr_of_candidates>0) break; } AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); - int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); + + int CCEIndex = find_pdcch_candidate(nr_mac, + CC_id, + aggregation_level, + nr_of_candidates, + &ra->sched_pdcch, + coreset, + 0); + if (CCEIndex < 0) { LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); return; @@ -1587,7 +1632,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra int i = 0; while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) { - if (vrb_map[BWPStart + rbStart + i]) { + if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(startSymbolIndex, nrOfSymbols)) { rbStart += i+1; i = 0; } else { @@ -1612,7 +1657,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -1620,8 +1665,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(nr_mac, pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, coreset, genericParameters, &ra->sched_pdcch); + nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -1761,9 +1806,14 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Slot = slotP; - // Mark the corresponding RBs as used + // Mark the corresponding symbols and RBs as used + fill_pdcch_vrb_map(nr_mac, + CC_id, + &ra->sched_pdcch, + CCEIndex, + aggregation_level); for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) { - vrb_map[BWPStart + rb + pdsch_pdu_rel15->rbStart] = 1; + vrb_map[BWPStart + rb + pdsch_pdu_rel15->rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols); } LOG_D(NR_MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index b6e335466d..6fad65526f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -314,7 +314,7 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart uint16_t *vrb_map = cc[CC_id].vrb_map; for (int rb = 0; rb < 20; rb++) - vrb_map[rbStart + rb] = 15<common_channels[CC_id].vrb_map; + NR_COMMON_channels_t *cc = &gNB_mac->common_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + uint16_t *vrb_map = cc->vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n"); @@ -340,6 +342,12 @@ uint32_t schedule_control_sib1(module_id_t module_id, fill_coresetZero(gNB_mac->sched_ctrlCommon->coreset,type0_PDCCH_CSS_config); gNB_mac->cset0_bwp_start = type0_PDCCH_CSS_config->cset_start_rb; gNB_mac->cset0_bwp_size = type0_PDCCH_CSS_config->num_rbs; + gNB_mac->sched_ctrlCommon->sched_pdcch = set_pdcch_structure(NULL, + gNB_mac->sched_ctrlCommon->search_space, + gNB_mac->sched_ctrlCommon->coreset, + scc, + NULL, + type0_PDCCH_CSS_config); } gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation = time_domain_allocation; @@ -354,13 +362,13 @@ uint32_t schedule_control_sib1(module_id_t module_id, if (nr_of_candidates>0) break; // choosing the lower value of aggregation level available } AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); - gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], - NULL, - gNB_mac->sched_ctrlCommon->coreset, - gNB_mac->sched_ctrlCommon->aggregation_level, - 0, - candidate_idx, - nr_of_candidates); + gNB_mac->sched_ctrlCommon->cce_index = find_pdcch_candidate(gNB_mac, + CC_id, + gNB_mac->sched_ctrlCommon->aggregation_level, + nr_of_candidates, + &gNB_mac->sched_ctrlCommon->sched_pdcch, + gNB_mac->sched_ctrlCommon->coreset, + 0); AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n"); @@ -384,7 +392,7 @@ uint32_t schedule_control_sib1(module_id_t module_id, int rbSize = 0; uint32_t TBS = 0; do { - if(rbSize < bwpSize && !vrb_map[rbStart + rbSize]) + if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(startSymbolIndex, nrOfSymbols))) rbSize++; else{ if (gNB_mac->sched_ctrlCommon->sched_pdsch.mcs<10) @@ -411,16 +419,21 @@ uint32_t schedule_control_sib1(module_id_t module_id, LOG_D(MAC,"dmrs_length %d\n",dmrs_length); LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); LOG_D(MAC,"mappingtype = %d\n", mappingtype); - // Mark the corresponding RBs as used + fill_pdcch_vrb_map(gNB_mac, + CC_id, + &gNB_mac->sched_ctrlCommon->sched_pdcch, + gNB_mac->sched_ctrlCommon->cce_index, + gNB_mac->sched_ctrlCommon->aggregation_level); for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) { - vrb_map[rb + rbStart] = 1; + vrb_map[rb + rbStart] = SL_to_bitmap(startSymbolIndex, nrOfSymbols); } return TBS; } void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req, + int pdu_index, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, uint32_t TBS, int StartSymbolIndex, @@ -437,13 +450,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(NULL, - pdcch_pdu_rel15, - gNB_mac->sched_ctrlCommon->search_space, + nr_configure_pdcch(pdcch_pdu_rel15, gNB_mac->sched_ctrlCommon->coreset, - scc, NULL, - type0_PDCCH_CSS_config); + &gNB_mac->sched_ctrlCommon->sched_pdcch); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -456,7 +466,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->pduBitmap = 0; pdsch_pdu_rel15->rnti = SI_RNTI; - pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; + pdsch_pdu_rel15->pduIndex = pdu_index; pdsch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; pdsch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; @@ -623,7 +633,8 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) candidate_idx, sib1_sdu_length); nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols, dlDmrsSymbPos); + int pdu_index = gNB_mac->pdu_index[0]++; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols, dlDmrsSymbPos); const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; @@ -633,7 +644,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); tx_req->PDU_length = TBS; - tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->PDU_index = pdu_index; tx_req->num_TLV = 1; tx_req->TLVs[0].length = TBS + 2; gNB_mac->TX_req[CC_id].Number_of_PDUs++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index ea298494c4..cb76c22292 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -409,7 +409,7 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t /*const int dret3x = stats->dlsch_rounds[3] - bler_stats->dlsch_rounds[3]; if (dret3x > 0) { if there is a third retransmission, decrease MCS for stabilization and - restart averaging window to stabilize transmission + restart averaging window to stabilize transmission bler_stats->last_frame_slot = now; bler_stats->mcs = max(9, bler_stats->mcs - 1); memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds)); @@ -431,7 +431,7 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t int new_mcs = old_mcs; // TODO put back this condition when relevant /* first ensure that number of 2nd retx is below threshold. If this is the - * case, use 1st retx to adjust faster + * case, use 1st retx to adjust faster if (bler_stats->rd2_bler > nrmac->dl_rd2_bler_threshold && old_mcs > 6) { new_mcs -= 2; } else if (bler_stats->rd2_bler < nrmac->dl_rd2_bler_threshold) {*/ @@ -486,7 +486,8 @@ void nr_store_dlsch_buffer(module_id_t module_id, DL_SCH_LCID_DCCH, 0, 0); - if ((sched_ctrl->lcid_mask&(1<<4)) > 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, @@ -497,16 +498,17 @@ void nr_store_dlsch_buffer(module_id_t module_id, DL_SCH_LCID_DTCH, 0, 0); - - 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; - } + 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 @@ -531,7 +533,7 @@ void nr_store_dlsch_buffer(module_id_t module_id, bool allocate_dl_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 current_harq_pid) { @@ -561,13 +563,16 @@ bool allocate_dl_retransmission(module_id_t module_id, while (rbSize < retInfo->rbSize) { rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbSize = 0; - while (rbStart < bwpSize && !rballoc_mask[rbStart]) + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) rbStart++; if (rbStart >= bwpSize) { LOG_D(NR_MAC, "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]); return false; } - while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && rbSize < retInfo->rbSize) + while (rbStart + rbSize < bwpSize && + (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) && + rbSize < retInfo->rbSize) rbSize++; } /* check whether we need to switch the TDA allocation since the last @@ -577,13 +582,15 @@ bool allocate_dl_retransmission(module_id_t module_id, } else { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ - while (rbStart < bwpSize && !rballoc_mask[rbStart]) - rbStart++; - while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) - rbSize++; NR_pdsch_semi_static_t temp_ps; temp_ps.nrOfLayers = 1; nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, &temp_ps); + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + rbStart++; + while (rbStart + rbSize < bwpSize && + (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) + rbSize++; uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -607,8 +614,27 @@ bool allocate_dl_retransmission(module_id_t module_id, } /* Find a free CCE */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { + const int cid = sched_ctrl->coreset->controlResourceSetId; + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + uint8_t nr_of_candidates; + for (int i=0; i<5; i++) { + // for now taking the lowest value among the available aggregation levels + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space, + 1<0) break; + } + + int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], + /* CC_id = */ 0, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + + if (CCEIndex<0) { LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, UE_info->rnti[UE_id]); return false; @@ -625,14 +651,18 @@ bool allocate_dl_retransmission(module_id_t module_id, UE_info->rnti[UE_id], frame, slot); - int cid = sched_ctrl->coreset->controlResourceSetId; - UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp?sched_ctrl->active_bwp->bwp_Id:0][cid]; - for (int i = 0; i < sched_ctrl->aggregation_level; i++) - cce_list[sched_ctrl->cce_index + i] = 0; + RC.nrmac[module_id]->pdcch_cand[cid]--; return false; } + sched_ctrl->cce_index = CCEIndex; + + fill_pdcch_vrb_map(RC.nrmac[module_id], + /* CC_id = */ 0, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + /* just reuse from previous scheduling opportunity, set new start RB */ sched_ctrl->sched_pdsch = *retInfo; sched_ctrl->sched_pdsch.rbStart = rbStart; @@ -642,7 +672,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] = 0; + rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] -= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); return true; } @@ -655,7 +685,7 @@ void pf_dl(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) { gNB_MAC_INST *mac = RC.nrmac[module_id]; NR_UE_info_t *UE_info = &mac->UE_info; @@ -732,7 +762,6 @@ void pf_dl(module_id_t module_id, NR_BWP_DownlinkDedicated_t *bwpd= cg ? cg->spCellConfig->spCellConfigDedicated->initialDownlinkBWP:NULL; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; const uint16_t rnti = UE_info->rnti[UE_id]; NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? &sched_ctrl->active_bwp->bwp_Common->genericParameters: @@ -747,8 +776,27 @@ void pf_dl(module_id_t module_id, } /* Find a free CCE */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { + const int cid = sched_ctrl->coreset->controlResourceSetId; + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + uint8_t nr_of_candidates; + for (int i=0; i<5; i++) { + // for now taking the lowest value among the available aggregation levels + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space, + 1<0) break; + } + + int CCEIndex = find_pdcch_candidate(mac, + /* CC_id = */ 0, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + + if (CCEIndex<0) { LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); continue; } @@ -767,20 +815,17 @@ void pf_dl(module_id_t module_id, rnti, frame, slot); - int cid = sched_ctrl->coreset->controlResourceSetId; - UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = mac->cce_list[bwp_Id][cid]; - for (int i = 0; i < sched_ctrl->aggregation_level; i++) - cce_list[sched_ctrl->cce_index + i] = 0; + mac->pdcch_cand[cid]--; return; } - // Freq-demain allocation - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; + sched_ctrl->cce_index = CCEIndex; - uint16_t max_rbSize = 1; - while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) - max_rbSize++; + fill_pdcch_vrb_map(mac, + /* CC_id = */ 0, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); /* MCS has been set above */ @@ -791,6 +836,18 @@ void pf_dl(module_id_t module_id, const long f = (sched_ctrl->active_bwp || bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; if (ps->time_domain_allocation != tda) nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps); + + const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + // Freq-demain allocation + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&slbitmap)) + rbStart++; + + uint16_t max_rbSize = 1; + while (rbStart + max_rbSize < bwpSize && + (rballoc_mask[rbStart + max_rbSize]&slbitmap)) + max_rbSize++; + sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->pucch_allocation = alloc; @@ -812,7 +869,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] = 0; + rballoc_mask[rb + sched_pdsch->rbStart] -= slbitmap; } } @@ -825,9 +882,18 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; const int CC_id = 0; - /* Get bwpSize from the first UE */ + /* Get bwpSize and TDAfrom the first UE */ + /* This is temporary and it assumes all UEs have the same BWP and TDA*/ int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; + int startSymbolIndex, nrOfSymbols; + const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_bwp ? + sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList : + scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth: @@ -838,14 +904,18 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t slbitmap = SL_to_bitmap(startSymbolIndex, nrOfSymbols); uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; - uint8_t rballoc_mask[bwpSize]; + uint16_t rballoc_mask[bwpSize]; int n_rb_sched = 0; for (int i = 0; i < bwpSize; i++) { // calculate mask: init with "NOT" vrb_map: // if any RB in vrb_map is blocked (1), the current RBG will be 0 - rballoc_mask[i] = !vrb_map[i+BWPStart]; - n_rb_sched += rballoc_mask[i]; + rballoc_mask[i] = (~vrb_map[i+BWPStart])&0x3fff; //bitwise not and 14 symbols + // if all the pdsch symbols are free + if((rballoc_mask[i]&slbitmap) == + slbitmap) + n_rb_sched++; } /* Retrieve amount of data to send for this UE */ @@ -1000,7 +1070,7 @@ void nr_schedule_ue_spec(module_id_t module_id, const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = (bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][coresetid]; if (!pdcch_pdu) { LOG_D(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -1010,10 +1080,9 @@ void nr_schedule_ue_spec(module_id_t module_id, dl_req->nPDUs += 1; pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %d, bwp %d, cs %d\n",UE_id,bwpid,coresetid); - NR_SearchSpace_t *ss = (bwp||bwpd) ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space; NR_ControlResourceSet_t *coreset = (bwp||bwpd)? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset; - nr_configure_pdcch(gNB_mac, pdcch_pdu, ss, coreset, scc, genericParameters, NULL); - gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu; + nr_configure_pdcch(pdcch_pdu, coreset, genericParameters, &sched_ctrl->sched_pdcch); + gNB_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -1096,6 +1165,7 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->pduBitmap |= 0x1; // Bit 0: pdschPtrs - Indicates PTRS included (FR2) } + LOG_D(NR_MAC,"Configuring DCI/PDCCH in %d.%d at CCE %d, rnti %x\n", frame,slot,sched_ctrl->cce_index,rnti); /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; pdcch_pdu->numDlDci++; @@ -1228,6 +1298,7 @@ void nr_schedule_ue_spec(module_id_t module_id, // 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) { @@ -1241,6 +1312,7 @@ void nr_schedule_ue_spec(module_id_t module_id, /* 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, @@ -1301,6 +1373,7 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += size; dlsch_total_bytes += size; } + stop_meas(&gNB_mac->rlc_data_req); // Add padding header and zero rest out if there is space left if (size > 0) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 26898550f4..e57443def2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -53,7 +53,6 @@ //#define UL_HARQ_PRINT extern RAN_CONTEXT_t RC; -const uint8_t nr_rv_round_map[4] = {0, 2, 3, 1}; //#define ENABLE_MAC_PAYLOAD_DEBUG 1 /*Scheduling of DLSCH with associated DCI in common search space @@ -276,6 +275,14 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; + const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + ps->nrOfLayers = target_dl_Nl; + if (ps->time_domain_allocation != tda) + nr_set_pdsch_semi_static( + scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); + /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); const int BWPStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -287,11 +294,14 @@ void nr_preprocessor_phytest(module_id_t module_id, /* loop ensures that we allocate exactly target_dl_bw, or return */ while (true) { /* advance to first free RB */ - while (rbStart < bwpSize && vrb_map[rbStart + BWPStart]) + while (rbStart < bwpSize && + (vrb_map[rbStart + BWPStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) rbStart++; rbSize = 1; /* iterate until we are at target_dl_bw or no available RBs */ - while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize + BWPStart] && rbSize < target_dl_bw) + while (rbStart + rbSize < bwpSize && + !(vrb_map[rbStart + rbSize + BWPStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) && + rbSize < target_dl_bw) rbSize++; /* found target_dl_bw? */ if (rbSize == target_dl_bw) @@ -332,16 +342,17 @@ void nr_preprocessor_phytest(module_id_t module_id, AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); const int cid = sched_ctrl->coreset->controlResourceSetId; - const uint16_t Y = UE_info->Y[UE_id][cid][slot]; - const int m = UE_info->num_pdcch_cand[UE_id][cid]; - sched_ctrl->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], - sched_ctrl->active_bwp, - sched_ctrl->coreset, - sched_ctrl->aggregation_level, - Y, - m, - nr_of_candidates); - AssertFatal(sched_ctrl->cce_index >= 0, + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + + int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], + CC_id, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + + AssertFatal(CCEIndex >= 0, "%s(): could not find CCE for UE %d\n", __func__, UE_id); @@ -355,28 +366,26 @@ void nr_preprocessor_phytest(module_id_t module_id, rnti, frame, slot); - UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid]; - for (int i = 0; i < sched_ctrl->aggregation_level; i++) - cce_list[sched_ctrl->cce_index + i] = 0; + RC.nrmac[module_id]->pdcch_cand[cid]--; 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); + //AssertFatal(alloc, // "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n", // rnti, frame, slot); NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; - NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; sched_pdsch->pucch_allocation = alloc; sched_pdsch->rbStart = rbStart; sched_pdsch->rbSize = rbSize; - const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; - const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; - ps->nrOfLayers = target_dl_Nl; - if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static( - scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); sched_pdsch->mcs = target_dl_mcs; sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); @@ -396,7 +405,7 @@ void nr_preprocessor_phytest(module_id_t module_id, /* mark the corresponding RBs as used */ for (int rb = 0; rb < sched_pdsch->rbSize; rb++) - vrb_map[rb + sched_pdsch->rbStart + BWPStart] = 1; + vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize); } @@ -499,20 +508,21 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); const int cid = sched_ctrl->coreset->controlResourceSetId; - const uint16_t Y = UE_info->Y[UE_id][cid][slot]; - const int m = UE_info->num_pdcch_cand[UE_id][cid]; - sched_ctrl->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], - sched_ctrl->active_bwp, - sched_ctrl->coreset, - sched_ctrl->aggregation_level, - Y, - m, - nr_of_candidates); + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + + int CCEIndex = find_pdcch_candidate(nr_mac, + CC_id, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + if (sched_ctrl->cce_index < 0) { LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PUSCH\n", __func__); + nr_mac->pdcch_cand[cid]--; return false; } - UE_info->num_pdcch_cand[UE_id][cid]++; const int mcs = target_ul_mcs; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; @@ -541,6 +551,12 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ >> 3; /* mark the corresponding RBs as used */ + fill_pdcch_vrb_map(nr_mac, + CC_id, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + for (int rb = rbStart; rb < rbStart + rbSize; rb++) vrb_map_UL[rb+BWPStart] = 1; 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 7b7b5c771b..a1dfc7c833 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -159,6 +159,7 @@ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_SearchSpace_t *ss, NR_SearchSpace__searchSpaceType_PR ss_type) { NR_ControlResourceSetId_t coreset_id = *ss->controlResourceSetId; + if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) { // common search space NR_ControlResourceSet_t *coreset; if(coreset_id == 0) { @@ -208,53 +209,180 @@ NR_SearchSpace_t *get_searchspace(NR_ServingCellConfigCommon_t *scc, AssertFatal(0, "Couldn't find an adequate searchspace bwp_Dedicated %p\n",bwp_Dedicated); } -int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, - NR_BWP_Downlink_t *bwp, - NR_ControlResourceSet_t *coreset, - int aggregation, - uint16_t Y, - int m, - int nr_of_candidates) { +NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, + NR_SearchSpace_t *ss, + NR_ControlResourceSet_t *coreset, + NR_ServingCellConfigCommon_t *scc, + NR_BWP_t *bwp, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - int coreset_id = coreset->controlResourceSetId; + int sps; + NR_sched_pdcch_t pdcch; - int *cce_list; - if(bwp == NULL) { - cce_list = nr_mac->cce_list[0][coreset_id]; - } else { - cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; + AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId, + "coreset id in SS %ld does not correspond to the one in coreset %ld", + *ss->controlResourceSetId, coreset->controlResourceSetId); + + if (bwp) { // This is not for SIB1 + if(coreset->controlResourceSetId == 0){ + pdcch.BWPSize = gNB_mac->cset0_bwp_size; + pdcch.BWPStart = gNB_mac->cset0_bwp_start; + } + else { + pdcch.BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE); + pdcch.BWPStart = NRRIV2PRBOFFSET(bwp->locationAndBandwidth, MAX_BWP_SIZE); + } + pdcch.SubcarrierSpacing = bwp->subcarrierSpacing; + pdcch.CyclicPrefix = (bwp->cyclicPrefix==NULL) ? 0 : *bwp->cyclicPrefix; + + //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); + sps = bwp->cyclicPrefix == NULL ? 14 : 12; + } + else { + AssertFatal(type0_PDCCH_CSS_config!=NULL,"type0_PDCCH_CSS_config is null,bwp %p\n",bwp); + pdcch.BWPSize = type0_PDCCH_CSS_config->num_rbs; + pdcch.BWPStart = type0_PDCCH_CSS_config->cset_start_rb; + pdcch.SubcarrierSpacing = type0_PDCCH_CSS_config->scs_pdcch; + pdcch.CyclicPrefix = 0; + sps = 14; } - int n_rb=0; - for (int i=0;i<6;i++) - for (int j=0;j<8;j++) { - n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1); + AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); + AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); + + // for SPS=14 8 MSBs in positions 13 downto 6 + uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | + (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + + for (int i=0; i>(sps-1-i))&1) { + pdcch.StartSymbolIndex=i; + break; } - n_rb*=6; + } - uint16_t N_reg = n_rb * coreset->duration; - uint16_t n_CI = 0; + pdcch.DurationSymbols = coreset->duration; - const uint16_t N_cce = N_reg / NR_NB_REG_PER_CCE; - const uint16_t M_s_max = nr_of_candidates; + //cce-REG-MappingType + pdcch.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved? + NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED; - LOG_D(PHY,"allocate_NR_CCes : bwp_id %d, coreset_id %d : N_cce %d, m %d, nr_of_candidates %d, Y %d\n", - (int)(bwp ? bwp->bwp_Id : 0),coreset_id,N_cce,m,nr_of_candidates, Y); - //PDCCH candidate index m in CORESET exceeds the maximum number of PDCCH candidates - if(m >= nr_of_candidates) - return -1; + if (pdcch.CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { + pdcch.RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == + NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize); + pdcch.InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize == + NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize); + AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n"); + pdcch.ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId; + } + else { + pdcch.RegBundleSize = 6; + pdcch.InterleaverSize = 0; + pdcch.ShiftIndex = 0; + } - int first_cce = aggregation * (( Y + CEILIDIV((m*N_cce),(aggregation*M_s_max)) + n_CI ) % CEILIDIV(N_cce,aggregation)); - - for (int i=0;ifrequencyDomainResources.buf[i]>>t)&1); + } + } + pdcch.n_rb = N_rb*=6; // each bit of frequencyDomainResources represents 6 PRBs + return pdcch; } + +int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs) { + + int f; // interleaving function + if(R==0) + f = k; + else { + int c = k/R; + int r = k%R; + f = (r*C + c + n_shift)%(N_regs/L); + } + return f; +} + +int find_pdcch_candidate(gNB_MAC_INST *mac, + int cc_id, + int aggregation, + int nr_of_candidates, + NR_sched_pdcch_t *pdcch, + NR_ControlResourceSet_t *coreset, + uint16_t Y){ + + uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map; + const int next_cand = mac->pdcch_cand[coreset->controlResourceSetId]; + const int N_ci = 0; + + if(next_cand>=nr_of_candidates) { + LOG_D(NR_MAC,"No more available candidates for this coreset\n"); + return -1; + } + + const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol + const int N_symb = coreset->duration; // nb of coreset symbols + const int N_regs = N_rb*N_symb; // nb of REGs per coreset + const int N_cces = N_regs / NR_NB_REG_PER_CCE; // nb of cces in coreset + const int R = pdcch->InterleaverSize; + const int L = pdcch->RegBundleSize; + const int C = R>0 ? N_regs/(L*R) : 0; + const int B_rb = L/N_symb; // nb of RBs occupied by each REG bundle + + // loop over all the available candidates + // this implements TS 38.211 Sec. 7.3.2.2 + for(int m=next_cand; mShiftIndex, C, L, N_regs); + for(int rb=0; rbBWPStart + f*B_rb + rb]&SL_to_bitmap(pdcch->StartSymbolIndex,N_symb)) { + taken = true; + break; + } + } + } + } + if(!taken){ + mac->pdcch_cand[coreset->controlResourceSetId] = m++; // using candidate m, next available is m+1 + return first_cce; + } + } + return -1; +} + +void fill_pdcch_vrb_map(gNB_MAC_INST *mac, + int CC_id, + NR_sched_pdcch_t *pdcch, + int first_cce, + int aggregation){ + + uint16_t *vrb_map = mac->common_channels[CC_id].vrb_map; + + int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol + int L = pdcch->RegBundleSize; + int R = pdcch->InterleaverSize; + int n_shift = pdcch->ShiftIndex; + int N_symb = pdcch->DurationSymbols; + int N_regs = N_rb*N_symb; // nb of REGs per coreset + int B_rb = L/N_symb; // nb of RBs occupied by each REG bundle + int C = R>0 ? N_regs/(L*R) : 0; + + for (int j=first_cce; jBWPStart + f*B_rb + rb] |= SL_to_bitmap(pdcch->StartSymbolIndex, N_symb); + } + } +} + + bool nr_find_nb_rb(uint16_t Qm, uint16_t R, uint16_t nb_symb_sch, @@ -723,81 +851,32 @@ int nr_get_default_pucch_res(int pucch_ResourceCommon) { return(default_pucch_csset[pucch_ResourceCommon]); } -void nr_configure_pdcch(gNB_MAC_INST *gNB_mac, - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, - NR_SearchSpace_t *ss, + + +void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ControlResourceSet_t *coreset, - NR_ServingCellConfigCommon_t *scc, NR_BWP_t *bwp, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { + NR_sched_pdcch_t *pdcch) { - int sps; - AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId, - "coreset id in SS %ld does not correspond to the one in coreset %ld", - *ss->controlResourceSetId, coreset->controlResourceSetId); - if (bwp) { // This is not for SIB1 - if(coreset->controlResourceSetId == 0){ - pdcch_pdu->BWPSize = gNB_mac->cset0_bwp_size; - pdcch_pdu->BWPStart = gNB_mac->cset0_bwp_start; - } - else { - pdcch_pdu->BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE); - pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->locationAndBandwidth, MAX_BWP_SIZE); - } - pdcch_pdu->SubcarrierSpacing = bwp->subcarrierSpacing; - pdcch_pdu->CyclicPrefix = (bwp->cyclicPrefix==NULL) ? 0 : *bwp->cyclicPrefix; - - //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); - sps = bwp->cyclicPrefix == NULL ? 14 : 12; - } - else { - AssertFatal(type0_PDCCH_CSS_config!=NULL,"type0_PDCCH_CSS_config is null,bwp %p\n",bwp); - pdcch_pdu->BWPSize = type0_PDCCH_CSS_config->num_rbs; - pdcch_pdu->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; - pdcch_pdu->SubcarrierSpacing = type0_PDCCH_CSS_config->scs_pdcch; - pdcch_pdu->CyclicPrefix = 0; - sps = 14; - } - - AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); - AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); - - // for SPS=14 8 MSBs in positions 13 downto 6 - uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | - (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - - for (int i=0; i>(sps-1-i))&1) { - pdcch_pdu->StartSymbolIndex=i; - break; - } - } + pdcch_pdu->BWPSize = pdcch->BWPSize; + pdcch_pdu->BWPStart = pdcch->BWPStart; + pdcch_pdu->SubcarrierSpacing = pdcch->SubcarrierSpacing; + pdcch_pdu->CyclicPrefix = pdcch->CyclicPrefix; + pdcch_pdu->StartSymbolIndex = pdcch->StartSymbolIndex; pdcch_pdu->DurationSymbols = coreset->duration; for (int i=0;i<6;i++) pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i]; - LOG_D(MAC,"Coreset : BWPstart %d, BWPsize %d, SCS %d, freq %x, , duration %d, \n",pdcch_pdu->BWPStart,pdcch_pdu->BWPSize,(int)pdcch_pdu->SubcarrierSpacing,(int)coreset->frequencyDomainResources.buf[0],(int)coreset->duration); + LOG_D(MAC,"Coreset : BWPstart %d, BWPsize %d, SCS %d, freq %x, , duration %d, \n", + pdcch_pdu->BWPStart,pdcch_pdu->BWPSize,(int)pdcch_pdu->SubcarrierSpacing,(int)coreset->frequencyDomainResources.buf[0],(int)coreset->duration); - //cce-REG-MappingType - pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved? - NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED; - - if (pdcch_pdu->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { - pdcch_pdu->RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == - NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize); - pdcch_pdu->InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize == - NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize); - AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n"); - pdcch_pdu->ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId; - } - else { - pdcch_pdu->RegBundleSize = 0; - pdcch_pdu->InterleaverSize = 0; - pdcch_pdu->ShiftIndex = 0; - } + pdcch_pdu->CceRegMappingType = pdcch->CceRegMappingType; + pdcch_pdu->RegBundleSize = pdcch->RegBundleSize; + pdcch_pdu->InterleaverSize = pdcch->InterleaverSize; + pdcch_pdu->ShiftIndex = pdcch->ShiftIndex; if(coreset->controlResourceSetId == 0) { if(bwp == NULL) @@ -1849,19 +1928,18 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP) return -1; } -void set_Y(int Y[3][160], rnti_t rnti) { +uint16_t get_Y(int cid, int slot, rnti_t rnti) { + const int A[3] = {39827, 39829, 39839}; const int D = 65537; + int Y; - Y[0][0] = (A[0] * rnti) % D; - Y[1][0] = (A[1] * rnti) % D; - Y[2][0] = (A[2] * rnti) % D; + Y = (A[cid] * rnti) % D; - for (int s = 1; s < 160; s++) { - Y[0][s] = (A[0] * Y[0][s - 1]) % D; - Y[1][s] = (A[1] * Y[1][s - 1]) % D; - Y[2][s] = (A[2] * Y[2][s - 1]) % D; - } + for (int s = 0; s < slot; s++) + Y = (A[cid] * Y) % D; + + return Y; } int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) { @@ -1945,8 +2023,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG UE_info->CellGroup[UE_id] = CellGroup; add_nr_list(&UE_info->list, UE_id); memset(&UE_info->mac_stats[UE_id], 0, sizeof(NR_mac_stats_t)); - set_Y(UE_info->Y[UE_id], rntiP); - if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) + if (CellGroup && CellGroup->spCellConfig && CellGroup->spCellConfig->spCellConfigDedicated) compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); @@ -1961,6 +2038,11 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG sched_ctrl->pucch_consecutive_dtx_cnt = 0; sched_ctrl->pusch_consecutive_dtx_cnt = 0; sched_ctrl->ul_failure = 0; + + sched_ctrl->sched_srs.frame = -1; + sched_ctrl->sched_srs.slot = -1; + sched_ctrl->sched_srs.srs_scheduled = false; + /* set illegal time domain allocation to force recomputation of all fields */ sched_ctrl->pdsch_semi_static.time_domain_allocation = -1; sched_ctrl->pusch_semi_static.time_domain_allocation = -1; @@ -1971,8 +2053,12 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG if (bwpList) AssertFatal(bwpList->list.count == 1, "downlinkBWP_ToAddModList has %d BWP!\n", bwpList->list.count); + const int bwp_id = servingCellConfig ? *servingCellConfig->firstActiveDownlinkBWP_Id : 0; sched_ctrl->active_bwp = bwpList && bwp_id > 0 ? bwpList->list.array[bwp_id - 1] : NULL; + NR_BWP_t *genericParameters = sched_ctrl->active_bwp ? + &sched_ctrl->active_bwp->bwp_Common->genericParameters: + &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; const int target_ss = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific : NR_SearchSpace__searchSpaceType_PR_common; sched_ctrl->search_space = get_searchspace(scc, sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated : NULL, @@ -1980,6 +2066,12 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG sched_ctrl->coreset = get_coreset(mod_idP, scc, sched_ctrl->active_bwp ? (void*)sched_ctrl->active_bwp->bwp_Dedicated : NULL, sched_ctrl->search_space, target_ss); + sched_ctrl->sched_pdcch = set_pdcch_structure(RC.nrmac[mod_idP], + sched_ctrl->search_space, + sched_ctrl->coreset, + scc, + genericParameters, + NULL); const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL; if (ubwpList) AssertFatal(ubwpList->list.count == 1, "uplinkBWP_ToAddModList has %d BWP!\n", @@ -2279,20 +2371,20 @@ void nr_csirs_scheduling(int Mod_idP, csirs_pdu_rel15->row = 1; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: csirs_pdu_rel15->row = 2; csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) | ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xff0)); for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: csirs_pdu_rel15->row = 4; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x07; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x3f; @@ -2303,18 +2395,18 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__nrofPorts_p2: csirs_pdu_rel15->row = 3; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p4: csirs_pdu_rel15->row = 5; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p8: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 8; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2); } else{ int num_k = 0; @@ -2323,12 +2415,12 @@ void nr_csirs_scheduling(int Mod_idP, if(num_k==4) { csirs_pdu_rel15->row = 6; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); } else { csirs_pdu_rel15->row = 7; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2); } } break; @@ -2336,12 +2428,12 @@ void nr_csirs_scheduling(int Mod_idP, if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 10; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2); } else { csirs_pdu_rel15->row = 9; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (1 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1); } break; case NR_CSI_RS_ResourceMapping__nrofPorts_p16: @@ -2350,24 +2442,24 @@ void nr_csirs_scheduling(int Mod_idP, else csirs_pdu_rel15->row = 11; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p24: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 14; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2) | SL_to_bitmap(csirs_pdu_rel15->symb_l1, 2)); } else{ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 15; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (7 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 3); } else { csirs_pdu_rel15->row = 13; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2) | SL_to_bitmap(csirs_pdu_rel15->symb_l1, 2)); } } break; @@ -2375,18 +2467,18 @@ void nr_csirs_scheduling(int Mod_idP, if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 17; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2) | SL_to_bitmap(csirs_pdu_rel15->symb_l1, 2)); } else{ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 18; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (7 << csirs_pdu_rel15->symb_l0); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 3); } else { csirs_pdu_rel15->row = 16; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) - vrb_map[rb+csirs_pdu_rel15->bwp_start] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + vrb_map[rb+csirs_pdu_rel15->bwp_start] |= (SL_to_bitmap(csirs_pdu_rel15->symb_l0, 2) | SL_to_bitmap(csirs_pdu_rel15->symb_l1, 2)); } } break; @@ -2404,38 +2496,6 @@ void nr_csirs_scheduling(int Mod_idP, } } -bool find_free_CCE(module_id_t module_id, - sub_frame_t slot, - int UE_id){ - NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id]; - uint8_t nr_of_candidates; - for (int i=0; i<5; i++) { - // for now taking the lowest value among the available aggregation levels - find_aggregation_candidates(&sched_ctrl->aggregation_level, - &nr_of_candidates, - sched_ctrl->search_space, - 1<0) break; - } - AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); - const int cid = sched_ctrl->coreset->controlResourceSetId; - const uint16_t Y = RC.nrmac[module_id]->UE_info.Y[UE_id][cid][slot]; - const int m = RC.nrmac[module_id]->UE_info.num_pdcch_cand[UE_id][cid]; - if (UE_id >= 0) LOG_D(NR_MAC,"calling allocate_nr_CCEs with L %d, nr_of_candidates %d, Y %x\n",sched_ctrl->aggregation_level,nr_of_candidates,Y); - sched_ctrl->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], - sched_ctrl->active_bwp, - sched_ctrl->coreset, - sched_ctrl->aggregation_level, - Y, - m, - nr_of_candidates); - if (sched_ctrl->cce_index < 0) - return false; - - RC.nrmac[module_id]->UE_info.num_pdcch_cand[UE_id][cid]++; - return true; -} - /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c new file mode 100644 index 0000000000..a2b27357dd --- /dev/null +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c @@ -0,0 +1,186 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file gNB_scheduler_srs.c + * \brief MAC procedures related to SRS + * \date 2021 + * \version 1.0 + */ + +#include +#include "NR_MAC_gNB/nr_mac_gNB.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" +#include "NR_MAC_gNB/mac_proto.h" +#include "common/ran_context.h" +#include "nfapi/oai_integration/vendor_ext.h" + +extern RAN_CONTEXT_t RC; + +void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id, int UE_id, NR_SRS_Resource_t *srs_resource) { + + gNB_MAC_INST *nrmac = RC.nrmac[module_id]; + NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; + NR_UE_info_t *UE_info = &nrmac->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + NR_BWP_t ubwp = sched_ctrl->active_ubwp ? + sched_ctrl->active_ubwp->bwp_Common->genericParameters : + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + + srs_pdu->rnti = UE_info->rnti[UE_id]; + srs_pdu->handle = 0; + srs_pdu->bwp_size = NRRIV2BW(ubwp.locationAndBandwidth, MAX_BWP_SIZE);; + srs_pdu->bwp_start = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth, MAX_BWP_SIZE);; + srs_pdu->subcarrier_spacing = ubwp.subcarrierSpacing; + srs_pdu->cyclic_prefix = 0; + srs_pdu->num_ant_ports = srs_resource->nrofSRS_Ports; + srs_pdu->num_symbols = srs_resource->resourceMapping.nrofSymbols; + srs_pdu->num_repetitions = srs_resource->resourceMapping.repetitionFactor; + srs_pdu->time_start_position = srs_resource->resourceMapping.startPosition; + srs_pdu->config_index = srs_resource->freqHopping.c_SRS; + srs_pdu->sequence_id = srs_resource->sequenceId; + srs_pdu->bandwidth_index = srs_resource->freqHopping.b_SRS; + srs_pdu->comb_size = srs_resource->transmissionComb.present - 1; + + switch(srs_resource->transmissionComb.present) { + case NR_SRS_Resource__transmissionComb_PR_n2: + srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n2->combOffset_n2; + srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n2->cyclicShift_n2; + break; + case NR_SRS_Resource__transmissionComb_PR_n4: + srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n4->combOffset_n4; + srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n4->cyclicShift_n4; + break; + default: + LOG_W(NR_MAC, "Invalid or not implemented comb_size!\n"); + } + + srs_pdu->frequency_position = srs_resource->freqDomainPosition; + srs_pdu->frequency_shift = srs_resource->freqDomainShift; + srs_pdu->frequency_hopping = srs_resource->freqHopping.b_hop; + srs_pdu->group_or_sequence_hopping = srs_resource->groupOrSequenceHopping; + srs_pdu->resource_type = srs_resource->resourceType.present - 1; + srs_pdu->t_srs = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; + srs_pdu->t_offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); +} + +void nr_fill_nfapi_srs(int module_id, int CC_id, int UE_id, sub_frame_t slot, NR_SRS_Resource_t *srs_resource) { + + nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][slot]; + + future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE; + future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_srs_pdu_t); + nfapi_nr_srs_pdu_t *srs_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].srs_pdu; + memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t)); + future_ul_tti_req->n_pdus += 1; + + nr_configure_srs(srs_pdu, module_id, CC_id, UE_id, srs_resource); +} + +/******************************************************************* +* +* NAME : nr_schedule_srs +* +* PARAMETERS : module id +* frame number for possible SRS reception +* +* DESCRIPTION : It informs the PHY layer that has an SRS to receive. +* Only for periodic scheduling yet. +* +*********************************************************************/ +void nr_schedule_srs(int module_id, frame_t frame) { + + gNB_MAC_INST *nrmac = RC.nrmac[module_id]; + NR_UE_info_t *UE_info = &nrmac->UE_info; + const NR_list_t *UE_list = &UE_info->list; + + for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { + + const int CC_id = 0; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; + NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + sched_ctrl->sched_srs.frame = -1; + sched_ctrl->sched_srs.slot = -1; + sched_ctrl->sched_srs.srs_scheduled = false; + + if(!UE_info->Msg4_ACKed[UE_id]) { + continue; + } + + NR_SRS_Config_t *srs_config = NULL; + if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { + srs_config = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->srs_Config->choice.setup; + } else { + continue; + } + + for(int rs = 0; rs < srs_config->srs_ResourceSetToAddModList->list.count; rs++) { + + // Find periodic resource set + NR_SRS_ResourceSet_t *srs_resource_set = srs_config->srs_ResourceSetToAddModList->list.array[rs]; + if (srs_resource_set->resourceType.present != NR_SRS_ResourceSet__resourceType_PR_periodic) { + continue; + } + + // Find the corresponding srs resource + NR_SRS_Resource_t *srs_resource = NULL; + for (int r1 = 0; r1 < srs_resource_set->srs_ResourceIdList->list.count; r1++) { + for (int r2 = 0; r2 < srs_config->srs_ResourceToAddModList->list.count; r2++) { + if ((*srs_resource_set->srs_ResourceIdList->list.array[r1] == + srs_config->srs_ResourceToAddModList->list.array[r2]->srs_ResourceId) && + (srs_config->srs_ResourceToAddModList->list.array[r2]->resourceType.present == + NR_SRS_Resource__resourceType_PR_periodic)) { + srs_resource = srs_config->srs_ResourceToAddModList->list.array[r2]; + break; + } + } + } + + if (srs_resource == NULL) { + continue; + } + + NR_BWP_t ubwp = sched_ctrl->active_ubwp ? + sched_ctrl->active_ubwp->bwp_Common->genericParameters : + scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + + uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; + uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); + + int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing]; + + // Check if UE will transmit the SRS in this frame + if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) { + LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame); + nr_fill_nfapi_srs(module_id, CC_id, UE_id, offset%n_slots_frame, srs_resource); + sched_ctrl->sched_srs.frame = frame; + sched_ctrl->sched_srs.slot = offset%n_slots_frame; + sched_ctrl->sched_srs.srs_scheduled = true; + } + } + } +} \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index ca641ed1ba..15c0c23feb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -141,7 +141,6 @@ void nr_schedule_pucch(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue; const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch); for (int i = 0; i < n; i++) { NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i]; @@ -1117,7 +1116,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, // tpc (power control) only if we received AckNack or positive SR. For a // negative SR, the UE won't have sent anything, and the SNR is not valid - if (((uci_01->pduBitmap >> 1) & 0x1) || sched_ctrl->SR) { + if (((uci_01->pduBitmap >> 1) & 0x1) ) { if ((uci_01->harq) && (uci_01->harq->harq_confidence_level==0)) sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30); else sched_ctrl->tpc1 = 3; sched_ctrl->pucch_snrx10 = uci_01->ul_cqi * 5 - 640; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index bde6c6109d..0a18731c0a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -711,7 +711,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_info->mac_stats[UE_id].ulsch_DTX++; } if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { - LOG_D(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n"); + LOG_W(NR_MAC,"Detected UL Failure on PUSCH after %d PUSCH DTX, stopping scheduling\n", + UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; nr_mac_gNB_rrc_ul_failure(gnb_mod_idP,CC_idP,frameP,slotP,rntiP); } @@ -910,13 +911,22 @@ bool nr_UE_is_to_be_scheduled(module_id_t mod_id, int CC_id, int UE_id, frame_t const NR_UE_sched_ctrl_t *sched_ctrl = &nrmac->UE_info.UE_sched_ctrl[UE_id]; const int last_ul_sched = sched_ctrl->last_ul_frame * n + sched_ctrl->last_ul_slot; + const NR_TDD_UL_DL_Pattern_t *tdd = + scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; + int num_slots_per_period; + int tdd_period_len[8] = {500,625,1000,1250,2000,2500,5000,10000}; + if (tdd) + num_slots_per_period = n*tdd_period_len[tdd->dl_UL_TransmissionPeriodicity]/10000; + else + num_slots_per_period = n; + const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); /* UE is to be scheduled if * (1) we think the UE has more bytes awaiting than what we scheduled * (2) there is a scheduling request * (3) or we did not schedule it in more than 10 frames */ const bool has_data = sched_ctrl->estimated_ul_buffer > sched_ctrl->sched_ul_bytes; - const bool high_inactivity = diff >= nrmac->ulsch_max_frame_inactivity * n; + const bool high_inactivity = diff >= (nrmac->ulsch_max_frame_inactivity>0 ? (nrmac->ulsch_max_frame_inactivity * n) : num_slots_per_period); LOG_D(NR_MAC, "%4d.%2d UL inactivity %d slots has_data %d SR %d\n", frame, @@ -1010,13 +1020,38 @@ bool allocate_ul_retransmission(module_id_t module_id, sched_ctrl->pusch_semi_static = temp_ps; } - /* Find free CCE */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { + /* Find a free CCE */ + const int cid = sched_ctrl->coreset->controlResourceSetId; + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + uint8_t nr_of_candidates; + for (int i=0; i<5; i++) { + // for now taking the lowest value among the available aggregation levels + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space, + 1<0) break; + } + int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], + CC_id, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + + if (CCEIndex<0) { LOG_D(NR_MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); return false; } + sched_ctrl->cce_index = CCEIndex; + fill_pdcch_vrb_map(RC.nrmac[module_id], + CC_id, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + /* frame/slot in sched_pusch has been set previously. In the following, we * overwrite the information in the retransmission information before storing * as the new scheduling instruction */ @@ -1131,8 +1166,27 @@ void pf_ul(module_id_t module_id, * based on data to transmit) */ if (B == 0 && do_sched) { /* if no data, pre-allocate 5RB */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { + /* Find a free CCE */ + const int cid = sched_ctrl->coreset->controlResourceSetId; + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + uint8_t nr_of_candidates; + for (int i=0; i<5; i++) { + // for now taking the lowest value among the available aggregation levels + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space, + 1<0) break; + } + int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], + CC_id, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + + if (CCEIndex<0) { LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]); continue; } @@ -1149,6 +1203,13 @@ void pf_ul(module_id_t module_id, 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 @@ -1214,8 +1275,27 @@ void pf_ul(module_id_t module_id, *max = UE_sched.next[*max]; *p = -1; - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + const int cid = sched_ctrl->coreset->controlResourceSetId; + const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]); + uint8_t nr_of_candidates; + for (int i=0; i<5; i++) { + // for now taking the lowest value among the available aggregation levels + find_aggregation_candidates(&sched_ctrl->aggregation_level, + &nr_of_candidates, + sched_ctrl->search_space, + 1<0) break; + } + int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id], + CC_id, + sched_ctrl->aggregation_level, + nr_of_candidates, + &sched_ctrl->sched_pdcch, + sched_ctrl->coreset, + Y); + if (CCEIndex<0) { LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); continue; } @@ -1226,7 +1306,6 @@ void pf_ul(module_id_t module_id, if (max_num_ue < 0) return; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; @@ -1279,6 +1358,14 @@ void pf_ul(module_id_t module_id, rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS); /* Mark the corresponding RBs as used */ + + sched_ctrl->cce_index = CCEIndex; + fill_pdcch_vrb_map(RC.nrmac[module_id], + CC_id, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + 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; @@ -1321,6 +1408,15 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t if (sched_ctrl->active_ubwp==NULL && is_mixed_slot) return false; + // Avoid slots with the SRS + const NR_list_t *UE_list = &UE_info->list; + for (int UE_idx = UE_list->head; UE_idx >= 0; UE_idx = UE_list->next[UE_idx]) { + NR_sched_srs_t sched_srs = UE_info->UE_sched_ctrl[UE_idx].sched_srs; + if(sched_srs.srs_scheduled && sched_srs.frame==sched_frame && sched_srs.slot==sched_slot) { + return false; + } + } + sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { @@ -1438,7 +1534,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) /* a PDCCH PDU groups DCIs per BWP and CORESET. Save a pointer to each * allocated PDCCH so we can easily allocate UE's DCIs independent of any * CORESET order */ - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_bwp_coreset[MAX_NUM_BWP][MAX_NUM_CORESET] = {{0}}; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_coreset[MAX_NUM_CORESET] = {0}; + NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; @@ -1561,7 +1658,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); future_ul_tti_req->n_pdus += 1; - LOG_D(NR_MAC, "%4d.%2d Scheduling UE specific PUSCH for sched %d.%d, ul_tto_req %d.%d\n", frame, slot, + LOG_D(NR_MAC, "%4d.%2d Scheduling UE specific PUSCH for sched %d.%d, ul_tti_req %d.%d\n", frame, slot, sched_pusch->frame,sched_pusch->slot,future_ul_tti_req->SFN,future_ul_tti_req->Slot); pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; @@ -1677,7 +1774,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) NR_SearchSpace_t *ss = (sched_ctrl->active_bwp || ubwpd) ? sched_ctrl->search_space: RC.nrmac[module_id]->sched_ctrlCommon->search_space; NR_ControlResourceSet_t *coreset = (sched_ctrl->active_bwp || ubwpd) ? sched_ctrl->coreset: RC.nrmac[module_id]->sched_ctrlCommon->coreset; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = pdcch_pdu_bwp_coreset[bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = pdcch_pdu_coreset[coresetid]; if (!pdcch_pdu) { nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &ul_dci_req->ul_dci_pdu_list[ul_dci_req->numPdus]; memset(ul_dci_request_pdu, 0, sizeof(nfapi_nr_ul_dci_request_pdus_t)); @@ -1685,8 +1782,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); pdcch_pdu = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; ul_dci_req->numPdus += 1; - nr_configure_pdcch(nr_mac, pdcch_pdu, ss, coreset, scc, genericParameters, NULL); - pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu; + nr_configure_pdcch(pdcch_pdu, coreset, genericParameters, &sched_ctrl->sched_pdcch); + pdcch_pdu_coreset[coresetid] = pdcch_pdu; } LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d at CCE %d, rnti %x\n", frame,slot,sched_ctrl->cce_index,rnti); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 91221276b0..9afd2a4083 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -190,6 +190,8 @@ void nr_schedule_pucch(int Mod_idP, frame_t frameP, sub_frame_t slotP); +void nr_schedule_srs(int module_id, frame_t frame); + void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, @@ -248,13 +250,31 @@ void find_search_space(int ss_type, NR_BWP_Downlink_t *bwp, NR_SearchSpace_t *ss); -void nr_configure_pdcch(gNB_MAC_INST *gNB_mac, - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, - NR_SearchSpace_t *ss, +void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ControlResourceSet_t *coreset, - NR_ServingCellConfigCommon_t *scc, NR_BWP_t *bwp, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config); + NR_sched_pdcch_t *pdcch); + +NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, + NR_SearchSpace_t *ss, + NR_ControlResourceSet_t *coreset, + NR_ServingCellConfigCommon_t *scc, + NR_BWP_t *bwp, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config); + +int find_pdcch_candidate(gNB_MAC_INST *mac, + int cc_id, + int aggregation, + int nr_of_candidates, + NR_sched_pdcch_t *pdcch, + NR_ControlResourceSet_t *coreset, + uint16_t Y); + +void fill_pdcch_vrb_map(gNB_MAC_INST *mac, + int CC_id, + NR_sched_pdcch_t *pdcch, + int first_cce, + int aggregation); void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, const NR_CellGroupConfig_t *CellGroup, @@ -300,6 +320,8 @@ void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, uint8_t num_dmrs_cdm_grps_no_data, NR_pusch_semi_static_t *ps); +uint16_t get_Y(int cid, int slot, rnti_t rnti); + uint8_t nr_get_tpc(int target, uint8_t cqi, int incr); int get_spf(nfapi_nr_config_request_scf_t *cfg); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 5e5de9a8e1..b9da84ead2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -128,7 +128,10 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp } } } - print_meas_log(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL, output+stroff); + print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); + print_meas(&gNB->schedule_dlsch,"dlsch scheduler",NULL,NULL); + print_meas(&gNB->rlc_data_req, "rlc_data_req",NULL,NULL); + print_meas(&gNB->rlc_status_ind,"rlc_status_ind",NULL,NULL); } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 45e0a5b52b..5b3fb91eb7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -73,7 +73,7 @@ /* Defs */ #define MAX_NUM_BWP 2 -#define MAX_NUM_CORESET 2 +#define MAX_NUM_CORESET 12 #define MAX_NUM_CCE 90 #define MAX_HARQ_ROUNDS 4 /*!\brief Maximum number of random access process */ @@ -103,6 +103,20 @@ typedef struct NR_preamble_ue { uint8_t *preamble_list; } NR_preamble_ue_t; +typedef struct NR_sched_pdcch { + uint16_t BWPSize; + uint16_t BWPStart; + uint8_t CyclicPrefix; + uint8_t SubcarrierSpacing; + uint8_t StartSymbolIndex; + uint8_t CceRegMappingType; + uint8_t RegBundleSize; + uint8_t InterleaverSize; + uint16_t ShiftIndex; + uint8_t DurationSymbols; + int n_rb; +} NR_sched_pdcch_t; + /*! \brief gNB template for the Random access information */ typedef struct { /// Flag to indicate this process is active @@ -165,6 +179,9 @@ typedef struct { int mac_pdu_length; /// RA search space NR_SearchSpace_t *ra_ss; + /// RA Coreset + NR_ControlResourceSet_t *coreset; + NR_sched_pdcch_t sched_pdcch; // Beam index uint8_t beam_id; /// CellGroup for UE that is to come (NSA is non-null, null for SA) @@ -300,7 +317,6 @@ typedef struct UE_info { pdschTciStatesActDeact_t pdsch_TCI_States_ActDeact; } NR_UE_mac_ce_ctrl_t; - typedef struct NR_sched_pucch { int frame; int ul_slot; @@ -362,6 +378,12 @@ typedef struct NR_sched_pusch { int time_domain_allocation; } NR_sched_pusch_t; +typedef struct NR_sched_srs { + int frame; + int slot; + bool srs_scheduled; +} NR_sched_srs_t; + /* PDSCH semi-static configuratio: as long as the TDA/DMRS/mcsTable remains the * same, there is no need to recalculate all S/L or DMRS-related parameters * over and over again. Hence, we store them in this struct for easy @@ -535,6 +557,7 @@ typedef struct { /// CCE index and aggregation, should be coherent with cce_list NR_SearchSpace_t *search_space; NR_ControlResourceSet_t *coreset; + NR_sched_pdcch_t sched_pdcch; /// CCE index and Aggr. Level are shared for PUSCH/PDSCH allocation decisions /// corresponding to the sched_pusch/sched_pdsch structures below @@ -548,9 +571,12 @@ typedef struct { /// PUSCH semi-static configuration: is not cleared across TTIs NR_pusch_semi_static_t pusch_semi_static; - /// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI + /// Sched PUSCH: scheduling decisions, copied into HARQ and cleared every TTI NR_sched_pusch_t sched_pusch; + /// Sched SRS: scheduling decisions + NR_sched_srs_t sched_srs; + /// uplink bytes that are currently scheduled int sched_ul_bytes; /// estimation of the UL buffer size @@ -652,12 +678,11 @@ typedef struct { rnti_t rnti[MAX_MOBILES_PER_GNB]; NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB]; /// CCE indexing - int Y[MAX_MOBILES_PER_GNB][3][160]; int m[MAX_MOBILES_PER_GNB]; - int num_pdcch_cand[MAX_MOBILES_PER_GNB][MAX_NUM_CORESET]; // UE selected beam index uint8_t UE_beam_index[MAX_MOBILES_PER_GNB]; bool Msg4_ACKed[MAX_MOBILES_PER_GNB]; + } NR_UE_info_t; typedef void (*nr_pp_impl_dl)(module_id_t mod_id, @@ -705,7 +730,7 @@ typedef struct gNB_MAC_INST_s { /// a PDCCH PDU groups DCIs per BWP and CORESET. The following structure /// keeps pointers to PDCCH PDUs within DL_req so that we can easily track /// PDCCH PDUs per CC/BWP/CORESET - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_idx[NFAPI_CC_MAX][MAX_NUM_BWP][MAX_NUM_CORESET]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_idx[NFAPI_CC_MAX][MAX_NUM_CORESET]; /// NFAPI UL TTI Request Structure, simple pointer into structure /// UL_tti_req_ahead for current frame/slot nfapi_nr_ul_tti_request_t *UL_tti_req[NFAPI_CC_MAX]; @@ -716,7 +741,7 @@ typedef struct gNB_MAC_INST_s { nfapi_nr_ul_dci_request_t UL_dci_req[NFAPI_CC_MAX]; /// NFAPI DL PDU structure nfapi_nr_tx_data_request_t TX_req[NFAPI_CC_MAX]; - + int pdcch_cand[MAX_NUM_CORESET]; NR_UE_info_t UE_info; /// UL handle @@ -738,14 +763,16 @@ typedef struct gNB_MAC_INST_s { time_stats_t schedule_dlsch_preprocessor; /// processing time of eNB DLSCH scheduler time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor + /// processing time of rlc_data_req + time_stats_t rlc_data_req; + /// processing time of rlc_status_ind + time_stats_t rlc_status_ind; /// processing time of eNB MCH scheduler time_stats_t schedule_mch; /// processing time of eNB ULSCH reception time_stats_t rx_ulsch_sdu; // include rlc_data_ind /// processing time of eNB PCH scheduler time_stats_t schedule_pch; - /// CCE lists - int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; /// list of allocated beams per period int16_t *tdd_beam_association; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index d4f4bff745..57bb411dcc 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -490,13 +490,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { dump_dl(sched_info); #endif - if (ifi->NR_Schedule_response) { - AssertFatal(ifi->NR_Schedule_response!=NULL, - "nr_schedule_response is null (mod %d, cc %d)\n", - module_id, - CC_id); - ifi->NR_Schedule_response(sched_info); - } + AssertFatal(ifi->NR_Schedule_response!=NULL, + "nr_schedule_response is null (mod %d, cc %d)\n", + module_id, + CC_id); + ifi->NR_Schedule_response(sched_info); LOG_D(NR_PHY,"NR_Schedule_response: SFN SLOT:%d %d dl_pdus:%d\n", sched_info->frame, diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index eb402092b9..cf7dcf1b64 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -325,7 +325,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon; memset(&cellGroupConfig,0,sizeof(cellGroupConfig)); - fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier); + fill_initial_cellGroupConfig(rntiP,-1,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier); MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP); f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp); @@ -346,14 +346,14 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, memcpy(msg->rrc_container, sduP, sdu_lenP); msg->rrc_container_length=sdu_lenP; itti_send_msg_to_task(TASK_DU_F1, 0, tmp); - + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); ue_context_p->ue_id_rnti = rntiP; ue_context_p->ue_context.rnti = rntiP; ue_context_p->ue_context.random_ue_identity = rntiP; ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); - + return(0); } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 84a0cf75d1..bbc05da506 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -39,6 +39,7 @@ #include #include /* for _ASN_DEFAULT_STACK_MAX */ #include +#include #include "asn1_msg.h" #include "../nr_rrc_proto.h" @@ -976,10 +977,42 @@ uint8_t do_RRCReject(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } +// TODO: Implement to b_SRS = 1 and b_SRS = 2 +long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) { + + if(b_SRS>0) { + LOG_E(NR_RRC,"rrc_get_max_nr_csrs(): Not implemented yet for b_SRS>0\n"); + return 0; // This c_srs is always valid + } + + const uint16_t m_SRS[64] = { 4, 8, 12, 16, 16, 20, 24, 24, 28, 32, 36, 40, 48, 48, 52, 56, 60, 64, 72, 72, 76, 80, 88, + 96, 96, 104, 112, 120, 120, 120, 128, 128, 128, 132, 136, 144, 144, 144, 144, 152, 160, + 160, 160, 168, 176, 184, 192, 192, 192, 192, 208, 216, 224, 240, 240, 240, 240, 256, 256, + 256, 264, 272, 272, 272 }; + + long c_srs = 0; + uint16_t m = 4; + for(int c = 1; c<64; c++) { + if(m_SRS[c]>m && m_SRS[c]=0 && uid<30, "gNB cannot allocate the SRS resources\n"); + int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); SpCellConfig->servCellIndex = NULL; SpCellConfig->reconfigurationWithSync = NULL; @@ -1058,7 +1091,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList)); NR_PUSCH_PathlossReferenceRS_t *plrefRS = calloc(1,sizeof(*plrefRS)); plrefRS->pusch_PathlossReferenceRS_Id=0; - plrefRS->referenceSignal.present = NR_PathlossReferenceRS_Config_PR_ssb_Index; + plrefRS->referenceSignal.present = NR_PUSCH_PathlossReferenceRS__referenceSignal_PR_ssb_Index; plrefRS->referenceSignal.choice.ssb_Index = 0; ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,plrefRS); pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; @@ -1105,13 +1138,21 @@ void fill_initial_SpCellConfig(rnti_t rnti, *srs_resset0_id=0; ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); srs_Config->srs_ResourceToReleaseList=NULL; - srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; - srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); - srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; - srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; - srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); - *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; - srs_resset0->resourceType.choice.aperiodic->ext1=NULL; + + if(carrier->do_SRS) { + srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic; + srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic)); + srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL; + } else { + srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; + srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); + srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; + srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; + srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); + *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; + srs_resset0->resourceType.choice.aperiodic->ext1=NULL; + } + srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook; srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha)); *srs_resset0->alpha = NR_Alpha_alpha1; @@ -1130,17 +1171,28 @@ void fill_initial_SpCellConfig(rnti_t rnti, srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2)); srs_res0->transmissionComb.choice.n2->combOffset_n2=0; srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0; - srs_res0->resourceMapping.startPosition=2; + srs_res0->resourceMapping.startPosition = 2 + uid%2; srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1; srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1; srs_res0->freqDomainPosition=0; srs_res0->freqDomainShift=0; - srs_res0->freqHopping.c_SRS = 0; srs_res0->freqHopping.b_SRS=0; srs_res0->freqHopping.b_hop=0; + srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs( + NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275), + srs_res0->freqHopping.b_SRS); srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; - srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; - srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); + + if(carrier->do_SRS) { + srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic; + srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic)); + srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160; + srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots + } else { + srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; + srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); + } + srs_res0->sequenceId=40; srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo)); srs_res0->spatialRelationInfo->servingCellId=NULL; @@ -1397,6 +1449,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr } void fill_initial_cellGroupConfig(rnti_t rnti, + int uid, NR_CellGroupConfig_t *cellGroupConfig, NR_ServingCellConfigCommon_t *scc, rrc_gNB_carrier_data_t *carrier) { @@ -1490,7 +1543,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti, cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig)); - fill_initial_SpCellConfig(rnti,cellGroupConfig->spCellConfig,scc,carrier); + fill_initial_SpCellConfig(rnti,uid,cellGroupConfig->spCellConfig,scc,carrier); cellGroupConfig->sCellToAddModList = NULL; cellGroupConfig->sCellToReleaseList = NULL; @@ -1569,7 +1622,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, } else { cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc,carrier); + fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,ue_context_pP->local_uid,cellGroupConfig,scc,carrier); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 6803cf21d7..ca92652c6c 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -101,13 +101,15 @@ uint8_t do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); void fill_initial_SpCellConfig(rnti_t rnti, - NR_SpCellConfig_t *SpCellConfig, - NR_ServingCellConfigCommon_t *scc, + int uid, + NR_SpCellConfig_t *SpCellConfig, + NR_ServingCellConfigCommon_t *scc, rrc_gNB_carrier_data_t *carrier); void fill_initial_cellGroupConfig(rnti_t rnti, - NR_CellGroupConfig_t *cellGroupConfig, - NR_ServingCellConfigCommon_t *scc, + int uid, + NR_CellGroupConfig_t *cellGroupConfig, + NR_ServingCellConfigCommon_t *scc, rrc_gNB_carrier_data_t *carrier); void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index a92cf9861c..667b5ed24a 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -451,6 +451,7 @@ typedef struct { int pusch_AntennaPorts; int minRXTXTIME; int do_CSIRS; + int do_SRS; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 22109c3029..40de13dfb0 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -81,6 +81,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int dl_antenna_ports, int minRXTXTIMEpdsch, int do_csirs, + int do_srs, int initial_csi_index, int uid); @@ -93,6 +94,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon int dl_antenna_ports, int minRXTXTIMEpdsch, int do_csirs, + int do_srs, int initial_csi_index, int uid); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2c2020412d..dda128f52f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -239,6 +239,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.minRXTXTIME = configuration->minRXTXTIME; rrc->carrier.sib1_tda = configuration->sib1_tda; rrc->carrier.do_CSIRS = configuration->do_CSIRS; + rrc->carrier.do_SRS = configuration->do_SRS; nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME); /// System Information INIT pthread_mutex_init(&rrc->cell_info_mutex,NULL); @@ -617,7 +618,7 @@ rrc_gNB_process_RRCSetupComplete( ) //----------------------------------------------------------------------------- { - LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n", + LOG_A(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); ue_context_pP->ue_context.Srb1.Active = 1; ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1; @@ -709,7 +710,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( DRB_config->pdcp_Config->moreThanOneRLC = NULL; DRB_config->pdcp_Config->t_Reordering = calloc(1, sizeof(*DRB_config->pdcp_Config->t_Reordering)); - *DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0; + *DRB_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms100; DRB_config->pdcp_Config->ext1 = NULL; ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); @@ -1347,7 +1348,7 @@ rrc_gNB_process_RRCReconfigurationComplete( for (int i = 0; i < DRB_configList->list.count; i++) { if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n", + LOG_A(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 15caff0b4d..536010bbc6 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -263,24 +263,26 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ } if (ue_context_p->ue_context.spCellConfig) { fill_default_reconfig(carrier->servingcellconfigcommon, - ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, - reconfig_ies, - ue_context_p->ue_context.secondaryCellGroup, - carrier->pdsch_AntennaPorts, - carrier->minRXTXTIME, - carrier->do_CSIRS, - carrier->initial_csi_index[ue_context_p->local_uid + 1], - ue_context_p->local_uid); + ue_context_p->ue_context.spCellConfig->spCellConfigDedicated, + reconfig_ies, + ue_context_p->ue_context.secondaryCellGroup, + carrier->pdsch_AntennaPorts, + carrier->minRXTXTIME, + carrier->do_CSIRS, + carrier->do_SRS, + carrier->initial_csi_index[ue_context_p->local_uid + 1], + ue_context_p->local_uid); } else { fill_default_reconfig(carrier->servingcellconfigcommon, - NULL, - reconfig_ies, - ue_context_p->ue_context.secondaryCellGroup, - carrier->pdsch_AntennaPorts, - carrier->minRXTXTIME, - carrier->do_CSIRS, - carrier->initial_csi_index[ue_context_p->local_uid + 1], - ue_context_p->local_uid); + NULL, + reconfig_ies, + ue_context_p->ue_context.secondaryCellGroup, + carrier->pdsch_AntennaPorts, + carrier->minRXTXTIME, + carrier->do_CSIRS, + carrier->do_SRS, + carrier->initial_csi_index[ue_context_p->local_uid + 1], + ue_context_p->local_uid); } ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 30604cd015..db4dc2d579 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -57,11 +57,17 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int dl_antenna_ports, int minRXTXTIME, int do_csirs, + int do_srs, int initial_csi_index, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); + // This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4. + // However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources, + // where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations. + AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n"); + uint64_t bitmap=0; switch (servingcellconfigcommon->ssb_PositionsInBurst->present) { case 1 : @@ -797,13 +803,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *srs_resset0_id=0; ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id); srs_Config->srs_ResourceToReleaseList=NULL; - srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; - srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); - srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; - srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; - srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); - *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; - srs_resset0->resourceType.choice.aperiodic->ext1=NULL; + + if(do_srs) { + srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic; + srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic)); + srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL; + } else { + srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic; + srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic)); + srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1; + srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL; + srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset)); + *srs_resset0->resourceType.choice.aperiodic->slotOffset=2; + srs_resset0->resourceType.choice.aperiodic->ext1=NULL; + } + srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook; srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha)); *srs_resset0->alpha = NR_Alpha_alpha1; @@ -822,17 +836,28 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2)); srs_res0->transmissionComb.choice.n2->combOffset_n2=0; srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0; - srs_res0->resourceMapping.startPosition=2; + srs_res0->resourceMapping.startPosition = 2 + uid%2; srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1; srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1; srs_res0->freqDomainPosition=0; srs_res0->freqDomainShift=0; - srs_res0->freqHopping.c_SRS = 0; srs_res0->freqHopping.b_SRS=0; srs_res0->freqHopping.b_hop=0; + srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs( + NRRIV2BW(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275), + srs_res0->freqHopping.b_SRS); srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither; - srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; - srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); + + if(do_srs) { + srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic; + srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic)); + srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160; + srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots + } else { + srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic; + srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic)); + } + srs_res0->sequenceId=40; srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo)); srs_res0->spatialRelationInfo->servingCellId=NULL; @@ -1351,6 +1376,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon int dl_antenna_ports, int minRXTXTIME, int do_csirs, + int do_srs, int initial_csi_index, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); @@ -1367,6 +1393,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon dl_antenna_ports, minRXTXTIME, do_csirs, + do_srs, initial_csi_index, uid); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index bc209afd02..f910ff68d4 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2180,7 +2180,8 @@ nr_rrc_ue_establish_srb2( NULL, radioBearerConfig->drb_ToAddModList, NULL, - 0, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm + | (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), NULL, NULL, kUPenc, diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index e64f7724c6..8731eb294a 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -408,7 +408,7 @@ static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType, guint8 isPredefinedData, guint8 retx, guint8 crcStatus, guint8 oob_event, guint8 oob_event_value, uint8_t *pdu_buffer, unsigned int pdu_buffer_size) { - unsigned char frameBuffer[9000]; + unsigned char frameBuffer[12000]; unsigned int frameOffset; ssize_t bytesSent; frameOffset = 0; diff --git a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c index 3a842406f0..2ef36d7595 100644 --- a/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c +++ b/openair3/NAS/COMMON/IES/EpsNetworkFeatureSupport.c @@ -41,8 +41,11 @@ int decode_eps_network_feature_support(EpsNetworkFeatureSupport *epsnetworkfeatu ielen = *(buffer + decoded); decoded++; CHECK_LENGTH_DECODER(len - decoded, ielen); - *epsnetworkfeaturesupport = *buffer & 0x1; - decoded++; + /* note: only the bit "IMS voice over PS session in S1 mode" is processed + * TODO: deal with other bits? + */ + *epsnetworkfeaturesupport = (*(buffer + decoded)) & 0x1; + decoded += ielen; #if defined (NAS_DEBUG) dump_eps_network_feature_support_xml(epsnetworkfeaturesupport, iei); #endif diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 2628c5b0b2..7cf1378d8b 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -674,7 +674,7 @@ void decodeDownlinkNASTransport(as_nas_info_t *initialNasMsg, uint8_t * pdu_buff sprintf(baseNetAddress, "%d.%d", *(pdu_buffer + 39),*(pdu_buffer + 40)); int third_octet = *(pdu_buffer + 41); int fourth_octet = *(pdu_buffer + 42); - LOG_I(NAS, "Received PDU Session Establishment Accept\n"); + LOG_A(NAS, "Received PDU Session Establishment Accept\n"); nas_config(1,third_octet,fourth_octet,"ue"); } else { LOG_E(NAS, "Received unexpected message in DLinformationTransfer %d\n", msg_type); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index c6a4a90a14..575fddda2b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -216,11 +216,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf index fd9399f89e..c3faa198dd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -210,12 +210,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index 59e71a6225..8fa8fcf992 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -196,12 +196,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf index 3fc81c0d6c..c2e364b75e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf @@ -193,12 +193,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index a40a93c789..813a0e58e3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -210,12 +210,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index 3860aba935..d81655e5d5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -194,12 +194,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 7c527e07c8..b063989fd2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -194,12 +194,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf index 4f8c785baa..856eed4fc2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf @@ -209,12 +209,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf index b6b9252560..2e4dc540f3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -242,12 +242,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf index 0817d7373e..a454af7b21 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf @@ -193,12 +193,12 @@ MACRLCs = ( ); L1s = ( - { +{ num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index fd4c23cfdb..af26091260 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -192,12 +192,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 965408332c..928c70113f 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -192,12 +192,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index e36748a3a9..76bc5bf992 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -209,12 +209,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index 7b2d369919..7ff9d0ea77 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -193,12 +193,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf index dbf4f58348..5c0434b57e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -192,12 +192,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf index 6d23726a78..4b1476a76d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -192,12 +192,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf index c3fa56f15e..50169f4bce 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -192,12 +192,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf index 15aa368fdf..e217f39b94 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf @@ -193,12 +193,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf index 06ae5af066..0b384958ae 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf @@ -18,18 +18,18 @@ log_config = { L1s = ( - { - num_cc = 1; - tr_n_preference = "nfapi"; - local_n_if_name = "lo"; - remote_n_address = "127.0.0.2"; // vnf addr - local_n_address = "127.0.0.1"; // pnf addr - local_n_portc = 50000; // pnf p5 port [!] - remote_n_portc = 50001; // vnf p5 port - local_n_portd = 50010; // pnf p7 port - remote_n_portd = 50011; // vnf p7 port - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "nfapi"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.2"; // vnf addr + local_n_address = "127.0.0.1"; // pnf addr + local_n_portc = 50000; // pnf p5 port [!] + remote_n_portc = 50001; // vnf p5 port + local_n_portd = 50010; // pnf p7 port + remote_n_portd = 50011; // vnf p7 port + thread_pool_size = 8; +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index 8dfcfb2b88..5591ed082d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -210,12 +210,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf index d01b0947c0..dd8113e059 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -211,12 +211,12 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf index 2f4839fd3b..96335f23ca 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf @@ -210,11 +210,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 01050b0d00..215a57b95c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -210,11 +210,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 9238ea1809..b77ad0b264 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -35,7 +35,9 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + min_rxtxtime = 6; sib1_tda = 0; + do_SRS = 1; pdcch_ConfigSIB1 = ( { @@ -66,7 +68,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 + initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -86,7 +88,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 12952; + initialULBWPlocationAndBandwidth = 28875; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -210,7 +212,7 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); @@ -218,7 +220,6 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; prach_dtx_threshold = 120; pucch0_dtx_threshold = 150; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 @@ -296,5 +297,7 @@ log_config : rrc_log_verbosity ="medium"; ngap_log_level ="debug"; ngap_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 9717462176..27a1b6ad62 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -35,6 +35,8 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 2; + sib1_tda = 0; + do_SRS = 1; ul_prbblacklist = "51,52,53,54" pdcch_ConfigSIB1 = ( @@ -210,7 +212,7 @@ MACRLCs = ( tr_n_preference = "local_RRC"; #pusch_TargetSNRx10 = 150; #pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); @@ -218,7 +220,6 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 4; prach_dtx_threshold = 120; #pucch0_dtx_threshold = 120; } diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index d9b62064c1..e96c545a4e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -35,7 +35,9 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + min_rxtxtime = 6; sib1_tda = 0; + do_SRS = 1; pdcch_ConfigSIB1 = ( { @@ -210,7 +212,7 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); @@ -218,7 +220,6 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; prach_dtx_threshold = 120; pucch0_dtx_threshold = 150; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 @@ -296,5 +297,7 @@ log_config : rrc_log_verbosity ="medium"; ngap_log_level ="debug"; ngap_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf index e9577ee265..c8a0bace37 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -225,11 +225,11 @@ MACRLCs = ( ); L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - } +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; +} ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf new file mode 100644 index 0000000000..befceae695 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf @@ -0,0 +1,330 @@ +Active_gNBs = ( "gNB-OAI"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "gNB-OAI"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 2; +# do_CSIRS = 1; + min_rxtxtime_pdsch = 2; + ul_prbblacklist = "79,80,81,82" + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 11; + searchSpaceZero = 10; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3300.60 MHz + 81*12*30e-3 MHz = 3329.76 + absoluteFrequencySSB = 621984; + # this is 3300.60 MHz + dl_absoluteFrequencyPointA = 620040; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 162; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=162 (275*(275-L+1))+(274-RBstart)) + initialDLBWPlocationAndBandwidth = 31899; + # +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 11; + initialDLBWPsearchSpaceZero = 10; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_1 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 162; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 31899; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 12; + preambleReceivedTargetPower = -104; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=2 L=13 + initialULBWPstartSymbolAndLength_0 = 41; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=4 + initialULBWPstartSymbolAndLength_1 = 52; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -70; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.70.132"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24"; + GNB_INTERFACE_NAME_FOR_NGU = "demo-oai"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 0; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 120; +} +); + +RUs = ( +{ + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + sf_extension = 0; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + #clock_src = "internal"; + sdr_addrs = "mgmt_addr=192.168.10.2,addr=192.168.10.2,clock_source=internal,time_source=internal" +} +); + +THREAD_STRUCT = ( +{ + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; +} +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + +log_config : +{ + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; +};