diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index f2a84fbd91..57d6b1651e 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -269,6 +269,29 @@ pipeline { } } } + stage ("PhySim-GraceHopper-5G") { + when { expression {do5Gtest || do5GUeTest} } + steps { + script { + triggerSlaveJob ('RAN-PhySim-GraceHopper-5G', 'PhySim-GraceHopper-5G') + } + } + post { + always { + script { + // Using a unique variable name for each test stage to avoid overwriting on a global variable + // due to parallel-time concurrency + physimGH5GStatus = finalizeSlaveJob('RAN-PhySim-GraceHopper-5G') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + failingStages += physimGH5GStatus + } + } + } + } stage ("PhySim-Cluster-4G") { when { expression {do4Gtest} } steps { @@ -661,6 +684,29 @@ pipeline { } } } + stage ("SA-Handover-CN5G") { + when { expression {do5Gtest} } + steps { + script { + triggerSlaveJob ('RAN-SA-Handover-CN5G', 'SA-Handover-CN5G') + } + } + post { + always { + script { + // Using a unique variable name for each test stage to avoid overwriting on a global variable + // due to parallel-time concurrency + saHandoverStatus = finalizeSlaveJob('RAN-SA-Handover-CN5G') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + failingStages += saHandoverStatus + } + } + } + } stage ("SA-OAIUE-CN5G") { when { expression {do5Gtest || do5GUeTest} } steps { diff --git a/ci-scripts/ci_infra.yaml b/ci-scripts/ci_infra.yaml index 7a6999f503..85dbd10180 100644 --- a/ci-scripts/ci_infra.yaml +++ b/ci-scripts/ci_infra.yaml @@ -12,6 +12,14 @@ idefix: IF: wwan0 MTU: 1500 +raspix: + Host: raspix + AttachScript: sudo /opt/mbim_scripts/start_quectel_mbim.sh + DetachScript: sudo /opt/mbim_scripts/stop_quectel_mbim.sh + NetworkScript: ip a show dev wwan0 + IF: wwan0 + MTU: 1500 + up2: Host: up2 AttachScript: sudo /opt/mbim/start_quectel_mbim.sh @@ -77,6 +85,14 @@ oc-cn5g-20897: Undeploy: "! scripts/oc-cn5g-undeploy.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-fhi72" LogCollect: "! scripts/oc-cn5g-logcollect.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-fhi72 %%log_dir%%" +oc-cn5g-00102-ho: + Host: groot + NetworkScript: echo "inet 172.21.6.111" + RunIperf3Server: False + Deploy: "! scripts/oc-cn5g-deploy.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ho" + Undeploy: "! scripts/oc-cn5g-undeploy.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ho" + LogCollect: "! scripts/oc-cn5g-logcollect.sh /opt/oai-cn5g-fed-develop-2025-jan oaicicd-core-for-ho %%log_dir%%" + oc-cn5g-20897-aerial: Host: gracehopper1-oai NetworkScript: echo "inet 172.21.6.105" diff --git a/ci-scripts/cls_analysis.py b/ci-scripts/cls_analysis.py index 236a4743a1..588490da62 100644 --- a/ci-scripts/cls_analysis.py +++ b/ci-scripts/cls_analysis.py @@ -26,65 +26,26 @@ import os import xml.etree.ElementTree as ET import json -# Define the mapping of physim_test values to search patterns -PHYSIM_PATTERN_MAPPING = { - 'nr_ulsim': [ - r'(Total PHY proc rx)\s+(\d+\.\d+)\s+us', # Pattern for RX PHY processing time - r'(ULSCH total decoding time)\s+(\d+\.\d+)\s+us', # Pattern for ULSCH decoding time - ], - 'nr_dlsim': [ - r'(PHY proc tx)\s+(\d+\.\d+)\s+us', # Pattern for TX PHY processing time - r'(DLSCH encoding time)\s+(\d+\.\d+)\s+us', # Pattern for DLSCH encoding time - ], - 'ldpctest': [ - r'(Encoding time mean):\s+(\d+\.\d+)\s+us', # Pattern for encoding time mean - r'(Decoding time mean):\s+(\d+\.\d+)\s+us', # Pattern for decoding time mean - ], -} -# Define test conditions based on the simulation type -PHYSIM_TEST_CONDITION = { - 'nr_ulsim': 'test OK', # For nr_ulsim, check if 'test OK' is present - 'nr_dlsim': 'test OK', # For nr_dlsim, check if 'test OK' is present - 'ldpctest': None, # No condition for ldpctest, just process the patterns -} - class Analysis(): - def analyze_physim(log, physim_test, options, threshold): - search_patterns = PHYSIM_PATTERN_MAPPING.get(physim_test) - test_condition = PHYSIM_TEST_CONDITION.get(physim_test) - success = False - msg = '' + def _get_test_description(properties): + env_vars = None + for p in properties: + if p["name"] == "ENVIRONMENT": + env_vars = p["value"] # save for later if no custom property + if p["name"] == "TEST_DESCRIPTION": + return p["value"] + # if we came till here, it means there is no custom test property + # saved in JSON. See if we have a description in environment variables + if not env_vars: + return "" + for ev in env_vars: + name, value = ev.split("=", 1) + if name == "TEST_DESCRIPTION": + return value + return "" - try: - with open(log, 'r') as f: - log_content = f.read() - except FileNotFoundError as e: - msg = f'{log} file not found, exception: {e}' - return False, msg - except Exception as e: - msg = f'Error while parsing log file {log}: exception: {e}' - return False, msg - - if test_condition and test_condition not in log_content: - msg = f"Test did not succeed, '{test_condition}' not found in log file {log}." - return False, msg - - time1_match = re.search(search_patterns[0], log_content) - time2_match = re.search(search_patterns[1], log_content) - if not(time1_match and time2_match): - msg = f"Processing time not found in log file {log}." - return False, msg - - success = float(time2_match.group(2)) < float(threshold) - if success: - msg = f'{time1_match.group(1)}: {time1_match.group(2)} us\n{time2_match.group(1)}: {time2_match.group(2)} us' - else: - msg = f'{time1_match.group(1)}: {time1_match.group(2)} us\n{time2_match.group(1)}: {time2_match.group(2)} us exceeds a limit of {threshold} us' - - return success,msg - - def analyze_oc_physim(result_junit, details_json, logPath): + def analyze_physim(result_junit, details_json, logPath): try: tree = ET.parse(result_junit) root = tree.getroot() @@ -116,7 +77,7 @@ class Analysis(): for test in root: # for each test test_name = test.attrib["name"] test_exec = json_test_desc[test_name]["properties"][1]["value"][0] - desc = json_test_desc[test_name]["properties"][1]["value"][1] + desc = Analysis._get_test_description(json_test_desc[test_name]["properties"]) # get runtime and checks test_check = test.attrib["status"] == "run" time = round(float(test.attrib["time"]), 1) @@ -129,13 +90,16 @@ class Analysis(): with open(f'{log_dir}/{test_name}.log', 'w') as f: f.write(output) # prepare result and info - info = f"Runtime: {f'{time:.3f}'[:5]} s" resultstr = 'PASS' if (test_check and time_check and output_check) else 'FAIL' + info = f"{test_name}.log: test {resultstr}" + for l in output.splitlines(): + if l.startswith("CHECK "): + info += f"\n{l}" if test_check: if not output_check: - info += " Test log exceeds maximal allowed length 100 kB" + info += "\nTest log exceeds maximal allowed length 100 kB" if not time_check: - info += " Test exceeds 150s" + info += "\nTest exceeds 150s" if not (time_check and output_check): nb_failed += 1 # time threshold/output length error, not counted for by ctest as of now test_result[test_name] = [desc, info, resultstr] diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index ae4e718ecf..4e13cdf7b3 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -34,7 +34,6 @@ import time import os import cls_oai_html -import cls_analysis import constants as CONST import helpreadme as HELP import cls_containerize @@ -417,34 +416,3 @@ class Cluster: c.run(f'cp -r {ctx.logPath} {os.getcwd()}/test_log_{ctx.test_id}/') return status - - def deploy_oc_physim(self, ctx, HTML, oc_release, node): - if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': - HELP.GenericHelp(CONST.Version) - raise ValueError(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {self.ranBranch} ranCommitID {self.ranCommitID}') - image_tag = cls_containerize.CreateTag(self.ranCommitID, self.ranBranch, self.ranAllowMerge) - logging.debug(f'Running physims from server: {node}') - script = "scripts/oc-deploy-physims.sh" - options = f"oaicicd-core-for-ci-ran {oc_release} {image_tag} {self.eNBSourceCodePath}" - ret = cls_cmd.runScript(node, script, 600, options) - logging.debug(f'"{script}" finished with code {ret.returncode}, output:\n{ret.stdout}') - with cls_cmd.getConnection(node) as ssh: - details_json = archiveArtifact(ssh, ctx, f'{self.eNBSourceCodePath}/ci-scripts/{oc_release}-tests.json') - result_junit = archiveArtifact(ssh, ctx, f'{self.eNBSourceCodePath}/ci-scripts/{oc_release}-run.xml') - archiveArtifact(ssh, ctx, f'{self.eNBSourceCodePath}/ci-scripts/physim_log.txt') - archiveArtifact(ssh, ctx, f'{self.eNBSourceCodePath}/ci-scripts/physim_pods_summary.txt') - archiveArtifact(ssh, ctx, f'{self.eNBSourceCodePath}/ci-scripts/LastTestsFailed.log') - test_status, test_summary, test_result = cls_analysis.Analysis.analyze_oc_physim(result_junit, details_json, ctx.logPath) - if test_summary: - if test_status: - HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlTestRowPhySimTestResult(test_summary, test_result) - logging.info('\u001B[1m Physical Simulator Pass\u001B[0m') - else: - HTML.CreateHtmlTestRowQueue('At least one physical simulator test failed!', 'KO', ["See below for details"]) - HTML.CreateHtmlTestRowPhySimTestResult(test_summary, test_result) - logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') - else: - HTML.CreateHtmlTestRowQueue('Physical simulator failed', 'KO', [test_result]) - logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') - return test_status diff --git a/ci-scripts/cls_cmd.py b/ci-scripts/cls_cmd.py index fb074bdfce..9916049c11 100644 --- a/ci-scripts/cls_cmd.py +++ b/ci-scripts/cls_cmd.py @@ -45,12 +45,6 @@ def getConnection(host, d=None): else: return RemoteCmd(host, d=d) -def runScript(host, path, timeout, parameters=None, redirect=None, silent=False): - if is_local(host): - return LocalCmd.exec_script(path, timeout, parameters, redirect, silent) - else: - return RemoteCmd.exec_script(host, path, timeout, parameters, redirect, silent) - # provides a partial interface for the legacy SSHconnection class (getBefore(), command()) class Cmd(metaclass=abc.ABCMeta): def cd(self, d, silent=False): @@ -111,12 +105,12 @@ class LocalCmd(Cmd): logging.debug(f'Working dir is {self.cwd}') self.cp = sp.CompletedProcess(args='', returncode=0, stdout='') - def exec_script(path, timeout, parameters=None, redirect=None, silent=False): + def exec_script(self, path, timeout, parameters=None, redirect=None, silent=False): if redirect and not redirect.startswith("/"): raise ValueError(f"redirect must be absolute, but is {redirect}") c = f"{path} {parameters}" if parameters else path if not redirect: - ret = sp.run(c, shell=True, timeout=timeout, stdout=sp.PIPE, stderr=sp.STDOUT) + ret = sp.run(c, shell=True, cwd=self.cwd, timeout=timeout, stdout=sp.PIPE, stderr=sp.STDOUT) ret.stdout = ret.stdout.decode('utf-8').strip() else: with open(redirect, "w") as f: @@ -238,18 +232,15 @@ class RemoteCmd(Cmd): cfg['sock'] = paramiko.ProxyCommand(ucfg['proxycommand']) return cfg - def exec_script(host, path, timeout, parameters=None, redirect=None, silent=False): + def exec_script(self, path, timeout, parameters=None, redirect=None, silent=False): if redirect and not redirect.startswith("/"): raise ValueError(f"redirect must be absolute, but is {redirect}") p = parameters if parameters else "" r = f"> {redirect}" if redirect else "" if not silent: - logging.debug(f"local> ssh {host} bash -s {p} < {path} {r} # {path} from localhost") - client = RemoteCmd._ssh_init() - cfg = RemoteCmd._lookup_ssh_config(host) - client.connect(**cfg) + logging.debug(f"local> ssh {self.hostname} bash -s {p} < {path} {r}") bash_opt = 'BASH_XTRACEFD=1' # write bash set -x output to stdout, see bash(1) - stdin, stdout, stderr = client.exec_command(f"{bash_opt} bash -s {p} {r}", timeout=timeout) + stdin, stdout, stderr = self.client.exec_command(f"{bash_opt} bash -s {p} {r}", timeout=timeout) # open() the file f at path, read() it and write() it into the stdin of the bash -s cmd with open(path) as f: stdin.write(f.read()) @@ -259,7 +250,6 @@ class RemoteCmd(Cmd): if redirect: cmd += f" &> {redirect}" ret = sp.CompletedProcess(args=cmd, returncode=stdout.channel.recv_exit_status(), stdout=stdout.read(size=None) + stderr.read(size=None)) ret.stdout = ret.stdout.decode('utf-8').strip() - client.close() return ret def run(self, line, timeout=300, silent=False, reportNonZero=True): diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 7ee8dc4746..8b5a817ac6 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -66,7 +66,8 @@ def CreateWorkspace(host, sourcePath, ranRepository, ranCommitID, ranTargetBranc ranTargetBranch = 'develop' options += f" {ranTargetBranch}" logging.info(f'execute "{script}" with options "{options}" on node {host}') - ret = cls_cmd.runScript(host, script, 90, options) + with cls_cmd.getConnection(host) as c: + ret = c.exec_script(script, 90, options) logging.debug(f'"{script}" finished with code {ret.returncode}, output:\n{ret.stdout}') return ret.returncode == 0 @@ -362,7 +363,6 @@ class Containerize(): cmd.close() logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlTabFooter(False) return False else: result = re.search(r'Size *= *(?P[0-9\-]+) *bytes', cmd.getBefore()) @@ -486,7 +486,6 @@ class Containerize(): logging.error('\u001B[1m Build of L2sim proxy failed\u001B[0m') ssh.close() HTML.CreateHtmlTestRow('commit ' + tag, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlTabFooter(False) return False else: logging.debug('L2sim proxy image for tag ' + tag + ' already exists, skipping build') @@ -555,7 +554,6 @@ class Containerize(): if ret.returncode != 0: logging.error(f'No {baseImage} image present, cannot build tests') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlTabFooter(False) return False # build ran-unittests image @@ -566,7 +564,6 @@ class Containerize(): if ret.returncode != 0: logging.error(f'Cannot build unit tests') HTML.CreateHtmlTestRow("Unit test build failed", 'KO', [dockerfile]) - HTML.CreateHtmlTabFooter(False) return False HTML.CreateHtmlTestRowQueue("Build unit tests", 'OK', [dockerfile]) @@ -585,11 +582,9 @@ class Containerize(): if ret.returncode == 0: HTML.CreateHtmlTestRowQueue('Unit tests succeeded', 'OK', [ret.stdout]) - HTML.CreateHtmlTabFooter(True) return True else: HTML.CreateHtmlTestRowQueue('Unit tests failed (see also doc/UnitTests.md)', 'KO', [ret.stdout]) - HTML.CreateHtmlTabFooter(False) return False def Push_Image_to_Local_Registry(self, node, HTML, tag_prefix=""): diff --git a/ci-scripts/cls_corenetwork.py b/ci-scripts/cls_corenetwork.py index ad83eae622..bfdaa77481 100644 --- a/ci-scripts/cls_corenetwork.py +++ b/ci-scripts/cls_corenetwork.py @@ -77,7 +77,8 @@ class CoreNetwork: words = line[1:].strip().split(" ") script_name = words[0] options = " ".join(words[1:]) - ret = cls_cmd.runScript(host, script_name, 300, parameters=options, silent=silent) + with cls_cmd.getConnection(host) as c: + ret = c.exec_script(script_name, 300, parameters=options, silent=silent) return ret def _command(self, cmd_list, must_succeed=False, silent=False): diff --git a/ci-scripts/cls_native.py b/ci-scripts/cls_native.py index 1736cc144d..d96f60bdca 100644 --- a/ci-scripts/cls_native.py +++ b/ci-scripts/cls_native.py @@ -64,18 +64,3 @@ class Native(): logging.error('\u001B[1m Building OAI Failed\u001B[0m') HTML.CreateHtmlTestRow(options, 'KO', CONST.ALL_PROCESSES_OK) return success - - def Run_Physim(ctx, HTML, host, directory, options, physim_test, threshold): - logging.debug(f'Runnin {physim_test} on server: {host}') - workSpacePath = f'{directory}/cmake_targets' - runLogFile=f'{workSpacePath}/physim.log' - with cls_cmd.getConnection(host) as cmd: - cmd.run(f'sudo LD_LIBRARY_PATH=.:{DPDK_PATH}/lib64/ {workSpacePath}/ran_build/build/{physim_test} {options} > {runLogFile} 2>&1') - physim_file = archiveArtifact(cmd, ctx, runLogFile) - success, msg = cls_analysis.Analysis.analyze_physim(physim_file, physim_test, options, threshold) - if success: - HTML.CreateHtmlTestRowQueue(options, 'OK', [msg]) - else: - logging.error(msg) - HTML.CreateHtmlTestRowQueue(options, 'KO', [msg]) - return success diff --git a/ci-scripts/cls_oai_html.py b/ci-scripts/cls_oai_html.py index c4e13b2e62..cb1ca56542 100644 --- a/ci-scripts/cls_oai_html.py +++ b/ci-scripts/cls_oai_html.py @@ -247,7 +247,7 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write('

\n') - self.htmlFile.write('
End of Test Report -- Copyright 2018 OpenAirInterface. All Rights Reserved.
\n') + self.htmlFile.write('
End of Test Report -- Copyright 2025 OpenAirInterface. All Rights Reserved.
\n') self.htmlFile.write('\n') self.htmlFile.write('\n') self.htmlFile.close() @@ -533,6 +533,6 @@ class HTMLManagement(): self.htmlFile.write(' ' + value[2] + '\n') else: self.htmlFile.write(' ' + value[2] + '\n') - self.htmlFile.write(' ' + value[1] + '\n') + self.htmlFile.write(f'
{value[1]}
\n') self.htmlFile.close() diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 18631134c0..8dc4ae3a6f 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -46,6 +46,7 @@ import constants as CONST import cls_module import cls_corenetwork +import cls_analysis import cls_cmd from cls_ci_helper import archiveArtifact @@ -234,7 +235,8 @@ def Custom_Command(HTML, node, command): def Custom_Script(HTML, node, script): logging.info(f"Executing custom script on {node}") - ret = cls_cmd.runScript(node, script, 90) + with cls_cmd.getConnection(node) as c: + ret = c.exec_script(script, 90) logging.debug(f"Custom_Script: {script} on node: {node} - return code {ret.returncode}, output:\n{ret.stdout}") status = 'OK' message = [ret.stdout] @@ -249,6 +251,34 @@ def IdleSleep(HTML, idle_sleep_time): HTML.CreateHtmlTestRow(f"{idle_sleep_time} sec", 'OK', CONST.ALL_PROCESSES_OK) return True +def Deploy_Physim(ctx, HTML, node, workdir, script, options): + logging.debug(f'Running physims on server {node} workdir {workdir}') + with cls_cmd.getConnection(node) as c: + sys_info = c.exec_script("scripts/sys-info.sh", 5) + ret = c.exec_script(script, 600, options) + logging.debug(f'"{script}" finished with code {ret.returncode}, output:\n{ret.stdout}') + HTML.CreateHtmlTestRowQueue('Query system info', 'OK', [sys_info.stdout]) + with cls_cmd.getConnection(node) as ssh: + details_json = archiveArtifact(ssh, ctx, f'{workdir}/desc-tests.json') + result_junit = archiveArtifact(ssh, ctx, f'{workdir}/results-run.xml') + archiveArtifact(ssh, ctx, f'{workdir}/physim_log.txt') + archiveArtifact(ssh, ctx, f'{workdir}/LastTestsFailed.log') + archiveArtifact(ssh, ctx, f'{workdir}/LastTest.log') + test_status, test_summary, test_result = cls_analysis.Analysis.analyze_physim(result_junit, details_json, ctx.logPath) + if test_summary: + if test_status: + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRowPhySimTestResult(test_summary, test_result) + logging.info('\u001B[1m Physical Simulator Pass\u001B[0m') + else: + HTML.CreateHtmlTestRowQueue('At least one physical simulator test failed!', 'KO', ["See below for details"]) + HTML.CreateHtmlTestRowPhySimTestResult(test_summary, test_result) + logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') + else: + HTML.CreateHtmlTestRowQueue('Physical simulator failed', 'KO', [test_result]) + logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') + return test_status + #----------------------------------------------------------- # OaiCiTest Class Definition #----------------------------------------------------------- diff --git a/ci-scripts/conf_files/gnb-cu.sa.f1.ho.conf b/ci-scripts/conf_files/gnb-cu.sa.f1.ho.conf new file mode 100644 index 0000000000..8159eff571 --- /dev/null +++ b/ci-scripts/conf_files/gnb-cu.sa.f1.ho.conf @@ -0,0 +1,76 @@ +Active_gNBs = ( "oai-cu"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe88; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "oai-cu"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ mcc = 001; mnc = 03; mnc_length = 2; snssaiList = ({ sst = 1 }) }); + + @include "neighbour-config-ho.conf" + + nr_cellid = 12345678L; + + tr_s_preference = "f1"; + + local_s_address = "172.21.19.98"; + remote_s_address = "0.0.0.0"; + local_s_portd = 2153; + remote_s_portd = 2154; + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ({ ipv4 = "172.21.6.109"; }); + + NETWORK_INTERFACES : + { + + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.19.98/22"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.19.98/22"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +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"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + f1ap_log_level ="info"; + ngap_log_level ="info"; +}; diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf index 9b46110547..e4d9127284 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf @@ -146,18 +146,8 @@ gNBs = ); - servingCellConfigDedicated = ({ - dl_bwp-Id_1 = 1; - dl_bwp1_locationAndBandwidth = 28875; # RBstart=0, L=106 (275*(L-1))+RBstart - dl_bwp1_subcarrierSpacing = 1; - firstActiveDownlinkBWP-Id = 1; - defaultDownlinkBWP-Id = 1; - ul_bwp-Id_1 = 1; - ul_bwp1_locationAndBandwidth = 28875; # RBstart=0, L=106 (275*(L-1))+RBstart - ul_bwp1_subcarrierSpacing = 1; - firstActiveUplinkBWP-Id = 1; - }); - + first_active_bwp = 1; + bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;}); # ------- SCTP definitions SCTP : diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci0.conf b/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci0.conf new file mode 100644 index 0000000000..6360d79124 --- /dev/null +++ b/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci0.conf @@ -0,0 +1,217 @@ +Active_gNBs = ( "oai-du0"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe88; + gNB_DU_ID = 0xe00; + gNB_name = "oai-du0"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1 ; + plmn_list = ({ mcc = 001; mnc = 03; mnc_length = 2; snssaiList = ({ sst = 1; }) }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + do_CSIRS = 0; + do_SRS = 0; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # 4.01 GHz + absoluteFrequencySSB = 629376; + dl_frequencyBand = 78; + # 4 GHz + dl_absoluteFrequencyPointA = 628720; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 51; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13750; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 51; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 13750; +# 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 = 13; + preambleReceivedTargetPower = -96; +#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; +#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 = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#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, + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# 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; + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_address = "172.21.19.98"; + remote_n_address = "172.21.19.98"; + local_n_portc = 500; + local_n_portd = 2154; + remote_n_portc = 501; + remote_n_portd = 2153; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 230; +# ul_prbblack_SNR_threshold = 10; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 100; + pucch0_dtx_threshold = 10; + max_ldpc_iterations = 20; + sl_ahead = 3; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( +{ + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0; + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; +# USRP is connected to an Octoclock in order to establish synchroniation with other USRPs + clock_src = "external"; + time_src = "external"; +} +); + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="info"; +}; diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci1.conf b/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci1.conf new file mode 100644 index 0000000000..d432d7323a --- /dev/null +++ b/ci-scripts/conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci1.conf @@ -0,0 +1,217 @@ +Active_gNBs = ( "oai-du1"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe88; + gNB_DU_ID = 0xe01; + gNB_name = "oai-du1"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1 ; + plmn_list = ({ mcc = 001; mnc = 03; mnc_length = 2; snssaiList = ({ sst = 1; }) }); + + nr_cellid = 11111111L; + + ////////// Physical parameters: + + do_CSIRS = 0; + do_SRS = 0; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 1; + +# downlinkConfigCommon + #frequencyInfoDL + # 4.01 GHz + absoluteFrequencySSB = 629376; + dl_frequencyBand = 78; + # 4 GHz + dl_absoluteFrequencyPointA = 628720; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 51; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13750; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 51; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 13750; +# 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 = 13; + preambleReceivedTargetPower = -96; +#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; +#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 = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#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, + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# 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; + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_address = "172.21.19.99"; + remote_n_address = "172.21.19.98"; + local_n_portc = 500; + local_n_portd = 2154; + remote_n_portc = 501; + remote_n_portd = 2153; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 230; +# ul_prbblack_SNR_threshold = 10; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 100; + pucch0_dtx_threshold = 10; + max_ldpc_iterations = 20; + sl_ahead = 3; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( +{ + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0; + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; +# USRP is connected to an Octoclock in order to establish synchroniation with other USRPs + clock_src = "external"; + time_src = "external"; +} +); + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="info"; +}; diff --git a/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf b/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf index 585d639f9f..f26891d8f2 100644 --- a/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf +++ b/ci-scripts/conf_files/gnb-vnf.sa.band78.273prb.aerial.conf @@ -197,7 +197,6 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 200; # 150; pucch_TargetSNRx10 = 200; #200; - ulsch_max_frame_inactivity = 10; dl_max_mcs = 28; ul_max_mcs = 28; } diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf index 6b1ce70b01..8d71434f66 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf @@ -198,7 +198,6 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; -# ulsch_max_frame_inactivity = 0; pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; dl_max_mcs = 9; diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf index 03ca88d01b..a7663ae811 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf @@ -16,6 +16,7 @@ gNBs = ////////// Physical parameters: + do_SINR = 1; min_rxtxtime = 6; disable_harq = 1; cu_sibs = [2]; @@ -205,7 +206,6 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; -# ulsch_max_frame_inactivity = 0; pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; dl_max_mcs = 9; diff --git a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf index 23a8b34c3a..932699a83f 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.162prb.usrpn310.2x2.conf @@ -24,6 +24,7 @@ gNBs = pusch_AntennaPorts = 2; do_CSIRS = 1; do_SRS = 1; + uess_agg_levels = [4,2,0,0,0]; servingCellConfigCommon = ( { @@ -139,9 +140,9 @@ gNBs = # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 5; - nrofDownlinkSlots = 2; + nrofDownlinkSlots = 1; nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; + nrofUplinkSlots = 3; nrofUplinkSymbols = 4; ssPBCH_BlockPower = -20; @@ -178,11 +179,12 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 300; - pucch_TargetSNRx10 = 300; - ulsch_max_frame_inactivity = 0; + pusch_TargetSNRx10 = 320; + pucch_TargetSNRx10 = 320; pusch_FailureThres = 100; - ul_max_mcs = 28; + ul_max_mcs = 28; + ul_bler_target_upper = 0.20; + ul_bler_target_lower = 0.10; } ); diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf index 3c51a977d8..5928ea4452 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.usrpn310.2x2.conf @@ -175,7 +175,6 @@ MACRLCs = ( pusch_TargetSNRx10 = 270; pucch_TargetSNRx10 = 270; pusch_FailureThres = 1000; - ulsch_max_frame_inactivity = 0; ul_max_mcs = 25; } ); diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf index 0808c4b43d..6322d1463c 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf @@ -145,64 +145,10 @@ gNBs = ); - # Dedicated Serving Cell Configuration - servingCellConfigDedicated = ({ - # BWP-Downlink - # BWP 1 Configuration - dl_bwp-Id_1 = 1; - dl_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_bwp1_subcarrierSpacing = 1; - - # BWP 2 Configuration - dl_bwp-Id_2 = 2; - dl_bwp2_locationAndBandwidth = 13750; // RBstart=0, L=51 (20 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_bwp2_subcarrierSpacing = 1; - - # BWP 3 Configuration - dl_bwp-Id_3 = 3; - dl_bwp3_locationAndBandwidth = 6325; // RBstart=0, L=24 (10 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_bwp3_subcarrierSpacing = 1; - - firstActiveDownlinkBWP-Id = 1; #BWP-Id - defaultDownlinkBWP-Id = 1; #BWP-Id - - # bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, - # ms40,ms50, ms60, ms80,ms100, ms200,ms300, ms500, - # ms750, ms1280, ms1920, ms2560, spare10, spare9, spare8, - # spare7, spare6, spare5, spare4, spare3, spare2, spare1 } - - # UplinkConfig - # BWP-Uplink - # BWP 1 Configuration - ul_bwp-Id_1 = 1; - ul_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_bwp1_subcarrierSpacing = 1; - - # BWP 2 Configuration - ul_bwp-Id_2 = 2; - ul_bwp2_locationAndBandwidth = 13750; // RBstart=0, L=51 (20 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_bwp2_subcarrierSpacing = 1; - - # BWP 3 Configuration - ul_bwp-Id_3 = 3; - ul_bwp3_locationAndBandwidth = 6325; // RBstart=0, L=24 (10 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_bwp3_subcarrierSpacing = 1; - - firstActiveUplinkBWP-Id = 1; #BWP-Id - } - ); + first_active_bwp = 1; + bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;}, + { scs = 1; bwpStart = 0; bwpSize = 51;}, + { scs = 1; bwpStart = 0; bwpSize = 24;}); # ------- SCTP definitions @@ -233,7 +179,6 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 250; pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 0; } ); diff --git a/ci-scripts/conf_files/neighbour-config-ho.conf b/ci-scripts/conf_files/neighbour-config-ho.conf new file mode 100644 index 0000000000..f9d1e38ee0 --- /dev/null +++ b/ci-scripts/conf_files/neighbour-config-ho.conf @@ -0,0 +1,54 @@ +neighbour_list = ( + { + nr_cellid = 12345678; + neighbour_cell_configuration = ( + { + gNB_ID = 0xe01; + nr_cellid = 11111111; + physical_cellId = 1; + absoluteFrequencySSB = 629376; + subcarrierSpacing = 1; #30 KHz + band = 78; + plmn = { mcc = 001; mnc = 03; mnc_length = 2}; + tracking_area_code = 1; + } + ) + }, + { + nr_cellid = 11111111; + neighbour_cell_configuration = ( + { + gNB_ID = 0xe00; + nr_cellid = 12345678; + physical_cellId = 0; + absoluteFrequencySSB = 629376; + subcarrierSpacing = 1; #30 KHz + band = 78; + plmn = { mcc = 001; mnc = 03; mnc_length = 2}; + tracking_area_code = 1; + } + ) + } + ); + + +nr_measurement_configuration = { + Periodical = { + enable = 1; + includeBeamMeasurements = 1; + maxNrofRS_IndexesToReport = 4; + }; + + A2 = { + enable = 1; + threshold = 110; + timeToTrigger = 1; + }; + + A3 = ({ + cell_id = -1; #Default + offset = 10; + hysteresis = 0; + timeToTrigger = 1 + }) +}; diff --git a/ci-scripts/docker/Dockerfile.physim.ubuntu b/ci-scripts/docker/Dockerfile.physim.ubuntu new file mode 100644 index 0000000000..c3adfba966 --- /dev/null +++ b/ci-scripts/docker/Dockerfile.physim.ubuntu @@ -0,0 +1,46 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +# Dockerfile for the Open-Air-Interface BUILD service +# Valid for Ubuntu 24.04 +# +#--------------------------------------------------------------------- + +FROM ran-base:develop AS ran-tests + +#RUN apt-get update && \ +# DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ +# DEBIAN_FRONTEND=noninteractive apt-get install --yes \ +# libgtest-dev \ +# libyaml-cpp-dev + +RUN rm -Rf /oai-ran +WORKDIR /oai-ran +COPY . . + +WORKDIR /oai-ran/build +# TODO should SANITIZE be ON? it makes it compile much longer +RUN cmake -GNinja -DENABLE_PHYSIM_TESTS=ON \ + -DSANITIZE_UNDEFINED=OFF -DSANITIZE_ADDRESS=OFF \ + -DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS=-Werror \ + .. && \ + ninja ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim nr_psbchsim diff --git a/ci-scripts/main.py b/ci-scripts/main.py index cbc03a47d5..3e7be396cc 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -242,10 +242,22 @@ def ExecuteActionWithParam(action, ctx): st = test.findtext('idle_sleep_time_in_sec') or "5" success = cls_oaicitest.IdleSleep(HTML, int(st)) - elif action == 'Deploy_Run_PhySim': + elif action == 'Deploy_Run_OC_PhySim': oc_release = test.findtext('oc_release') node = test.findtext('node') or None - success = CLUSTER.deploy_oc_physim(ctx, HTML, oc_release, node) + script = "scripts/oc-deploy-physims.sh" + image_tag = cls_containerize.CreateTag(CLUSTER.ranCommitID, CLUSTER.ranBranch, CLUSTER.ranAllowMerge) + options = f"oaicicd-core-for-ci-ran {oc_release} {image_tag} {CLUSTER.eNBSourceCodePath}" + workdir = CLUSTER.eNBSourceCodePath + success = cls_oaicitest.Deploy_Physim(ctx, HTML, node, workdir, script, options) + + elif action == 'Build_Deploy_Docker_PhySim' or action == 'Build_Deploy_Source_PhySim': + node = test.findtext('node') or None + ctest_opt = test.findtext('ctest-opt') or '' + script = "scripts/docker-build-and-deploy-physims.sh" if action == 'Build_Deploy_Docker_PhySim' else 'scripts/source-deploy-physims.sh' + options = f"{CONTAINERS.eNBSourceCodePath} {ctest_opt}" + workdir = CONTAINERS.eNBSourceCodePath + success = cls_oaicitest.Deploy_Physim(ctx, HTML, node, workdir, script, options) elif action == 'DeployCoreNetwork' or action == 'UndeployCoreNetwork': cn_id = test.findtext('cn_id') @@ -274,13 +286,6 @@ def ExecuteActionWithParam(action, ctx): return True success = CONTAINERS.Create_Workspace(node, HTML) - elif action == 'Run_Physim': - physim_options = test.findtext('physim_run_args') - physim_test = test.findtext('physim_test') - physim_threshold = test.findtext('physim_time_threshold') or 'inf' - node = test.findtext('node') - success = cls_native.Native.Run_Physim(ctx, HTML, node, RAN.eNBSourceCodePath, physim_options, physim_test, physim_threshold) - elif action == 'LicenceAndFormattingCheck': node = test.findtext('node') success = SCA.LicenceAndFormattingCheck(ctx, node, HTML) diff --git a/ci-scripts/scripts/docker-build-and-deploy-physims.sh b/ci-scripts/scripts/docker-build-and-deploy-physims.sh new file mode 100755 index 0000000000..c49ebefc1d --- /dev/null +++ b/ci-scripts/scripts/docker-build-and-deploy-physims.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +function die() { echo $@; exit 1; } +[ $# -ge 1 ] || die "usage: $0 [ctest-options]" + +IMAGE=ran-physimtests:ci-temp +CONTAINER=ran-physimtests +function cleanup-docker() { + docker stop ${CONTAINER} + docker rm ${CONTAINER} + docker rmi ${IMAGE} + docker volume prune --force +} +trap cleanup-docker EXIT + +set -x +DIR=$1 +RESULT_DIR=${DIR}/ +shift +CTEST_OPT=$@ + +# build physims +docker build --progress=plain --tag ${IMAGE} --file ${DIR}/ci-scripts/docker/Dockerfile.physim.ubuntu ${DIR} &>> ${RESULT_DIR}/physim_log.txt +if [ $? -ne 0 ]; then + echo "build of physims failed" + exit 1 +fi + +# get a JSON description of all tests to run +docker run -a STDOUT --workdir /oai-ran/build/ --env LD_LIBRARY_PATH=/oai-ran/build/ --rm --name ${CONTAINER} ${IMAGE} ctest ${CTEST_OPT} --show-only=json-v1 &> ${RESULT_DIR}/desc-tests.json +JSON_RES=$? + +# run the actual tests: we don't suppy --rm as we have to copy the files +# similar to unit tests, we can't mount the file where we write physims-5g-run.xml to +# as it would write a file as root, but this script is run as a normal user +docker run -a STDOUT --workdir /oai-ran/build/ --env LD_LIBRARY_PATH=/oai-ran/build/ --name ${CONTAINER} ${IMAGE} ctest ${CTEST_OPT} --output-junit results-run.xml --test-output-size-passed 100000 --test-output-size-failed 100000 &>> ${RESULT_DIR}/physim_log.txt +RUN_RES=$? +docker cp ${CONTAINER}:/oai-ran/build/results-run.xml ${RESULT_DIR}/ +docker cp ${CONTAINER}:/oai-ran/build/Testing/Temporary/LastTestsFailed.log ${RESULT_DIR}/ +docker cp ${CONTAINER}:/oai-ran/build/Testing/Temporary/LastTest.log ${RESULT_DIR}/ + +# if both were successful, return 0 +# TODO not sure +#[[ $JSON_RES -eq 0 && $RUN_RES -eq 0 ]] && exit 0 + +exit 0 diff --git a/ci-scripts/scripts/oc-deploy-physims.sh b/ci-scripts/scripts/oc-deploy-physims.sh index ddb2e964ef..c209be485b 100755 --- a/ci-scripts/scripts/oc-deploy-physims.sh +++ b/ci-scripts/scripts/oc-deploy-physims.sh @@ -13,21 +13,22 @@ OAI_DIR=${4} cat /opt/oc-password | oc login -u oaicicd --server https://api.oai.cs.eurecom.fr:6443 > /dev/null oc project ${OC_NS} > /dev/null oc tag oaicicd-ran/oai-physim:${IMG_TAG} ${OC_NS}/oai-physim:${IMG_TAG} -helm install ${OC_RELEASE} ${OAI_DIR}/charts/${OC_RELEASE} --set global.image.version=${IMG_TAG} --wait +helm install ${OC_RELEASE} ${OAI_DIR}/charts/${OC_RELEASE} --set global.image.version=${IMG_TAG} --wait --timeout 120s POD_ID=$(oc get pods | grep oai-${OC_RELEASE} | awk '{print $1}') sleep 10 echo "Monitoring logs for 'FINISHED' in pod '$POD_ID'" oc logs -f -n ${OC_NS} "$POD_ID" | while read -r line; do if [[ "$line" == *"FINISHED"* ]]; then echo "'FINISHED' detected in logs. Copying logs..." - oc logs -n ${OC_NS} "$POD_ID" >> ${OAI_DIR}/ci-scripts/physim_log.txt - oc describe pod $POD_ID >> ${OAI_DIR}/ci-scripts/physim_pods_summary.txt - oc cp "$POD_ID":/opt/oai-physim/Testing/Temporary/LastTestsFailed.log ${OAI_DIR}/ci-scripts/LastTestsFailed.log - oc cp "$POD_ID":/opt/oai-physim/${OC_RELEASE}-tests.json ${OAI_DIR}/ci-scripts/${OC_RELEASE}-tests.json - oc cp "$POD_ID":/opt/oai-physim/${OC_RELEASE}-run.xml ${OAI_DIR}/ci-scripts/${OC_RELEASE}-run.xml + oc cp "$POD_ID":/opt/oai-physim/Testing/Temporary/LastTestsFailed.log ${OAI_DIR}/LastTestsFailed.log + oc cp "$POD_ID":/opt/oai-physim/Testing/Temporary/LastTest.log ${OAI_DIR}/LastTest.log + oc cp "$POD_ID":/opt/oai-physim/${OC_RELEASE}-tests.json ${OAI_DIR}/desc-tests.json + oc cp "$POD_ID":/opt/oai-physim/${OC_RELEASE}-run.xml ${OAI_DIR}/results-run.xml break fi done +oc logs -n ${OC_NS} "$POD_ID" >> ${OAI_DIR}/physim_log.txt +oc describe pod $POD_ID >> ${OAI_DIR}/physim_log.txt helm uninstall ${OC_RELEASE} --wait oc delete istag oai-physim:${IMG_TAG} -n ${OC_NS} oc logout > /dev/null diff --git a/ci-scripts/scripts/source-deploy-physims.sh b/ci-scripts/scripts/source-deploy-physims.sh new file mode 100644 index 0000000000..6054453301 --- /dev/null +++ b/ci-scripts/scripts/source-deploy-physims.sh @@ -0,0 +1,30 @@ + +function die() { echo $@; exit 1; } +[ $# -ge 1 ] || die "usage: $0 [ctest-options]" + +set -x +DIR=$1 +shift +CTEST_OPT=$@ + +cd ${DIR}/cmake_targets/ran_build/build +ninja ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim nr_psbchsim + +# get a JSON description of all tests to run +ctest ${CTEST_OPT} --show-only=json-v1 &> ${DIR}/desc-tests.json +JSON_RES=$? + +# we run the T2 offload tests, so provide some additional permissions +# to be able to initialize DPDK +sudo setcap cap_dac_override,cap_sys_admin+ep nr_ulsim +sudo setcap cap_dac_override,cap_sys_admin+ep nr_dlsim +ctest ${CTEST_OPT} --output-junit ${DIR}/results-run.xml --test-output-size-passed 100000 --test-output-size-failed 100000 &>> ${DIR}/physim_log.txt +RUN_RES=$? +cp Testing/Temporary/LastTestsFailed.log ${DIR}/ +cp Testing/Temporary/LastTest.log ${DIR}/ + +# if both were successful, return 0 +# TODO not sure +#[[ $JSON_RES -eq 0 && $RUN_RES -eq 0 ]] && exit 0 + +exit 0 diff --git a/ci-scripts/scripts/sys-info.sh b/ci-scripts/scripts/sys-info.sh new file mode 100755 index 0000000000..01dd4b0d6c --- /dev/null +++ b/ci-scripts/scripts/sys-info.sh @@ -0,0 +1,17 @@ +CORES=$(nproc) +MODEL=$(lscpu | awk -F: '/Model name/ {print $2; exit}' | xargs) +MAX_FREQ=$(lscpu | awk -F: '/CPU max MHz/ {printf "%.2f MHz", $2; exit}') +CURRENT_FREQ=$(awk -F: '/cpu MHz/ {printf " %.2f MHz", $2; exit}' /proc/cpuinfo) +RAM=$(free -h --si | awk '/Mem:/ {print $2}') +# sudo -n: non-interactive, will silently fail in case we don't have privileges +DMID=$(sudo -n dmidecode -t memory 2>/dev/null) +if [ $? -eq 0 ]; then + RAM_TYPE=$(echo "$DMID" | awk -F: '/Type:/ {print $2}' | grep -Ev 'Unknown|Other|None' | head -1 | xargs) +else + RAM_TYPE="can't query" +fi + + +echo "CPU: model ${MODEL}" +echo "${CORES} cores, max CPU freq ${MAX_FREQ}, current ${CURRENT_FREQ}" +echo "RAM ${RAM} type ${RAM_TYPE}" diff --git a/ci-scripts/tests/cmd.py b/ci-scripts/tests/cmd.py index 4d7aedfa0e..b9cbb6f51e 100644 --- a/ci-scripts/tests/cmd.py +++ b/ci-scripts/tests/cmd.py @@ -36,17 +36,20 @@ class TestCmd(unittest.TestCase): self.assertEqual(ret.stdout, "test") def test_local_script(self): - ret = cls_cmd.runScript("localhost", "tests/scripts/hello-world.sh", 1) + with cls_cmd.getConnection("localhost") as ssh: + ret = ssh.exec_script("tests/scripts/hello-world.sh", 1) self.assertEqual(ret.args, "tests/scripts/hello-world.sh") self.assertEqual(ret.returncode, 0) self.assertEqual(ret.stdout, "+ echo hello, world\nhello, world") - ret = cls_cmd.runScript("localhost", "tests/scripts/hello-fail.sh", 1, "TESTFAIL") + with cls_cmd.getConnection("localhost") as ssh: + ret = ssh.exec_script("tests/scripts/hello-fail.sh", 1, "TESTFAIL") self.assertEqual(ret.args, "tests/scripts/hello-fail.sh TESTFAIL") self.assertEqual(ret.returncode, 1) self.assertEqual(ret.stdout, "TESTFAIL") - ret = cls_cmd.runScript("localhost", "tests/scripts/hello-fail.sh", 1, "TESTFAIL2", "/tmp/result") + with cls_cmd.getConnection("localhost") as ssh: + ret = ssh.exec_script("tests/scripts/hello-fail.sh", 1, "TESTFAIL2", "/tmp/result") self.assertEqual(ret.args, "tests/scripts/hello-fail.sh TESTFAIL2 &> /tmp/result") self.assertEqual(ret.returncode, 1) self.assertEqual(ret.stdout, "") @@ -75,17 +78,20 @@ class TestCmd(unittest.TestCase): @unittest.skip("need to be able to passwordlessly SSH to localhost, also disable stty -ixon") def test_remote_script(self): - ret = cls_cmd.runScript("127.0.0.1", "tests/scripts/hello-world.sh", 1) + with cls_cmd.getConnection("127.0.0.1") as ssh: + ret = ssh.exec_script("tests/scripts/hello-world.sh", 1) self.assertEqual(ret.args, "tests/scripts/hello-world.sh") self.assertEqual(ret.returncode, 0) self.assertEqual(ret.stdout, "+ echo hello, world\nhello, world") - ret = cls_cmd.runScript("127.0.0.1", "tests/scripts/hello-fail.sh", 1, "TESTFAIL") + with cls_cmd.getConnection("127.0.0.1") as ssh: + ret = ssh.exec_script("tests/scripts/hello-fail.sh", 1, "TESTFAIL") self.assertEqual(ret.args, "tests/scripts/hello-fail.sh TESTFAIL") self.assertEqual(ret.returncode, 1) self.assertEqual(ret.stdout, "TESTFAIL") - ret = cls_cmd.runScript("127.0.0.1", "tests/scripts/hello-fail.sh", 1, "TESTFAIL2", "/tmp/result") + with cls_cmd.getConnection("127.0.0.1") as ssh: + ret = ssh.exec_script("tests/scripts/hello-fail.sh", 1, "TESTFAIL2", "/tmp/result") self.assertEqual(ret.args, "tests/scripts/hello-fail.sh TESTFAIL2 &> /tmp/result") self.assertEqual(ret.returncode, 1) self.assertEqual(ret.stdout, "") diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 211e02d4c1..615454bbea 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,7 +1,6 @@ - Build_Proxy - Build_Cluster_Image - Pull_Cluster_Image - - Run_Physim - Build_eNB - Initialize_eNB - Terminate_eNB @@ -23,7 +22,9 @@ - Deploy_Object - Undeploy_Object - Cppcheck_Analysis - - Deploy_Run_PhySim + - Deploy_Run_OC_PhySim + - Build_Deploy_Docker_PhySim + - Build_Deploy_Source_PhySim - LicenceAndFormattingCheck - Push_Local_Registry - Pull_Local_Registry diff --git a/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml b/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml new file mode 100644 index 0000000000..814346b5f3 --- /dev/null +++ b/ci-scripts/xml_files/container_sa_f1_ho_b210_quectel.xml @@ -0,0 +1,251 @@ + + + TEST-F1-HO-B210 + F1 Handover 20 MHz TDD SA + tasks + + 000001 + 000002 + 000003 + 000004 + 000005 + 000006 + 000007 + 000008 + 000009 + 000010 + 000011 + 000012 + 000013 + 000014 + 000015 + 000016 + 000017 + 000018 + 000019 + 000020 + 000021 + 000022 + 000023 + 000024 + 000025 + 000026 + + + + + + DeployCoreNetwork + Initialize 5G Core + oc-cn5g-00102-ho + + + + Pull_Local_Registry + Pull Images from Local Registry + oai-gnb + groot + + + + Pull_Local_Registry + Pull Images from Local Registry + oai-gnb + rocket + + + + Create_Workspace + Create new Workspace for groot + groot + + + + Create_Workspace + Create new Workspace on rocket + rocket + + + + Deploy_Object + Deploy gNB-CU in a container + ci-scripts/yaml_files/5g_sa_f1_b210_ho + groot + oai_cu + + + + Deploy_Object + Deploy gNB-DU0 (TDD/Band77/20MHz/B210) in a container + ci-scripts/yaml_files/5g_sa_f1_b210_ho + oai_du0 + groot + + + + Attach_UE + Attach Quectel + raspix + + + + Ping + Ping: 100pings in 20sec + raspix + oc-cn5g-00102-ho + -c 100 -i 0.2 + 5 + + + + Deploy_Object + Deploy gNB-DU1 (TDD/Band77/20MHz/B210) in a container + ci-scripts/yaml_files/5g_sa_f1_b210_ho + rocket + oai_du1 + + + + IdleSleep + Sleep + 5 + + + + Custom_Command + Trigger Handover + groot + echo ci trigger_f1_ho | ncat 127.0.0.1 9090 + + + + Ping + Ping: 50pings in 10sec + raspix + oc-cn5g-00102-ho + -c 50 -i 0.2 + 5 + + + + Custom_Command + UE connected to DU1? + groot + echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3585" + + + + Custom_Command + Trigger Handover + groot + echo ci trigger_f1_ho | ncat 127.0.0.1 9090 + + + + Ping + Ping: 50pings in 10sec + raspix + oc-cn5g-00102-ho + -c 50 -i 0.2 + 5 + + + + Custom_Command + UE connected to DU0? + groot + echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3584" + + + + Custom_Command + Trigger Handover + groot + echo ci trigger_f1_ho | ncat 127.0.0.1 9090 + + + + Ping + Ping: 50pings in 10sec + raspix + oc-cn5g-00102-ho + -c 50 -i 0.2 + 5 + + + + Custom_Command + UE connected to DU1? + groot + echo ci fetch_du_by_ue_id 1 | ncat 127.0.0.1 9090 | grep "3585" + + + + Detach_UE + true + Detach Quectel + raspix + + + + Undeploy_Object + true + Undeploy CU-DU0 + groot + ci-scripts/yaml_files/5g_sa_f1_b210_ho + + + + Undeploy_Object + true + Undeploy DU1 + rocket + ci-scripts/yaml_files/5g_sa_f1_b210_ho + + + + Clean_Test_Server_Images + true + Clean Test Images on Test Server + groot + oai-gnb + + + + Clean_Test_Server_Images + true + Clean Test Images on Test Server + rocket + oai-gnb + + + + UndeployCoreNetwork + true + Terminate 5G Core + oc-cn5g-00102-ho + + + + diff --git a/ci-scripts/xml_files/container_sa_n310_2X2_60MHz_quectel.xml b/ci-scripts/xml_files/container_sa_n310_2X2_60MHz_quectel.xml index b153952252..ab7188c023 100644 --- a/ci-scripts/xml_files/container_sa_n310_2X2_60MHz_quectel.xml +++ b/ci-scripts/xml_files/container_sa_n310_2X2_60MHz_quectel.xml @@ -22,7 +22,7 @@ --> TEST-SA-FR1-N310-2x2-60MHz - 60 MHz 2x2 TDD SA + 60 MHz 2x2 TDD SA DSUUU tasks 100000 @@ -114,8 +114,8 @@ Iperf - iperf (DL/200Mbps/UDP)(30 sec)(single-ue profile) - -u -b 200M -t 30 -R + iperf (DL/150Mbps/UDP)(30 sec)(single-ue profile) + -u -b 150M -t 30 -R matix-cn5g up2 25 @@ -124,8 +124,8 @@ Iperf - iperf (UL/180Mbps/UDP)(30 sec)(single-ue profile) - -u -b 180M -t 30 + iperf (UL/250Mbps/UDP)(30 sec)(single-ue profile) + -u -b 250M -t 30 matix-cn5g up2 10 @@ -147,8 +147,8 @@ matix ci-scripts/yaml_files/5g_sa_n310_2x2_60MHz oai-gnb - 10,100,100,100 - 10,100,100,100 + 15,100,100,100 + 20,100,100,100 diff --git a/ci-scripts/xml_files/ldpc_gpu_test.xml b/ci-scripts/xml_files/ldpc_gpu_test.xml deleted file mode 100644 index 00ccbe3da1..0000000000 --- a/ci-scripts/xml_files/ldpc_gpu_test.xml +++ /dev/null @@ -1,396 +0,0 @@ - - - test-ldpc-gpu - Test-ldpc-GPU - tasks - - 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021 - 000022 000023 000024 000025 000026 000027 000028 000029 000030 000031 000032 000033 000034 000035 000036 000037 000038 000039 000040 000041 - - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 3872 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 3872 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 4224 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 4224 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 4576 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 4576 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 4928 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 4928 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 5280 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 5280 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 5632 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 5632 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 6336 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 6336 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 7040 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 7040 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 7744 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 7744 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 8448 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 8448 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 1 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 1 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 100 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 100 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 193 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 193 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 500 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 500 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 561 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 561 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 600 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 600 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 641 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 641 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 2000 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 2000 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 3000 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 3000 -s10 -n100 -G 1 - - - - Run_Physim - Run LDPC Test with CPU - true - caracal - ldpctest - -l 3840 -s10 -n100 - - - - Run_Physim - Run LDPC Test with GPU - true - caracal - ldpctest - -l 3840 -s10 -n100 -G 1 - - - - - diff --git a/ci-scripts/xml_files/physim_4g_deploy_run.xml b/ci-scripts/xml_files/physim_4g_deploy_run.xml index bdad3e412f..cd34037760 100644 --- a/ci-scripts/xml_files/physim_4g_deploy_run.xml +++ b/ci-scripts/xml_files/physim_4g_deploy_run.xml @@ -37,7 +37,7 @@ - Deploy_Run_PhySim + Deploy_Run_OC_PhySim Deploy and run physical simulator on openshift physims-4g avra diff --git a/ci-scripts/xml_files/physim_5g_deploy_run.xml b/ci-scripts/xml_files/physim_5g_deploy_run.xml index 08de47aaac..1967003124 100644 --- a/ci-scripts/xml_files/physim_5g_deploy_run.xml +++ b/ci-scripts/xml_files/physim_5g_deploy_run.xml @@ -37,7 +37,7 @@ - Deploy_Run_PhySim + Deploy_Run_OC_PhySim Deploy and run physical simulator on openshift physims-5g avra diff --git a/ci-scripts/xml_files/physim_gracehopper.xml b/ci-scripts/xml_files/physim_gracehopper.xml new file mode 100644 index 0000000000..a2abc628d0 --- /dev/null +++ b/ci-scripts/xml_files/physim_gracehopper.xml @@ -0,0 +1,46 @@ + + + build-tab + PhySim + wrench + + 800813 + 010201 + + + + + Create_Workspace + Create new Workspace + localhost + + + + Build_Deploy_Docker_PhySim + Deploy and Deploy PhySim + localhost + -R 5g -E physim.5g.nr_dlsim.mcs.mimo.test9 -j16 + + + diff --git a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml b/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml deleted file mode 100644 index 4a2daf0b97..0000000000 --- a/ci-scripts/xml_files/t2_offload_dec_nr_ulsim.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - test-t2-offload-dec - Test T2 Offload Decoder - tasks - - 010204 - 010111 010112 010121 010122 010131 010132 - 010211 010212 010221 010222 010231 010232 - 010311 010312 010321 010322 010331 010332 - 402010 - - - - - Custom_Command - Disable Sleep States - caracal - sudo cpupower idle-set -D 0 - - - - Custom_Command - true - Enable Sleep States - caracal - sudo cpupower idle-set -E - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 300 - -n1000 -s30 -S30.2 -m5 -r106 -R106 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 100 - -n1000 -s30 -S30.2 -m5 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 300 - -n1000 -s30 -S30.2 -m15 -r106 -R106 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 150 - -n1000 -s30 -S30.2 -m15 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 250 - -n1000 -s30 -S30.2 -m25 -r106 -R106 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer - true - caracal - nr_ulsim - 250 - -n1000 -s30 -S30.2 -m25 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 300 - -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 150 - -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 400 - -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 350 - -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 400 - -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer - true - caracal - nr_ulsim - 550 - -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 300 - -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -W2 -z2 -y2 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 250 - -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 600 - -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -W2 -z2 -y2 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 650 - -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_ulsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 650 - -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -W2 -z2 -y2 -P - - - - Run_Physim - Run nr_ulsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers - true - caracal - nr_ulsim - 1100 - -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - diff --git a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml b/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml deleted file mode 100644 index 69dc27943c..0000000000 --- a/ci-scripts/xml_files/t2_offload_enc_nr_dlsim.xml +++ /dev/null @@ -1,290 +0,0 @@ - - - - test-t2-offload-enc - Test T2 Offload Encoder - tasks - - 102040 - 000111 000112 000121 000122 000131 000132 - 000211 000212 000221 000222 000231 000232 - 000311 000312 000321 000322 000331 000332 - 000411 000412 000421 000422 000431 000432 - 040201 - - - - - Custom_Command - Disable Sleep States - caracal - sudo cpupower idle-set -D 0 - - - - Custom_Command - true - Enable Sleep States - caracal - sudo cpupower idle-set -E - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 230 - -n1000 -s30 -S30.2 -e5 -b106 -R106 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 100 - -n1000 -s30 -S30.2 -e5 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 300 - -n1000 -s30 -S30.2 -e15 -b106 -R106 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 100 - -n1000 -s30 -S30.2 -e15 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 350 - -n1000 -s30 -S30.2 -e25 -b106 -R106 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer - true - caracal - nr_dlsim - 200 - -n1000 -s30 -S30.2 -e25 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 300 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 150 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 350 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 250 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 400 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer - true - caracal - nr_dlsim - 400 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 400 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 200 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 450 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 500 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 500 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers - true - caracal - nr_dlsim - 500 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 400 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 200 - -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 400 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 300 - -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - - - Run_Physim - Run nr_dlsim with CPU: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 450 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P - - - - Run_Physim - Run nr_dlsim with T2 LDPC offload: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas - true - caracal - nr_dlsim - 450 - -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1 - - diff --git a/ci-scripts/xml_files/t2_offload_physim_enc_dec.xml b/ci-scripts/xml_files/t2_offload_physim_enc_dec.xml new file mode 100644 index 0000000000..73631a7a3c --- /dev/null +++ b/ci-scripts/xml_files/t2_offload_physim_enc_dec.xml @@ -0,0 +1,54 @@ + + + + test-t2-offload-enc-dec + Test T2 Offload + tasks + + 010204 + 111111 + 402010 + + + + + Custom_Command + Disable Sleep States + caracal + sudo cpupower idle-set -D 0 + + + + Custom_Command + true + Enable Sleep States + caracal + sudo cpupower idle-set -E + + + + Build_Deploy_Source_PhySim + Build and Deploy PhySim T2 Offload tests + caracal + -R 5g-offload -j1 + + diff --git a/ci-scripts/yaml_files/5g_sa_f1_b210_ho/docker-compose.yml b/ci-scripts/yaml_files/5g_sa_f1_b210_ho/docker-compose.yml new file mode 100644 index 0000000000..aaf058a9f7 --- /dev/null +++ b/ci-scripts/yaml_files/5g_sa_f1_b210_ho/docker-compose.yml @@ -0,0 +1,90 @@ +services: + oai_cu: + image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} + container_name: oai-cu + cap_drop: + - ALL + ulimits: + core: -1 # for core dumps + environment: + USE_ADDITIONAL_OPTIONS: --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci --sa + --log_config.global_log_options level,nocolor,utc_time,line_num,function + volumes: + - ../../conf_files/gnb-cu.sa.f1.ho.conf:/opt/oai-gnb/etc/gnb.conf + - ../../conf_files/neighbour-config-ho.conf:/opt/oai-gnb/etc/neighbour-config-ho.conf + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" + #entrypoint: /bin/bash -c "sleep infinity" + healthcheck: + # pgrep does NOT work + test: /bin/bash -c "ps aux | grep -v grep | grep -c softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_du0: + image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} + container_name: oai-du0 + cap_drop: + - ALL + cap_add: + - SYS_NICE + - IPC_LOCK + ulimits: + core: -1 # for core dumps + environment: + USE_B2XX: 'yes' + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=30AD30F --sa + --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci + --log_config.global_log_options level,nocolor,utc_time,line_num,function + devices: + - /dev/bus/usb/:/dev/bus/usb/ + volumes: + - ../../conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci0.conf:/opt/oai-gnb/etc/gnb.conf + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" + #entrypoint: /bin/bash -c "sleep infinity" + healthcheck: + # pgrep does NOT work + test: /bin/bash -c "ps aux | grep -v grep | grep -c softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai_du1: + image: ${REGISTRY:-oaisoftwarealliance}/${GNB_IMG:-oai-gnb}:${TAG:-develop} + container_name: oai-du1 + cap_drop: + - ALL + cap_add: + - SYS_NICE + - IPC_LOCK + ulimits: + core: -1 # for core dumps + environment: + USE_B2XX: 'yes' + USE_ADDITIONAL_OPTIONS: --RUs.[0].sdr_addrs serial=31F8010 --sa + --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci + --log_config.global_log_options level,nocolor,utc_time,line_num,function + devices: + - /dev/bus/usb/:/dev/bus/usb/ + volumes: + - ../../conf_files/gnb-du.sa.band78.51prb.usrpb210.ho-pci1.conf:/opt/oai-gnb/etc/gnb.conf + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" + #entrypoint: /bin/bash -c "sleep infinity" + healthcheck: + # pgrep does NOT work + test: /bin/bash -c "ps aux | grep -v grep | grep -c softmodem" + interval: 10s + timeout: 5s + retries: 5 diff --git a/ci-scripts/yaml_files/sa_gnb_aerial/docker-compose.yaml b/ci-scripts/yaml_files/sa_gnb_aerial/docker-compose.yaml index efc4d15b72..a5cf02cc40 100644 --- a/ci-scripts/yaml_files/sa_gnb_aerial/docker-compose.yaml +++ b/ci-scripts/yaml_files/sa_gnb_aerial/docker-compose.yaml @@ -23,7 +23,7 @@ services: - ../../../cmake_targets/share:/opt/cuBB/share userns_mode: host ipc: "shareable" - image: cubb-build:25-2 + image: cubb-build:25-2-srs environment: - cuBB_SDK=/opt/nvidia/cuBB command: bash -c "sudo rm -rf /tmp/phy.log && sudo chmod +x /opt/nvidia/cuBB/aerial_l1_entrypoint.sh && /opt/nvidia/cuBB/aerial_l1_entrypoint.sh" diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 9bb1b85f7d..cfe05042ce 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -300,12 +300,16 @@ configmodule_interface_t *load_configmodule(int argc, cfgmode = strdup(CONFIG_LIBCONFIGFILE); } } - static configmodule_interface_t *cfgptr; + static configmodule_interface_t *cfgptr = NULL; if (cfgptr) fprintf(stderr, "ERROR: Call load_configmodule more than one time\n"); // The macros are not thread safe print_params and similar cfgptr = calloc(sizeof(configmodule_interface_t), 1); + if (!cfgptr) { + fprintf(stderr, "ERROR: cannot allocate a memory for configuration\n"); + return NULL; + } /* argv_info is used to memorize command line options which have been recognized */ /* and to detect unrecognized command line options which might have been specified */ cfgptr->argv_info = calloc(sizeof(int32_t), argc+10); diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 1d1a5be410..03b67506bc 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -375,32 +375,32 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex) char *val; switch (var[varindex].vartype) { case TELNET_VARTYPE_INT32: - val = malloc(64); + val = calloc_or_fail(1, 64); snprintf(val, 64, "%i", *(int32_t *)(var[varindex].varvalptr)); break; case TELNET_VARTYPE_INT64: - val = malloc(128); + val = calloc_or_fail(1, 128); snprintf(val, 128, "%lli", (long long)*(int64_t *)(var[varindex].varvalptr)); break; case TELNET_VARTYPE_INT16: - val = malloc(16); + val = calloc_or_fail(1, 16); snprintf(val, 16, "%hi", *(short *)(var[varindex].varvalptr)); break; case TELNET_VARTYPE_INT8: - val = malloc(16); + val = calloc_or_fail(1, 16); snprintf(val, 16, "%i", (int)(*(int8_t *)(var[varindex].varvalptr))); break; case TELNET_VARTYPE_UINT: - val = malloc(64); + val = calloc_or_fail(1, 64); snprintf(val, 64, "%u", *(unsigned int *)(var[varindex].varvalptr)); break; case TELNET_VARTYPE_DOUBLE: - val = malloc(32); + val = calloc_or_fail(1, 32); snprintf(val, 32, "%g\n", *(double *)(var[varindex].varvalptr)); break; @@ -409,7 +409,7 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex) break; default: - val = malloc(64); + val = calloc_or_fail(1, 64); snprintf(val, 64, "ERR:var %i unknown type", varindex); break; } @@ -927,7 +927,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde for (int j = 0; cmd[j].cmdfunc != NULL; j++) { if (cmd[j].cmdflags & TELNETSRV_CMDFLAG_PUSHINTPOOLQ) { if (afifo == NULL) { - afifo = malloc(sizeof(notifiedFIFO_t)); + afifo = calloc_or_fail(1, sizeof(notifiedFIFO_t)); initNotifiedFIFO(afifo); } cmd[j].qptr = afifo; @@ -956,8 +956,8 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers } int telnetsrv_getfarray(loader_shlibfunc_t **farray) { - int const num_func_tln_srv = 3; - *farray = malloc(sizeof(loader_shlibfunc_t) * num_func_tln_srv); + int const num_func_tln_srv = 3; + *farray = calloc_or_fail(num_func_tln_srv, sizeof(loader_shlibfunc_t)); (*farray)[0].fname=TELNET_ADDCMD_FNAME; (*farray)[0].fptr=(int (*)(void) )add_telnetcmd; (*farray)[1].fname=TELNET_POLLCMDQ_FNAME; diff --git a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c index 82f791cd2a..6f2d1c7516 100644 --- a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c +++ b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c @@ -86,7 +86,7 @@ int get_measurgroups(telnet_measurgroupdef_t **measurgroups) { void measurcmd_display_phycpu(telnet_printfunc_t prnt) { PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0]; - telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE]; + telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE] = {}; for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) { sprintf(cpumeasur[i].statname, "%s", UE->phy_cpu_stats.cpu_time_stats[i].meas_name); cpumeasur[i].astatptr = &UE->phy_cpu_stats.cpu_time_stats[i]; diff --git a/common/utils/telnetsrv/telnetsrv_enb_measurements.c b/common/utils/telnetsrv/telnetsrv_enb_measurements.c index b8898b665e..7bd18c802b 100644 --- a/common/utils/telnetsrv/telnetsrv_enb_measurements.c +++ b/common/utils/telnetsrv/telnetsrv_enb_measurements.c @@ -160,7 +160,7 @@ void measurcmd_display_rlcstats(telnet_printfunc_t prnt) { UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info); telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE; int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t ); - unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int)); + unsigned int *rlcstats = calloc_or_fail(num_rlcmeasure,sizeof(unsigned int)); eNB_MAC_INST *eNB = RC.mac[eNB_id]; for(int i=0; i -80dBm you should have full DL throughput. <-95 dBm, you are very limited in terms of connectivity. +* `SINR` (`40.0`): measured signal to interference and noise ratio of the SSB + received at the UE. Maximum value that can be reported by the UE is 40.0 dB. The second and third line reflect channel state information (CSI) as reported by the UE, and only appear if CSI-RS/SRS are enabled and _received_ @@ -402,3 +404,13 @@ pattern2: { nrofUplinkSymbols2 = 0; }; ``` + +#### UL-heavy TDD patterns + +"UL-heavy TDD patterns", i.e., TDD patterns that have many UL slots are +supported. Examples for such patterns would be DSUUU or DDDSUUUUUU. + +Note that you should increase the aggregation level candidates as described in +[the corresponding section above](#pdcch-aggregation-level). This is because the +scheduler has to schedule multiple DCIs in a single DL slots for multiple UL +slots. As a suggestion, you could try `uess_agg_levels = [4, 2, 2, 0, 0]`. diff --git a/doc/RUN_NR_multiple_BWPs.md b/doc/RUN_NR_multiple_BWPs.md index 7b79374fd7..e8598a0445 100644 --- a/doc/RUN_NR_multiple_BWPs.md +++ b/doc/RUN_NR_multiple_BWPs.md @@ -17,35 +17,28 @@ A UE can be configured with a set of 4 BWPs in uplink (UL) and downlink (DL) dir A maximum of 4 dedicated BWPs can be configured for a UE. -To configure multiple BWPs, add the following parameters to the gNB configuration file under "servingCellConfigDedicated": +To configure multiple BWPs, add the following parameters in the physical parameters section: ## Setup of the Configuration files ## + +In the configuration file you have the option to select the 1st active BWP, the RIV and SCS of each BWP in the following way (example with 3 additional BWPs): ``` - firstActiveDownlinkBWP-Id = 1; #BWP-Id - defaultDownlinkBWP-Id = 1; #BWP-Id - firstActiveUplinkBWP-Id = 1; #BWP-Id + first_active_bwp = 1; + bwp_list = ({ scs = 1; bwpStart = 0; bwpSize = 106;}, + { scs = 1; bwpStart = 0; bwpSize = 51;}, + { scs = 1; bwpStart = 0; bwpSize = 24;}); ``` -Each dedicated BWP must have: -``` - # BWP 1 Configuration - dl_bwp-Id_1 = 1; - dl_bwp1_locationAndBandwidth = 28875; // RBstart=0, L=106 (40 MHz BW) - # subcarrierSpacing - # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_bwp1_subcarrierSpacing = 1; -``` - - Find these parameters in this configuration file: "targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf" +This example configures 3 additional BWPs, with IDs from 1 to 3. Find these parameters in this configuration file: "ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf" # Testing gNB and UE in RF simulator ## gNB command: ``` - sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim + sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.neighbour.conf --rfsim --rfsimulator.serveraddr server ``` ## UE command: ``` - sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --uicc0.imsi 208990000000001 --rfsimulator.serveraddr 127.0.0.1 + sudo ./nr-uesoftmodem -C 3319680000 -r 106 --numerology 1 --ssb 516 --band 78 --rfsim --rfsimulator.serveraddr 127.0.0.1 ``` diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index f6a77c2d09..d7881fb993 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -172,10 +172,17 @@ information on how the images are built. ~4G-LTE ~5G-NR - nepes + B200 (eNB), ofqot + B200 (gNB), idefix + Quectel, nepes w/ ltebox - basic NSA test -- [RAN-PhySim-Cluster](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster/) - ~4G-LTE ~5G-NR ~nrUE - - cluster (`RAN_OC` resource), tests in OpenShift Cluster - - unitary simulators (`nr_dlsim`, etc.) +- [RAN-PhySim-Cluster-4G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-4G/) + ~4G-LTE + - tests 4G physical simulators (`nr_dlsim`, etc.) in OpenShift Cluster (x86) + - see [`./physical-simulators.md`](./physical-simulators.md) for an overview +- [RAN-PhySim-Cluster-5G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-5G/) + ~5G-NR ~nrUE + - tests 5G physical simulators (`nr_dlsim`, etc.) in OpenShift Cluster (x86) + - see [`./physical-simulators.md`](./physical-simulators.md) for an overview +- [RAN-PhySim-GraceHopper-5G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-GraceHopper-5G/) + ~5G-NR ~nrUE + - tests 5G physical simulators (`nr_dlsim`, etc.) on Nvidia GraceHopper (ARMv9) - see [`./physical-simulators.md`](./physical-simulators.md) for an overview - [RAN-RF-Sim-Test-4G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-4G/) ~4G-LTE diff --git a/doc/physical-simulators.md b/doc/physical-simulators.md index 662daa2a95..b74531fd20 100644 --- a/doc/physical-simulators.md +++ b/doc/physical-simulators.md @@ -18,6 +18,13 @@ Physims are essential for: * Regression testing * Ensuring correctness before merging new contributions into the repository +These tests are run automatically as part of the following +pipelines: + +- [RAN-PhySim-Cluster-4G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-4G/) +- [RAN-PhySim-Cluster-5G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-5G/) +- [RAN-PhySim-GraceHopper-5G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-GraceHopper-5G/) + ## Examples of Simulators | Technology | Simulators | Description | @@ -31,7 +38,7 @@ Physims are essential for: | | `nr_psbchsim` | Sidelink simulation | | Coding | `ldpctest`, `polartest`, `smallblocktest` | LDPC, Polar, and other FEC tests | -### Source Locations +## Source Locations * 4G PHY simulators: `openair1/SIMULATION/LTE_PHY/` * 5G PHY simulators: `openair1/SIMULATION/NR_PHY/` @@ -48,6 +55,9 @@ openair1/SIMULATION/NR_PHY/dlsim.c ## Option 1: Using CMake +Build the simulators and tests using the dedicated cmake option, then run +`ctest` which will run all registered tests. + ```bash cd openairinterface5g mkdir build && cd build @@ -67,9 +77,7 @@ cd ran_build/build ctest ``` -# `ctest` Usage Tips - -## Useful Options +## `ctest` Usage Tips Use the following options to customize test execution: @@ -84,50 +92,77 @@ Use the following options to customize test execution: For the complete list of `ctest` options, refer to the manual: -```bash -man ctest -``` + man ctest -## Example +For instance, to run only all run NR ULSCH simulator tests, with 4 jobs in +parallel, type -```bash -# Run only NR ULSCH simulator tests, in parallel -ctest -L nr_ulsch -j 4 -``` + ctest -L nr_ulschsim -j 4 # Adding a New Physim Test To define a new test or modify existing ones, update the following file: ``` -openair1/PHY/CODING/tests/CMakeLists.txt +openair1/SIMULATION/tests/CMakeLists.txt ``` -Use the `add_physim_test` macro with the following arguments: +## `add_physim_test()` -```cmake -add_physim_test( ) -``` +Use the `add_physim_test()` macro with the following arguments: -### Arguments: + add_physim_test( ) -* ``: Test generation (e.g., `4g` or `5g`) -* ``: Name of the test executable (e.g., `nr_prachsim`) -* ``: Description shown in `ctest` output, useful for categorization and indexing. -* ``: Label used for filtering tests (via `-L`), shown in the ctest output summary as a descriptive tag. -* ``: Command line options passed to the test +where: +- `` can be any name, but the canonical, historical format is to put + it `physim...test` where `` is 4g/5g, and `` + is an increasing number +- `` is a human-readable description of the test +- ` ` is the test invocation, where `` must + be a target built by OAI cmake (e.g., `nr_prachsim`), followed by any options. -### Example: +For instance, a PRACHsim looks like this: -```cmake -# add_physim_test( ) -add_physim_test(5g nr_prachsim test8 "15kHz SCS, 25 PRBs" -a -s -30 -n 300 -p 99 -R 25 -m 0) -``` + add_physim_test(physim.5g.nr_prachsim.test8 "15kHz SCS, 25 PRBs" nr_prachsim -a -s -30 -n 300 -p 99 -R 25 -m 0) -These tests are run automatically as part of the following -pipelines: [RAN-PhySim-Cluster-4G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-4G/) and [RAN-PhySim-Cluster-5G](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster-5G/) +## `add_timed_physim_test()` -### How to rerun failed CI tests using `ctest` +Use the `add_timed_physim_test()` macro to add a test the same way as with +`add_physim_test()` above. Additionally, it allows to check for thresholds with +`check_threshold()`: + + check_threshold( ) + +where: +- `` is any test that must have been added with + `add_timed_physim_test()` +- `` is a threshold to check for, e.g., `PHY tx proc`, and +- `` a condition to check, e.g. `< 200` + +There are two convenience functions to simplify the use of `check_threshold()`: + + check_threshold_range( LOWER UPPER ) + check_threshold_variance( AVG ABS_VAR ) + +where +- `` and `` are a lower and upper threshold, respectively, where + either one or both variables can be provided, and +- `` and `` are average and the variation in absolute numbers + (not a percentage!) can be provided. + +Both functions internally use `check_threshold()`. + +Thus upon execution of the test, the test will be run, but additionally ctest +will check for a match of `PHY tx proc ` (where ` is of format +`[0-9]+(\.[0-9]+)?`), and a matching number will be checked against condition +`< 200`. + +For instance, this could look like this: + + add_timed_physim_test(physim.5g.nr_dlsim.test3 "Some description" nr_dlsim -P) + check_physim_threshold(physim.5g.nr_dlsim.test3 "DLSCH encoding time" "< 50") + +# How to rerun failed CI tests using `ctest` Ctest automatically logs the failed tests in LastTestsFailed.log. This log is archived in the CI artifacts and can be reused locally to rerun only those failed tests. @@ -159,3 +194,11 @@ For legacy support or archival purposes, you can still find this implementation ```bash git checkout 2025.w18 ``` + +# Unmaintained tests + +A few tests dedicated to 4G are unmaintained: + +- `mbmssim` +- `scansim` +- all simulators of format `www-tmyyyy` (for instance, `dlsim_tm4`) diff --git a/docker/Dockerfile.phySim.rhel9 b/docker/Dockerfile.phySim.rhel9 index e9ccf68b00..c5faab2ec7 100644 --- a/docker/Dockerfile.phySim.rhel9 +++ b/docker/Dockerfile.phySim.rhel9 @@ -98,7 +98,7 @@ RUN ldconfig && \ WORKDIR /opt/oai-physim/ COPY --from=phy-sim-build \ - /oai-ran/cmake_targets/ran_build/build/openair1/PHY/CODING/tests/CTestTestfile.cmake \ + /oai-ran/cmake_targets/ran_build/build/openair1/SIMULATION/tests/CTestTestfile.cmake \ /opt/oai-physim/ #CMD ["sleep", "infinity"] diff --git a/executables/lte-enb.c b/executables/lte-enb.c index 39f72db86c..c86a916c7a 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -1229,7 +1229,8 @@ void init_eNB() LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id); LOG_I(PHY,"Initializing eNB %d CC_id %d\n",inst,CC_id); LOG_I(PHY,"Registering with MAC interface module\n"); - AssertFatal((eNB->if_inst = IF_Module_init(inst))!=NULL,"Cannot register interface"); + eNB->if_inst = IF_Module_init(inst); + AssertFatal(eNB->if_inst, "Cannot register interface"); eNB->if_inst->schedule_response = schedule_response; eNB->if_inst->PHY_config_req = phy_config_request; eNB->if_inst->PHY_config_update_sib2_req = phy_config_update_sib2_request; diff --git a/executables/lte-ru.c b/executables/lte-ru.c index eed5a90eb9..9c47c92a0d 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -2786,11 +2786,10 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL); RU_t **ru=NULL; if ( RUParamList.numelt > 0) { - ru = (RU_t **)malloc(nb_RU*sizeof(RU_t *)); + ru = malloc_or_fail(nb_RU * sizeof(RU_t *)); for (int j = 0; j < nb_RU; j++) { - ru[j] = (RU_t *)malloc(sizeof(RU_t)); - memset((void *)ru[j],0,sizeof(RU_t)); + ru[j] = calloc_or_fail(1,sizeof(RU_t)); ru[j]->idx = j; LOG_I(PHY,"Creating ru[%d]:%p\n", j, ru[j]); ru[j]->if_timing = synch_to_ext_device; diff --git a/nfapi/oai_integration/wls_integration/wls_pnf.c b/nfapi/oai_integration/wls_integration/wls_pnf.c index e02cef30a4..bed517ad01 100644 --- a/nfapi/oai_integration/wls_integration/wls_pnf.c +++ b/nfapi/oai_integration/wls_integration/wls_pnf.c @@ -77,7 +77,7 @@ int wls_fapi_nr_pnf_start() _this = (pnf_t *)(cfg); _this->terminate = 0; // Init PNF config - nfapi_pnf_phy_config_t *phy = (nfapi_pnf_phy_config_t *)malloc(sizeof(nfapi_pnf_phy_config_t)); + nfapi_pnf_phy_config_t *phy = malloc_or_fail(sizeof(nfapi_pnf_phy_config_t)); memset(phy, 0, sizeof(nfapi_pnf_phy_config_t)); phy->state = NFAPI_PNF_PHY_IDLE; diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p7.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p7.c index befd2c9dd3..aa90d3b4b9 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p7.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p7.c @@ -708,7 +708,7 @@ static uint8_t pack_nr_rx_beamforming_pdu(const nfapi_nr_ul_beamforming_t *beamf uint8_t **ppWritePackedMsg, uint8_t *end) { // Pack RX Beamforming PDU - if (!(push16(beamforming_pdu->num_prgs, ppWritePackedMsg, end) + if (!(push8(beamforming_pdu->trp_scheme, ppWritePackedMsg, end) && push16(beamforming_pdu->num_prgs, ppWritePackedMsg, end) && push16(beamforming_pdu->prg_size, ppWritePackedMsg, end) && push8(beamforming_pdu->dig_bf_interface, ppWritePackedMsg, end))) { return 0; @@ -1033,7 +1033,7 @@ uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, static uint8_t unpack_nr_rx_beamforming_pdu(nfapi_nr_ul_beamforming_t *beamforming_pdu, uint8_t **ppReadPackedMsg, uint8_t *end) { // Unpack RX Beamforming PDU - if (!(pull16(ppReadPackedMsg, &beamforming_pdu->num_prgs, end) + if (!(pull8(ppReadPackedMsg, &beamforming_pdu->trp_scheme, end) && pull16(ppReadPackedMsg, &beamforming_pdu->num_prgs, end) && pull16(ppReadPackedMsg, &beamforming_pdu->prg_size, end) && pull8(ppReadPackedMsg, &beamforming_pdu->dig_bf_interface, end))) { return 0; diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p7_utils.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p7_utils.c index 0a858e0be9..fb645707ad 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p7_utils.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p7_utils.c @@ -214,7 +214,7 @@ bool eq_dl_tti_request(const nfapi_nr_dl_tti_request_t *a, const nfapi_nr_dl_tti static bool eq_ul_tti_beamforming(const nfapi_nr_ul_beamforming_t *a, const nfapi_nr_ul_beamforming_t *b) { - // EQ(a->trp_scheme, b->trp_scheme); + EQ(a->trp_scheme, b->trp_scheme); EQ(a->num_prgs, b->num_prgs); EQ(a->prg_size, b->prg_size); EQ(a->dig_bf_interface, b->dig_bf_interface); @@ -1174,7 +1174,7 @@ void copy_dl_tti_request(const nfapi_nr_dl_tti_request_t *src, nfapi_nr_dl_tti_r static void copy_ul_tti_beamforming(const nfapi_nr_ul_beamforming_t *src, nfapi_nr_ul_beamforming_t *dst) { - // dst->trp_scheme = src->trp_scheme; + dst->trp_scheme = src->trp_scheme; dst->num_prgs = src->num_prgs; dst->prg_size = src->prg_size; dst->dig_bf_interface = src->dig_bf_interface; @@ -2201,7 +2201,7 @@ void dump_dl_tti_request(const nfapi_nr_dl_tti_request_t *msg) static void dump_ul_tti_beamforming(const nfapi_nr_ul_beamforming_t *pdu, int depth) { - // INDENTED_PRINTF("TRP Scheme = %d\n", pdu->trp_scheme); + INDENTED_PRINTF("TRP Scheme = %d\n", pdu->trp_scheme); INDENTED_PRINTF("numPRGs = %d\n", pdu->num_prgs); INDENTED_PRINTF("prgSize = %d\n", pdu->prg_size); INDENTED_PRINTF("digBFInterface = %d\n", pdu->dig_bf_interface); 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 f186352b6d..a7e6b43af6 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 @@ -1219,7 +1219,7 @@ typedef struct typedef struct { - // uint8_t trp_scheme; // This field shall be set to 0, to identify that this table is used. Not part of FAPI 10.02, thus removed + uint8_t trp_scheme; // This field shall be set to 0, to identify that this table is used. uint16_t num_prgs; // Number of PRGs spanning this allocation. Value : 1->275 uint16_t prg_size; // Size in RBs of a precoding resource block group (PRG) – to which the same digital beamforming gets applied. Value: 1->275 uint8_t dig_bf_interface; // Number of logical antenna ports (parallel streams) resulting from the Rx combining. Value: 0->255 diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 1c851ce277..f9009e4a77 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -202,20 +202,16 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) nfapi_pnf_phy_config_delete_all(&pnf->_public); // create the phy records - if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) - { - int i = 0; - for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) - { - nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t)); - memset(phy, 0, sizeof(nfapi_pnf_phy_config_t)); + if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) { + for(int i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) { + nfapi_pnf_phy_config_t* phy = calloc_or_fail(1,sizeof(nfapi_pnf_phy_config_t)); - phy->state = NFAPI_PNF_PHY_IDLE; - phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; + phy->state = NFAPI_PNF_PHY_IDLE; + phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; - nfapi_pnf_phy_config_add(&(pnf->_public), phy); - } - } + nfapi_pnf_phy_config_add(&(pnf->_public), phy); + } + } if(pnf->_public.pnf_config_req) { @@ -269,19 +265,13 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen nfapi_pnf_phy_config_delete_all(&pnf->_public); // create the phy records - if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) - { - int i = 0; - for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) - { - nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t)); - memset(phy, 0, sizeof(nfapi_pnf_phy_config_t)); - - phy->state = NFAPI_PNF_PHY_IDLE; - phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; - - nfapi_pnf_phy_config_add(&(pnf->_public), phy); - } + if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) { + for(int i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) { + nfapi_pnf_phy_config_t* phy = calloc_or_fail(1,sizeof(nfapi_pnf_phy_config_t)); + phy->state = NFAPI_PNF_PHY_IDLE; + phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; + nfapi_pnf_phy_config_add(&(pnf->_public), phy); + } } if(pnf->_public.pnf_nr_config_req) @@ -2024,21 +2014,19 @@ int pnf_read_dispatch_message(pnf_t* pnf) // now have the size of the mesage } - if(message_size > stack_buffer_size) - { - dynamic_buffer = (uint8_t*)malloc(message_size); + if(message_size > stack_buffer_size) { + dynamic_buffer = malloc_or_fail(message_size); - if(dynamic_buffer == NULL) - { - // todo : add error mesage - NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size); - return -1; - } + if (dynamic_buffer == NULL) { + // todo : add error mesage + NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size); + return -1; + } - read_buffer = dynamic_buffer; - } + read_buffer = dynamic_buffer; + } - { + { int flags = 0; (void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo)); diff --git a/nfapi/tests/p7/nr_fapi_ul_tti_request_test.c b/nfapi/tests/p7/nr_fapi_ul_tti_request_test.c index 90b1625a7e..f7087c92ef 100644 --- a/nfapi/tests/p7/nr_fapi_ul_tti_request_test.c +++ b/nfapi/tests/p7/nr_fapi_ul_tti_request_test.c @@ -24,7 +24,7 @@ static void fill_ul_tti_request_beamforming(nfapi_nr_ul_beamforming_t *beamforming_pdu) { - // beamforming_pdu->trp_scheme = rand8(); // not part of 10.02 + beamforming_pdu->trp_scheme = rand8(); beamforming_pdu->num_prgs = rand16_range(1, NFAPI_MAX_NUM_PRGS); beamforming_pdu->prg_size = rand16_range(1, 275); beamforming_pdu->dig_bf_interface = rand8_range(1,NFAPI_MAX_NUM_BG_IF); diff --git a/openair1/CMakeLists.txt b/openair1/CMakeLists.txt index 1ce6debaf1..123d723342 100644 --- a/openair1/CMakeLists.txt +++ b/openair1/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(PHY) +add_subdirectory(SIMULATION) diff --git a/openair1/PHY/CODING/3gpplte.c b/openair1/PHY/CODING/3gpplte.c index 49740487ac..3502a1ad56 100644 --- a/openair1/PHY/CODING/3gpplte.c +++ b/openair1/PHY/CODING/3gpplte.c @@ -450,7 +450,7 @@ t_interleaver_codebook *f1f2mat; short *il_tb; __attribute__((constructor)) static void init_interleaver(void) { int totSize=0; - f1f2mat=(t_interleaver_codebook*) malloc(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2)); + f1f2mat = malloc_or_fail(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2)); for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) { f1f2mat[i].nb_bits=f1f2[i].nb_bits; f1f2mat[i].f1=f1f2[i].f1; @@ -458,7 +458,7 @@ __attribute__((constructor)) static void init_interleaver(void) { f1f2mat[i].beg_index=totSize; totSize+=f1f2mat[i].nb_bits; } - il_tb=(short*)malloc(sizeof(*il_tb)*totSize); + il_tb = malloc_or_fail(sizeof(*il_tb) * totSize); int idx=0; for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) for (uint64_t j=0; j> 4), simde_mm_extract_epi8(beta_ptr[0], 0), simde_mm_extract_epi8(beta_ptr[0], 1), @@ -1403,7 +1403,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[0], 13), simde_mm_extract_epi8(beta_ptr[0], 14), simde_mm_extract_epi8(beta_ptr[0], 15)); - printf("beta1 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta1 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[1], 0), simde_mm_extract_epi8(beta_ptr[1], 1), @@ -1421,7 +1421,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[1], 13), simde_mm_extract_epi8(beta_ptr[1], 14), simde_mm_extract_epi8(beta_ptr[1], 15)); - printf("beta2 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta2 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[2], 0), simde_mm_extract_epi8(beta_ptr[2], 1), @@ -1439,7 +1439,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[2], 13), simde_mm_extract_epi8(beta_ptr[2], 14), simde_mm_extract_epi8(beta_ptr[2], 15)); - printf("beta3 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta3 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[3], 0), simde_mm_extract_epi8(beta_ptr[3], 1), @@ -1457,7 +1457,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[3], 13), simde_mm_extract_epi8(beta_ptr[3], 14), simde_mm_extract_epi8(beta_ptr[3], 15)); - printf("beta4 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta4 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[4], 0), simde_mm_extract_epi8(beta_ptr[4], 1), @@ -1475,7 +1475,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[4], 13), simde_mm_extract_epi8(beta_ptr[4], 14), simde_mm_extract_epi8(beta_ptr[4], 15)); - printf("beta5 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta5 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[5], 0), simde_mm_extract_epi8(beta_ptr[5], 1), @@ -1493,7 +1493,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[5], 13), simde_mm_extract_epi8(beta_ptr[5], 14), simde_mm_extract_epi8(beta_ptr[5], 15)); - printf("beta6 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta6 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[6], 0), simde_mm_extract_epi8(beta_ptr[6], 1), @@ -1511,7 +1511,7 @@ void compute_beta(llr_t *alpha,llr_t *beta,llr_t *m_11,llr_t *m_10,unsigned shor simde_mm_extract_epi8(beta_ptr[6], 13), simde_mm_extract_epi8(beta_ptr[6], 14), simde_mm_extract_epi8(beta_ptr[6], 15)); - printf("beta7 %u: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", + printf("beta7 %d: %03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\n", (frame_length >> 4), simde_mm_extract_epi8(beta_ptr[7], 0), simde_mm_extract_epi8(beta_ptr[7], 1), diff --git a/openair1/PHY/CODING/CMakeLists.txt b/openair1/PHY/CODING/CMakeLists.txt index 5b7508fc29..7e07f8f2dc 100644 --- a/openair1/PHY/CODING/CMakeLists.txt +++ b/openair1/PHY/CODING/CMakeLists.txt @@ -68,7 +68,3 @@ if (ENABLE_LDPC_CUDA) endif() add_subdirectory(nrLDPC_coding) - -if(ENABLE_PHYSIM_TESTS) - add_subdirectory(tests) -endif() diff --git a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c index 815ec9ce26..31ca0b387b 100644 --- a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c +++ b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c @@ -1079,7 +1079,6 @@ int32_t nrLDPC_coding_init() "could not find mandatory --nrLDPC_coding_aal.dpdk_dev. If you used --nrLDPC_coding_t2.*, please rename all options to " "--nrLDPC_coding_aal.*\n"); AssertFatal(dpdk_dev != NULL, "nrLDPC_coding_aal.dpdk_dev was not provided"); - AssertFatal(dpdk_core_list != NULL, "nrLDPC_coding_aal.dpdk_core_list was not provided"); char dpdk_dev_full[32]; if (normalize_dpdk_dev(dpdk_dev, dpdk_dev_full, sizeof(dpdk_dev_full)) != 0) { @@ -1087,20 +1086,30 @@ int32_t nrLDPC_coding_init() return -1; } - int argc = 7; - char *argv[11] = {"bbdev", "-l", dpdk_core_list, "-a", dpdk_dev_full, "--file-prefix", dpdk_file_prefix, "--", "--", "--", "--"}; - if (vfio_vf_token != NULL) { - argc += 2; - argv[7] = "--vfio-vf-token"; - argv[8] = vfio_vf_token; - } - ret = rte_eal_init(argc, argv); - if (ret < 0) { - LOG_W(NR_PHY, "EAL initialization failed, probing DPDK device %s\n", dpdk_dev_full); - if (rte_dev_probe(dpdk_dev_full) != 0) { - LOG_E(NR_PHY, "bbdev %s not found\n", dpdk_dev_full); + // Detect if EAL was initialized by probing the device + LOG_I(NR_PHY, "Probing DPDK device %s to know if EAL is initialized. This may generate EAL error messages\n", dpdk_dev_full); + if (rte_dev_probe(dpdk_dev_full) != 0) { + LOG_I(NR_PHY, "Probing DPDK device %s failed, initializing EAL before continuing\n", dpdk_dev_full); + // EAL was not initialized yet + // We initialize EAL + AssertFatal(dpdk_core_list != NULL, "nrLDPC_coding_aal.dpdk_core_list was not provided"); + + int argc = 7; + char *argv[11] = + {"bbdev", "-l", dpdk_core_list, "-a", dpdk_dev_full, "--file-prefix", dpdk_file_prefix, "--", "--", "--", "--"}; + if (vfio_vf_token != NULL) { + argc += 2; + argv[7] = "--vfio-vf-token"; + argv[8] = vfio_vf_token; + } + ret = rte_eal_init(argc, argv); + if (ret < 0) { + LOG_E(NR_PHY, "EAL initialization failed\n"); return (-1); } + } else { + // EAL was already initialized + LOG_I(NR_PHY, "Probing DPDK device %s succeeded, skipping EAL initialization\n", dpdk_dev_full); } uint16_t nb_bbdevs = rte_bbdev_count(); AssertFatal(nb_bbdevs > 0, "no bbdev found"); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c index 1908aa654c..58764151c4 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c @@ -30,7 +30,7 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits) uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize]; uint8_t **crc_generator_matrix = - malloc(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t)); + malloc_or_fail(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t)); if (crc_generator_matrix) for (int i = 0; i < payloadSizeBits; i++) crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize; diff --git a/openair1/PHY/CODING/tests/CMakeLists.txt b/openair1/PHY/CODING/tests/CMakeLists.txt deleted file mode 100644 index 2f8f88d547..0000000000 --- a/openair1/PHY/CODING/tests/CMakeLists.txt +++ /dev/null @@ -1,265 +0,0 @@ -# Define a macro to add tests for different physical simulators -macro(add_physim_test test_gen test_exec test_description test_label) - # catch all the arguments past the last expected arqument and store them in the options_list - set(options_list ${ARGN}) - set(test_name physim.${test_gen}.${test_exec}.${test_description}) - add_test( - NAME ${test_name} - COMMAND ${test_exec} ${options_list} - COMMAND_EXPAND_LISTS - ) - set_tests_properties(${test_name} PROPERTIES - LABELS "${test_exec}: ${test_label};${test_exec}" - ENVIRONMENT "LD_LIBRARY_PATH=." - ) - add_dependencies(tests ${test_exec}) -endmacro() - -#################################################################################### -###### dlsim unit test ###### -#################################################################################### - -add_physim_test(4g dlsim basic.test1 "10 MHz, R2.FDD (MCS 5), EVA5, -1dB" -m=5 -g=F -s=-1 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim basic.test2 "1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)" -m=4 -g=F -s=0 -w=1.0 -f=.2 -n=1500 -B=6 -c=4 -z=2 -Tperf=60) -add_physim_test(4g dlsim basic.test3 "10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)" -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim basic.test4 "5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)" -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=1500 -B=25 -c=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim basic.test5 "10 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)" -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=25) -add_physim_test(4g dlsim basic.test6 "5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)" -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=1500 -B=25 -c=2 -z=2 -Tperf=25) -add_physim_test(4g dlsim basic.test7 "5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)" -m=25 -g=F -s=17.4 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -z=2 -Tperf=60) -add_physim_test(4g dlsim basic.test8 "5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)" -m=25 -g=F -s=17.5 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -z=2 -r=1022 -Tperf=60) -add_physim_test(4g dlsim basic.test9 "10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)" -m=26 -g=F -s=17.7 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim 100rb.tm2.test1 "20 MHz, R.9 FDD (MCS 26), EVA5, 17.6dB (70%)" -m=26 -g=F -s=17.6 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim 100rb.tm2.test2 "20 MHz, R.9-2 FDD (MCS 26, 17PRB), EVA5, 17.3dB (70%)" -m=26 -g=F -s=17.3 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -r=1600 -Tperf=60) -add_physim_test(4g dlsim 100rb.tm2.test3 "20 MHz, R.9-1 FDD (MCS 26, 83 PRB), EVA5, 16.6dB (70%)" -m=26 -g=F -s=16.6 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -r=1899 -Tperf=60) -add_physim_test(4g dlsim 100rb.tm2.test4 "10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)" -m=14 -g=F -s=6.8 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -x=2 -y=2 -z=2 -Tperf=60) -add_physim_test(4g dlsim 100rb.tm2.test5 "5 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)" -m=13 -g=F -s=5.9 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -x=2 -y=2 -z=2 -Tperf=60) - -#################################################################################### -###### ulsim unit test ###### -#################################################################################### - -add_physim_test(4g ulsim test1 "5 MHz, FDD (MCS 5), AWGN, 6dB" -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) -add_physim_test(4g ulsim test2 "5 MHz, FDD (MCS 16), AWGN , 12dB (70%)" -BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) -add_physim_test(4g ulsim test3 "10 MHz, R3.FDD (MCS 5), AWGN, 6dB (70%)" -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) -add_physim_test(4g ulsim test4 "10 MHz, R3-1.FDD (MCS 16), AWGN, 12dB (70%)" -BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) -add_physim_test(4g ulsim test5 "20 MHz, FDD (MCS 5), AWGN, 6dB (70%)" -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) -add_physim_test(4g ulsim test6 "20 MHz, FDD (MCS 16), AWGN, 12 dB (70%)" -BnbRBs=100 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) - -#################################################################################### -###### ldpctest unit test ###### -#################################################################################### - -add_physim_test(5g ldpctest test1 "block length = 3872, BG1" -l3872 -s10 -n300) -add_physim_test(5g ldpctest test2 "block length = 4224, BG1" -l4224 -s10 -n300) -add_physim_test(5g ldpctest test3 "block length = 4576, BG1" -l4576 -s10 -n300) -add_physim_test(5g ldpctest test4 "block length = 4928, BG1" -l4928 -s10 -n300) -add_physim_test(5g ldpctest test5 "block length = 5280, BG1" -l5280 -s10 -n300) -add_physim_test(5g ldpctest test6 "block length = 5632, BG1" -l5632 -s10 -n300) -add_physim_test(5g ldpctest test7 "block length = 6336, BG1" -l6336 -s10 -n300) -add_physim_test(5g ldpctest test8 "block length = 7040, BG1" -l7040 -s10 -n300) -add_physim_test(5g ldpctest test9 "block length = 7744, BG1" -l7744 -s10 -n300) -add_physim_test(5g ldpctest test10 "block length = 8448, BG1" -l8448 -s10 -n300) -add_physim_test(5g ldpctest test11 "block length = 1, BG2" -l1 -s10 -n300) -add_physim_test(5g ldpctest test12 "block length = 100, BG2" -l100 -s10 -n300) -add_physim_test(5g ldpctest test13 "block length = 193, BG2" -l193 -s10 -n300) -add_physim_test(5g ldpctest test14 "block length = 500, BG2" -l500 -s10 -n300) -add_physim_test(5g ldpctest test15 "block length = 561, BG2" -l561 -s10 -n300) -add_physim_test(5g ldpctest test16 "block length = 600, BG2" -l600 -s10 -n300) -add_physim_test(5g ldpctest test17 "block length = 641, BG2" -l641 -s10 -n300) -add_physim_test(5g ldpctest test18 "block length = 2000, BG1" -l2000 -s10 -n300) -add_physim_test(5g ldpctest test19 "block length = 3000, BG1" -l3000 -s10 -n300) -add_physim_test(5g ldpctest test20 "block length = 3840, BG1" -l3840 -s10 -n300) - -#################################################################################### -###### polartest unit test ###### -#################################################################################### - -add_physim_test(5g polartest test1 "PBCH polar test" -q -s-10 -f0) -add_physim_test(5g polartest test2 "DCI polar test" -q -s-10 -f0 -m1) -add_physim_test(5g polartest test3 "UCI polar test,6-bit CRC" -q -s-2 -f2 -m2 -k12) -add_physim_test(5g polartest test4 "UCI polar test,11-bit CRC" -q -s-2 -f2 -m2 -k20) - -#################################################################################### -###### nr_pbchsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_pbchsim 106rb.test1 "PBCH-only, 106 PRB, NID 2" -s-11 -S-8 -n30 -R106 -N2) -add_physim_test(5g nr_pbchsim 106rb.test2 "PBCH and synchronization, 106PBR" -s-11 -S-8 -n30 -o8000 -I -R106) -add_physim_test(5g nr_pbchsim 106rb.test3 "PBCH and synchronization, 106PBR, SSB SC OFFSET 6" -s-11 -S-8 -n30 -R106 -c6) -add_physim_test(5g nr_pbchsim 217rb.test1 "PBCH-only, 217 PRB" -s-10 -S-8 -n30 -R217) -add_physim_test(5g nr_pbchsim 217rb.test2 "PBCH and synchronization, 217 RPB" -s-10 -S-8 -n30 -o8000 -I -R217) -add_physim_test(5g nr_pbchsim 273rb.test1 "PBCH-only, 273 PRB" -s-10 -S-8 -n30 -R273) -add_physim_test(5g nr_pbchsim 273rb.test2 "PBCH and synchronization, 273 PRB" -s-10 -S-8 -n30 -o8000 -I -R273) -add_physim_test(5g nr_pbchsim otherSCS.test1 "PBCH-only, 15Khz, 5Mhz" -s-10 -S-8 -n30 -m0 -R25) -add_physim_test(5g nr_pbchsim otherSCS.test2 "PBCH-only, 120Khz, 50Mhz" -s-10 -S-8 -n30 -m3 -R32) - -#################################################################################### -###### nr_dlsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_dlsim basic.test1 "106 PRB" -n300 -R106 -b106 -s5) -add_physim_test(5g nr_dlsim basic.test2 "217 PRB" -n300 -R217 -b217 -s5) -add_physim_test(5g nr_dlsim basic.test3 "273 PRB" -n300 -R273 -b273 -s5) -add_physim_test(5g nr_dlsim basic.test4 "HARQ test 25% TP 4 rounds" -n300 -s1 -S2 -t25) -add_physim_test(5g nr_dlsim basic.test5 "HARQ test 33% TP 3 rounds" -n300 -s1 -S2 -t33) -add_physim_test(5g nr_dlsim basic.test6 "HARQ test 50% TP 2 rounds" -n300 -s5 -S7 -t50) -add_physim_test(5g nr_dlsim basic.test7 "25 PRBs, 15 kHz SCS" -n300 -m0 -e0 -R25 -b25 -i 2 1 0) -add_physim_test(5g nr_dlsim basic.test8 "32 PRBs, 120 kHz SCS" -n300 -s5 -m3 -R32 -b32) -add_physim_test(5g nr_dlsim offset.test1 "106 PRB 25 PDSCH-Offset" -n300 -R106 -a25 -s5) -add_physim_test(5g nr_dlsim offset.test2 "106 PRB 51 PDSCH-Offset" -n300 -R106 -a51 -s5) -add_physim_test(5g nr_dlsim offset.test3 "217 PRB 100 PDSCH-PRBs" -n300 -R217 -b100 -s5) -add_physim_test(5g nr_dlsim offset.test4 "217 PRB 80 PDSCH-Offset" -n300 -R217 -a80 -s5) -add_physim_test(5g nr_dlsim offset.test5 "217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset" -n300 -R217 -a110 -s5 -b100) -add_physim_test(5g nr_dlsim mcs.mimo.test1 "106 PRBs 50 PDSCH-PRBs MCS Index 27" -n300 -e27 -s30) -add_physim_test(5g nr_dlsim mcs.mimo.test2 "106 PRBs 50 PDSCH-PRBs MCS Index 16" -n300 -e16 -s11 -S13) -add_physim_test(5g nr_dlsim mcs.mimo.test3 "106 MCS-TABLE 256 QAM MCS Index 26" -n300 -q1 -e26 -s30) -add_physim_test(5g nr_dlsim mcs.mimo.test4 "106 MCS-TABLE 256 QAM Fading Channel" -n300 -q1 -e24 -s30 -gA) -add_physim_test(5g nr_dlsim mcs.mimo.test5 "MCS 0, low SNR performance" -n300 -e0 -t95 -S-1.0 -i 2 1 0) -add_physim_test(5g nr_dlsim mcs.mimo.test6 "4x4 MIMO, 1 Layer" -n30 -s20 -U 3 0 0 2 -gA -x1 -y4 -z4) -add_physim_test(5g nr_dlsim mcs.mimo.test7 "4x4 MIMO, 2 Layers" -n30 -s20 -U 3 0 0 2 -gA -x2 -y4 -z4) -add_physim_test(5g nr_dlsim mcs.mimo.test8 "4x4 MIMO, 2 Layers 256 QAM" -n30 -s25 -e22 -q1 -U 3 0 0 2 -gA -x2 -y4 -z4) -add_physim_test(5g nr_dlsim mcs.mimo.test9 "4x4 MIMO, 4 Layers" -n30 -s20 -U 3 0 0 2 -x4 -y4 -z4) -add_physim_test(5g nr_dlsim dmrs.ptrs.test1 "3 PTRS, 8 Interpolated Symbols" -n300 -s5 -T 2 2 2) -add_physim_test(5g nr_dlsim dmrs.ptrs.test2 "6 PTRS, 5 Interpolated Symbols" -n300 -s5 -T 2 1 2) -add_physim_test(5g nr_dlsim dmrs.ptrs.test3 "11 PTRS, 0 Interpolated Symbols" -n300 -s5 -T 2 0 4) -add_physim_test(5g nr_dlsim dmrs.ptrs.test4 "Mapping type A, 2 DMRS Symbols" -n300 -s5 -S7 -U 2 0 1) -add_physim_test(5g nr_dlsim dmrs.ptrs.test5 "Mapping type A, 3 DMRS Symbols" -n300 -s5 -S7 -U 2 0 2) -add_physim_test(5g nr_dlsim dmrs.ptrs.test6 "Mapping type B, 4 DMRS Symbols" -n300 -s5 -S7 -U 2 1 3) - -#################################################################################### -###### nr_dlschsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_dlschsim test1 "106 PRBs" -R 106 -m9 -s13 -n300) -add_physim_test(5g nr_dlschsim test2 "217 PRBs" -R 217 -m15 -s15 -n300) -add_physim_test(5g nr_dlschsim test3 "273 PRBs" -R 273 -m19 -s20 -n300) - -#################################################################################### -###### smallblocktest unit test ###### -#################################################################################### - -add_physim_test(5g smallblocktest test1 "3 bits" -l 3 -s -4 -d 1 -i 10000) -add_physim_test(5g smallblocktest test2 "6 bits" -l 6 -s -4 -d 1 -i 10000) -add_physim_test(5g smallblocktest test3 "7 bits" -l 7 -s -4 -d 1 -i 10000) -add_physim_test(5g smallblocktest test4 "11 bits" -l 11 -s -4 -d 1 -i 10000) - -#################################################################################### -###### nr_ulschsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_ulschsim test1 "106 PRBs" -R 106 -m9 -s13 -n300) -add_physim_test(5g nr_ulschsim test2 "217 PRBs" -R 217 -m15 -s15 -n300) -add_physim_test(5g nr_ulschsim test3 "273 PRBs" -R 273 -m19 -s20 -n300) -add_physim_test(5g nr_ulschsim test4 "106 PRBs 4-layer MIMO" -R 106 -m9 -s13 -n300 -y4 -z4 -W4) - -#################################################################################### -###### nr_pucchsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_pucchsim test1 "Format 0 1-bit ACK miss 106 PRB" -R 106 -i 1 -P 0 -b 1 -s-2 -n3000) -add_physim_test(5g nr_pucchsim test2 "Format 0 2-bit ACK miss 106 PRB" -R 106 -i 1 -P 0 -b 2 -s-2 -n3000) -add_physim_test(5g nr_pucchsim test3 "Format 0 2-bit ACK miss, 1-bit SR 106 PRB" -R 106 -i 1 -P 0 -b 2 -s-2 -c -n3000) -add_physim_test(5g nr_pucchsim test4 "Format 2 3-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 3 -s0 -n3000) -add_physim_test(5g nr_pucchsim test5 "Format 2 4-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 4 -s0 -n3000) -add_physim_test(5g nr_pucchsim test6 "Format 2 5-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 5 -s1 -n3000) -add_physim_test(5g nr_pucchsim test7 "Format 2 6-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 6 -s2 -n3000) -add_physim_test(5g nr_pucchsim test8 "Format 2 7-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 7 -s3 -n3000) -add_physim_test(5g nr_pucchsim test9 "Format 2 8-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 8 -s4 -n3000) -add_physim_test(5g nr_pucchsim test10 "Format 2 9-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 9 -s5 -n3000) -add_physim_test(5g nr_pucchsim test11 "Format 2 10-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 10 -s6 -n3000) -add_physim_test(5g nr_pucchsim test12 "Format 2 11-bit 2/106 PRB" -R 106 -i 1 -P 2 -b 11 -s6 -n3000) -add_physim_test(5g nr_pucchsim test13 "Format 2 12-bit 4/106 PRB" -R 106 -i 1 -P 2 -q4 -b 12 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test14 "Format 2 19-bit 4/106 PRB" -R 106 -i 1 -P 2 -q4 -b 19 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test15 "Format 2 12-bit 8/106 PRB" -R 106 -i 1 -P 2 -q8 -b 12 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test16 "Format 2 19-bit 8/106 PRB" -R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test17 "Format 2 32-bit 8/106 PRB" -R 106 -i 1 -P 2 -q8 -b 32 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test18 "Format 2 32-bit 16/106 PRB" -R 106 -i 1 -P 2 -q16 -b 32 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test19 "Format 2 64-bit 16/106 PRB" -R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test20 "Format 0 1-bit Ack miss 273 PRB" -R 273 -z8 -i 1 -P 0 -b 1 -s-2 -n3000) -add_physim_test(5g nr_pucchsim test21 "Format 0 2-bit Ack miss 273 PRB" -R 273 -z8 -i 1 -P 0 -b 2 -s-2 -n3000) -add_physim_test(5g nr_pucchsim test22 "Format 0 2-bit Ack miss+SR 273 PRB" -R 273 -z8 -i 1 -P 0 -b 2 -s-2 -c -n3000) -add_physim_test(5g nr_pucchsim test23 "Format 2 4-bit 2/273 PRB" -R 273 -z8 -i 1 -P 2 -b 4 -s-8 -S0 -n3000) -add_physim_test(5g nr_pucchsim test24 "Format 2 7-bit 2/273 PRB" -R 273 -z8 -i 1 -P 2 -b 7 -s3 -n3000) -add_physim_test(5g nr_pucchsim test25 "Format 2 11-bit 2/273 PRB" -R 273 -z8 -i 1 -P 2 -b 11 -s6 -n3000) -add_physim_test(5g nr_pucchsim test26 "Format 2 12-bit 8/273 PRB" -R 273 -z8 -i 1 -P 2 -q8 -b 12 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test27 "Format 2 19-bit 8/273 PRB" -R 273 -z8 -i 1 -P 2 -q8 -b 19 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test28 "Format 2 64-bit 16/273 PRB" -R 273 -z8 -i 1 -P 2 -q16 -b 64 -s-3 -n3000) -add_physim_test(5g nr_pucchsim test29 "Format 2 64-bit 16/273 PRB Delay 2us" -R 273 -z8 -i 1 -P 2 -q16 -b 64 -s0 -S7 -d 2 -n3000) - -#################################################################################### -###### nr_ulsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_ulsim misc.test1 "MCS 9 106 PRBs" -n300 -m9 -r106 -s5) -add_physim_test(5g nr_ulsim misc.test2 "MCS 16 50 PRBs" -n300 -m16 -s10) -add_physim_test(5g nr_ulsim misc.test3 "MCS 28 50 PRBs" -n300 -m28 -s20) -add_physim_test(5g nr_ulsim misc.test4 "MCS 27 50 PRBs 256QAM" -n300 -m27 -s25 -q1) -add_physim_test(5g nr_ulsim misc.test5 "MCS 9 217 PRBs" -n300 -m9 -R217 -r217 -s5) -add_physim_test(5g nr_ulsim misc.test6 "MCS 9 273 PRBs" -n300 -m9 -R273 -r273 -s5) -add_physim_test(5g nr_ulsim misc.test7 "PUSCH Type A, 2 DMRS Symbols" -n300 -s5 -U 0,1,1,1) -add_physim_test(5g nr_ulsim misc.test8 "PUSCH Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols" -n300 -s5 -T 1,2 -U 0,2,1,1) -add_physim_test(5g nr_ulsim misc.test9 "PUSCH Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols" -n300 -s5 -T 2,2 -U 1,2,1,1) -add_physim_test(5g nr_ulsim misc.test10 "PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols" -n300 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1) -add_physim_test(5g nr_ulsim misc.test11 "25 PRBs, 15 kHz SCS" -n300 -u0 -m0 -R25 -r25 -i 1,0) -add_physim_test(5g nr_ulsim misc.test12 "32 PRBs, 120 kHz SCS" -n300 -s5 -r32 -R32 -u3) -add_physim_test(5g nr_ulsim misc.test13 "MCS 0, low SNR performance" -n300 -m0 -S -0.6 -i 1,0) -add_physim_test(5g nr_ulsim misc.test14 "MCS 28, 106 PRBs, Time shift 8" -n300 -m28 -R106 -r106 -t90 -s24 -S24 -d 8) -add_physim_test(5g nr_ulsim misc.test15 "SRS, SNR 40 dB" -n300 -s40 -E 1) -add_physim_test(5g nr_ulsim sc-fdma.test1 "SC-FDMA, 50 PRBs" -n300 -s5 -Z) -add_physim_test(5g nr_ulsim sc-fdma.test2 "SC-FDMA, 75 PRBs" -n300 -s5 -Z -r75) -add_physim_test(5g nr_ulsim sc-fdma.test3 "SC-FDMA, 216 PRBs" -n150 -s5 -Z -r216 -R217) -add_physim_test(5g nr_ulsim sc-fdma.test4 "SC-FDMA, 273 PRBs" -n150 -s5 -Z -r270 -R273) -add_physim_test(5g nr_ulsim sc-fdma.test5 "SC-FDMA, 3 DMRS" -n300 -s5 -Z -U 0,2,1,2) -add_physim_test(5g nr_ulsim mimo.test1 "MCS 19 50 PRBs 2 RX_Antenna" -n300 -m19 -s10 -S15 -z2) -add_physim_test(5g nr_ulsim mimo.test2 "MCS 9 106 PRBs MIMO 2 layers" -n300 -m9 -r106 -s8 -W2 -y2 -z2) -add_physim_test(5g nr_ulsim mimo.test3 "MCS 10 106 PRBs MIMO 2 layers" -n300 -m10 -r106 -s12 -W2 -y2 -z2) -add_physim_test(5g nr_ulsim mimo.test4 "MCS 19 106 PRBs MIMO 2 layers" -n300 -m19 -r106 -s22 -W2 -y2 -z2) -add_physim_test(5g nr_ulsim mimo.test5 "MCS 9 106 PRBs MIMO 4 layers" -n300 -m9 -r106 -s10 -W4 -y4 -z4) -add_physim_test(5g nr_ulsim 3gpp.test1 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z2 -s12.4 -S12.4) -add_physim_test(5g nr_ulsim 3gpp.test2 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z4 -s8.5 -S8.5) -add_physim_test(5g nr_ulsim 3gpp.test3 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z8 -s5.4 -S5.4) -add_physim_test(5g nr_ulsim 3gpp.test4 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z2 -s12.5 -S12.5) -add_physim_test(5g nr_ulsim 3gpp.test5 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z4 -s8.9 -S8.9) -add_physim_test(5g nr_ulsim 3gpp.test6 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z8 -s5.7 -S5.7) -add_physim_test(5g nr_ulsim 3gpp.test7 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z2 -s12.6 -S12.6) -add_physim_test(5g nr_ulsim 3gpp.test8 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z4 -s8.9 -S8.9) -add_physim_test(5g nr_ulsim 3gpp.test9 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z8 -s5.8 -S5.8) -add_physim_test(5g nr_ulsim 3gpp.test10 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.3 -S12.3) -add_physim_test(5g nr_ulsim 3gpp.test11 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.8 -S8.8) -add_physim_test(5g nr_ulsim 3gpp.test12 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.7 -S5.7) -add_physim_test(5g nr_ulsim 3gpp.test13 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z2 -s12.5 -S12.5) -add_physim_test(5g nr_ulsim 3gpp.test14 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z4 -s8.6 -S8.6) -add_physim_test(5g nr_ulsim 3gpp.test15 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z8 -s5.6 -S5.6) -add_physim_test(5g nr_ulsim 3gpp.test16 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z2 -s12.5 -S12.5) -add_physim_test(5g nr_ulsim 3gpp.test17 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z4 -s8.6 -S8.6) -add_physim_test(5g nr_ulsim 3gpp.test18 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z8 -s5.6 -S5.6) -add_physim_test(5g nr_ulsim 3gpp.test19 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.5 -S12.5) -add_physim_test(5g nr_ulsim 3gpp.test20 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.7 -S8.7) -add_physim_test(5g nr_ulsim 3gpp.test21 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.5 -S5.5) -add_physim_test(5g nr_ulsim 3gpp.test22 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z2 -s13.1 -S13.1) -add_physim_test(5g nr_ulsim 3gpp.test23 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z4 -s9.2 -S9.2) -add_physim_test(5g nr_ulsim 3gpp.test24 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" -n300 -b14 -I8 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z8 -s5.9 -S5.9) -add_physim_test(5g nr_ulsim 3gpp.test25 "3GPP G-FR1-A3-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test, 2 layers" -n300 -b14 -I15 -i 0,1 -g B,l -t70 -u 1 -m2 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z2 -s1.7 -S1.7) -add_physim_test(5g nr_ulsim 3gpp.test26 "3GPP G-FR1-A3-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test, 2 layers" -n300 -b14 -I15 -i 0,1 -g B,l -t70 -u 1 -m2 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z4 -s-2.1 -S-2.1) -add_physim_test(5g nr_ulsim 3gpp.test27 "3GPP G-FR1-A4-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test, 2 layers" -n300 -b14 -I15 -i 0,1 -g C,l -t70 -u 1 -m16 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z2 -s18.7 -S18.7) -add_physim_test(5g nr_ulsim 3gpp.test28 "3GPP G-FR1-A4-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test, 2 layers" -n300 -b14 -I15 -i 0,1 -g C,l -t70 -u 1 -m16 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z4 -s11.2 -S11.2) - -#################################################################################### -###### nr_prachsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_prachsim test1 "30kHz SCS, 106 PRBs, Prach format A2" -a -s -30 -n 300 -p 63 -R 106) -add_physim_test(5g nr_prachsim test2 "30kHz SCS, 217 PRBs, Prach format A2" -a -s -30 -n 300 -p 63 -R 217) -add_physim_test(5g nr_prachsim test3 "30kHz SCS, 273 PRBs, Prach format A2" -a -s -30 -n 300 -p 63 -R 273) -add_physim_test(5g nr_prachsim test4 "30kHz SCS, 106 PRBs, Prach format 0" -a -s -30 -n 300 -p 63 -R 106 -c 4) -add_physim_test(5g nr_prachsim test5 "120kHz SCS, 32 PRBs, Prach format A2" -a -s -30 -n 300 -p 32 -R 32 -m 3 -c52) -add_physim_test(5g nr_prachsim test6 "120kHz SCS, 66 PRBs, Prach format A2" -a -s -30 -n 300 -p 32 -R 66 -m 3 -c52) -add_physim_test(5g nr_prachsim test7 "120kHz SCS, 66 PRBs, High Speed Enabled" -a -s -30 -n 300 -R 66 -m 3 -c52 -H) -add_physim_test(5g nr_prachsim test8 "15kHz SCS, 25 PRBs" -a -s -30 -n 300 -p 99 -R 25 -m 0) - -#################################################################################### -###### nr_psbchsim unit test ###### -#################################################################################### - -add_physim_test(5g nr_psbchsim test1 "SLSS Search" -I) -add_physim_test(5g nr_psbchsim test2 "PSBCH TxRx" -n 30) diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c index 5b661d7c2d..81177a63cb 100644 --- a/openair1/PHY/INIT/lte_param_init.c +++ b/openair1/PHY/INIT/lte_param_init.c @@ -63,9 +63,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp, PHY_VARS_UE *UE; RU_t *ru; printf("Start lte_param_init\n"); - *eNBp = malloc(sizeof(PHY_VARS_eNB)); - *UEp = malloc(sizeof(PHY_VARS_UE)); - *rup = malloc(sizeof(RU_t)); + *eNBp = malloc_or_fail(sizeof(PHY_VARS_eNB)); + *UEp = malloc_or_fail(sizeof(PHY_VARS_UE)); + *rup = malloc_or_fail(sizeof(RU_t)); eNB = *eNBp; UE = *UEp; ru = *rup; diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index b167cebc26..54a80124f3 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -519,17 +519,6 @@ static void sl_generate_psbch_dmrs_qpsk_sequences(PHY_VARS_NR_UE *UE, struct com idx = (((sl_dmrs_sequence[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 3); modulated_dmrs_sym[m].r = mod_table[idx].r; modulated_dmrs_sym[m].i = mod_table[idx].i; - -#ifdef SL_DEBUG_INIT_DATA - printf("m:%d gold seq: %d b0-b1: %d-%d DMRS Symbols: %d %d\n", - m, - sl_dmrs_sequence[(m << 1) >> 5], - (((sl_dmrs_sequence[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 1), - (((sl_dmrs_sequence[((m << 1) + 1) >> 5]) >> (((m << 1) + 1) & 0x1f)) & 1), - modulated_dmrs_sym[m].r, - modulated_dmrs_sym[m].i); - printf("idx:%d, qpsk_table.r:%d, qpsk_table.i:%d\n", idx, mod_table[idx].r, mod_table[idx].i); -#endif } #ifdef SL_DUMP_INIT_SAMPLES diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index d2ad87f717..c1f54fa9c3 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -418,7 +418,10 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, // if REG is allocated to PHICH, skip it if (check_phich_reg(frame_parms,kprime,lprime,mi) == 1) { #ifdef DEBUG_DCI_ENCODING - printf("generate_dci: skipping REG %d (kprime %u, lprime %u)\n",(lprime==0)?(kprime/6) : (kprime>>2),kprime,lprime); + printf("generate_dci: skipping REG %u (kprime %u, lprime %u)\n", + (lprime == 0) ? (kprime / 6) : (kprime >> 2), + kprime, + lprime); #endif } else { // Copy REG to TX buffer diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 9c92503186..4e0a2163e3 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -1993,6 +1993,7 @@ int get_narrowband_index(int N_RB_UL,int rb) { default: AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL); + return 0; break; } } @@ -2128,6 +2129,7 @@ int get_first_rb_in_narrowband(int N_RB_UL, default: AssertFatal(1==0,"Impossible N_RB_UL %d\n",N_RB_UL); + return 0; break; } } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index 8bdceceed8..5626f0a9df 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -202,7 +202,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, for (i=0; i<(1+(G>>5)); i++) { for (j=0; j<32; j++,k++) { #ifdef DEBUG_SCRAMBLING - printf("unscrambling %d : %d xor %d =",k,llr[k],(s>>j)&1); + printf("unscrambling %d : %d xor %u =", k, llr[k], (s >> j) & 1); #endif llr[k] = ((2*((s>>j)&1))-1)*llr[k]; #ifdef DEBUG_SCRAMBLING diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c index 8370b35b49..977dbd9ca7 100644 --- a/openair1/PHY/LTE_TRANSPORT/edci.c +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -262,7 +262,6 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, mDCI_ALLOC_t *mdci; int coded_bits; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - int i; int gain_lin_QPSK; uint16_t *mpdcchtab; uint32_t x1 = 0, x2 = 0, s = 0; @@ -277,7 +276,7 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, int *w; LOG_D(PHY, "generate_mdci_top: num_dci %d\n", mpdcch->num_dci); - for (i = 0; i < mpdcch->num_dci; i++) { + for (int i = 0; i < mpdcch->num_dci; i++) { mdci = &mpdcch->mdci_alloc[i]; AssertFatal(fp->frame_type == FDD, "TDD is not yet supported for MPDCCH\n"); AssertFatal(fp->Ncp == NORMAL, "Extended Prefix not yet supported for MPDCCH\n"); @@ -358,14 +357,14 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, if (re_offset > fp->ofdm_symbol_size) re_offset -= (fp->ofdm_symbol_size - 1); - int32_t *txF = &txdataF[0][symbol_offset+re_offset]; - int32_t yIQ; + c16_t *txF = (c16_t *)&txdataF[0][symbol_offset + re_offset]; + c16_t yIQ; - for (i = 0; i < (coded_bits >> 1); i++) { + for (int i = 0; i < (coded_bits >> 1); i++) { // QPSK modulation to yIQ - ((int16_t *) & yIQ)[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK; + yIQ.r = *e_ptr == 1 ? -gain_lin_QPSK : gain_lin_QPSK; e_ptr++; - ((int16_t *) & yIQ)[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK; + yIQ.i = *e_ptr == 1 ? -gain_lin_QPSK : gain_lin_QPSK; e_ptr++; txF[mpdcchtab[i]] = yIQ; /* @@ -406,7 +405,7 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, int last_prb = (mdci->narrowband*6) + nb_i0 + 5; int soffset[4] = {5,6,12,13}; - for (int lprime=0,i=0; lprime<4; lprime++) { + for (int lprime=0,ii=0; lprime<4; lprime++) { for (int nprb=0; nprb<110; nprb++) { if (nprbN_RB_DL) { re_offset = fp->first_carrier_offset + (12 * nprb); @@ -414,11 +413,11 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, if (re_offset > fp->ofdm_symbol_size) re_offset -= (fp->ofdm_symbol_size - 1); - txF = &txdataF[0][symbol_offset + re_offset + fp->ofdm_symbol_size*soffset[lprime]]; + txF = (c16_t *)&txdataF[0][symbol_offset + re_offset + fp->ofdm_symbol_size * soffset[lprime]]; } - for (int mprime=0; mprime<3; mprime++,i+=2) { - if ((i & 0x1f) == 0) { + for (int mprime=0; mprime<3; mprime++,ii+=2) { + if ((ii & 0x1f) == 0) { s = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -426,8 +425,8 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, // select PRBs corresponding to narrowband if ((nprb>= first_prb) && (nprb<= last_prb)) { - ((int16_t *) & yIQ)[0] = (((s >> (i & 0x1f)) & 1) == 1) ? -gain_lin_QPSK : gain_lin_QPSK; - ((int16_t *) & yIQ)[1] = (((s >> ((i + 1) & 0x1f)) & 1) == 1) ? -gain_lin_QPSK : gain_lin_QPSK; + yIQ.r = (s >> (ii & 0x1f)) & 1 ? -gain_lin_QPSK : gain_lin_QPSK; + yIQ.i = (s >> ((ii + 1) & 0x1f)) & 1 ? -gain_lin_QPSK : gain_lin_QPSK; AssertFatal(mdci->transmission_type==1,"transmission_type %d!=1, handle this ...\n",mdci->transmission_type); if (mdci->transmission_type==1) { // same thing on both 107 and 109 @@ -435,9 +434,9 @@ void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe, int16_t amp, txF[1+(5*mprime)] = yIQ; } else { // put on selected antenna port with w sequence if (((mprime+nprb)&1) == 0) - txF[off+(5*mprime)] = yIQ*w[lprime]; + txF[off + (5 * mprime)] = (c16_t){yIQ.r * w[lprime], yIQ.i * w[lprime]}; else - txF[off+(5*mprime)] = yIQ*w[3-lprime]; + txF[off + (5 * mprime)] = (c16_t){yIQ.r * w[3 - lprime], yIQ.i * w[3 - lprime]}; } /* diff --git a/openair1/PHY/LTE_TRANSPORT/phich_common.c b/openair1/PHY/LTE_TRANSPORT/phich_common.c index 302229b88d..48209274fc 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich_common.c +++ b/openair1/PHY/LTE_TRANSPORT/phich_common.c @@ -390,7 +390,11 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) { frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1; frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2; //#ifdef DEBUG_PHICH - printf("phich_reg :%u => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]); + printf("phich_reg :%d => %d,%d,%d\n", + mprime << 1, + frame_parms->phich_reg[mprime << 1][0], + frame_parms->phich_reg[mprime][1], + frame_parms->phich_reg[mprime][2]); printf("phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]); //#endif } diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 90c9d63925..6cb2de68d2 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -346,20 +346,31 @@ void rx_prach0(PHY_VARS_eNB *eNB, } } - if ((eNB==NULL) && ru->function == NGFI_RRU_IF4p5) { - /// **** send_IF4 of rxsigF to RAU **** /// - if (br_flag == 1) - send_IF4p5(ru, frame_prach, subframe, IF4p5_PRACH+1+ce_level); - else - send_IF4p5(ru, frame_prach, subframe, IF4p5_PRACH); - - return; - } else if (eNB!=NULL) { - if (LOG_DEBUGFLAG(DEBUG_PRACH)) { - int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); - - if ((en > 10)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,frame_prach,subframe,en); + if (!eNB) { + if (ru->function == NGFI_RRU_IF4p5) { + /// **** send_IF4 of rxsigF to RAU **** /// + if (br_flag == 1) + send_IF4p5(ru, frame_prach, subframe, IF4p5_PRACH + 1 + ce_level); + else + send_IF4p5(ru, frame_prach, subframe, IF4p5_PRACH); + } else { + LOG_E(PHY, "inconsistent case\n"); } + return; + } + + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { + int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0], 840)); + if ((en > 10) && (br_flag == 1)) + LOG_I(PHY, + "PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n", + br_flag, + ce_level, + n_ra_prb, + k, + frame_prach, + subframe, + en); } // in case of RAU and prach received rx_thread wakes up prach diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index 0939398c60..6dfa1cdec6 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -304,8 +304,9 @@ const uint16_t prach_root_sequence_map4[138] = { 57, 82, 58, 81, 59, 80, 60, 79, 61, 78, 62, 77, 63, 76, 64, 75, 65, 74, 66, 73, 67, 72, 68, 71, 69, 70}; void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { - FILE *fd; - fd = fopen("prach_config.txt","w"); + FILE *fd = fopen("prach_config.txt", "w"); + if (!fd) + return; fprintf(fd,"prach_config: subframe = %d\n",subframe); fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL); fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD"); diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index e613efd6ca..a226e29225 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -665,7 +665,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, } #ifdef DEBUG_ULSCH_DECODING - printf("ulsch_decoding.c: ACK i %u, r %d, j %u, ColumnSet[j] %d\n",i,r,j,columnset[j]); + printf("ulsch_decoding.c: ACK i %d, r %d, j %d, ColumnSet[j] %d\n", i, r, j, columnset[j]); #endif j=(j+3)&3; } @@ -1040,6 +1040,7 @@ void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { char output[16384]; char *str = output; + *str = 0; for (eNB_SCH_STATS_t *st = eNB->ulsch_stats; st < eNB->ulsch_stats + sizeofArray(eNB->ulsch_stats); st++) if (st->rnti > 0 && st->round_trials[0] > 100) { for (int aa = 0; aa < eNB->frame_parms.nb_antennas_rx; aa++) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index d8d3008be7..e567dc3d9b 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -124,7 +124,7 @@ static int errorRB(int rb, char * table, int line) { return 0; } -#define rbAllocCheck(RBalL, TabLe) (RBalL) > sizeof(TabLe)/sizeof(*TabLe) ? errorRB(RBalL, #TabLe, __LINE__) : TabLe[RBalL] +#define rbAllocCheck(RBalL, TabLe) (RBalL) >= sizeof(TabLe) / sizeof(*TabLe) ? errorRB(RBalL, #TabLe, __LINE__) : TabLe[RBalL] void extract_dci1A_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint8_t harq_pid=0; @@ -4965,7 +4965,8 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe) } } - s_dB[count] = 10*log10(abs_channel/2) - meas->n0_power_avg_dB; + if (abs_channel > 0) + s_dB[count] = 10 * log10(abs_channel / 2.0) - meas->n0_power_avg_dB; } break; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c index 9ac775c4be..998b95d0d3 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c @@ -22,7 +22,7 @@ data storage. */ #include #include //#define DEBUG_PREPROC - +#include "common/utils/utils.h" void transpose (int N, float complex *A, float complex *Result) { @@ -43,14 +43,14 @@ void transpose (int N, float complex *A, float complex *Result) int ldb = col_opB; if (transb == CblasNoTrans) { - B = (float complex*)calloc(ldb*col_opB,sizeof(float complex)); + B = calloc_or_fail(ldb * col_opB, sizeof(float complex)); col_B= col_opB; } else { - B = (float complex*)calloc(ldb*col_opA, sizeof(float complex)); + B = calloc_or_fail(ldb * col_opA, sizeof(float complex)); col_B = col_opA; } - float complex* C = (float complex*)malloc(ldc*col_opB*sizeof(float complex)); + float complex* C = malloc_or_fail(ldc * col_opB * sizeof(float complex)); for (i=0; i>2)*sizeof(float complex)); - float complex *H1_re = malloc(n_rx*(n_tx>>2)*sizeof(float complex)); - float complex *R_corr_col_n_0_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *R_corr_col_n_1_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_herm_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_herm_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *D_0_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *D_1_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_0_re = malloc(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_1_re = malloc(n_rx*n_tx*sizeof(float complex)); + float complex *H0_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex)); + float complex *H1_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex)); + float complex *R_corr_col_n_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *R_corr_col_n_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *U_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *U_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *U_0_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *U_1_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *D_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *D_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *W_Wh_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); + float complex *W_Wh_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); for (aatx=0; aatxofdm_symbol_size + k] = c16mulRealShift(mod_dci[dci_idx], amp, 15); -#ifdef DEBUG_DCI - LOG_I(NR_PHY_DCI, - "PDCCH: l %d position %d => (%d,%d)\n", - l, - k, - txdataF[l * frame_parms->ofdm_symbol_size + k].r, - txdataF[l * frame_parms->ofdm_symbol_size + k].i; -#endif - dci_idx++; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index 64d07723bd..c5edd4cfde 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -65,16 +65,6 @@ void nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, for (int m=0; m>5])>>((m<<1)&0x1f))&3); mod_dmrs[m] = nr_qpsk_mod_table[idx]; -#ifdef DEBUG_PBCH_DMRS - printf("m %d idx %d gold seq %u b0-b1 %d-%d mod_dmrs %d %d\n", - m, - idx, - gold_pbch_dmrs[(m << 1) >> 5], - (((gold_pbch_dmrs[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 1), - (((gold_pbch_dmrs[((m << 1) + 1) >> 5]) >> (((m << 1) + 1) & 0x1f)) & 1), - mod_dmrs[m].r, - mod_dmrs[m].i); -#endif } /// Resource mapping @@ -165,9 +155,6 @@ static void nr_pbch_encoded_scrambling(uint32_t *pbch_e, #ifdef DEBUG_PBCH_ENCODING printf("Scrambling params: nushift %d M %d length %d offset %d\n", nushift, M, length, info.offset); #endif -#ifdef DEBUG_PBCH_ENCODING - printf("s: %04x\t", s); -#endif for (int i = 0; i < length; ++i) { if (((i + info.offset) & 0x1f) == 0) @@ -189,9 +176,6 @@ static uint32_t nr_pbch_scrambling(uint32_t pbch_a_interleaved, uint32_t *s = gold_cache(Nid, info.len); #ifdef DEBUG_PBCH_ENCODING printf("Scrambling params: nushift %d M %d length %d offset %d\n", nushift, M, length, info.offset); -#endif -#ifdef DEBUG_PBCH_ENCODING - printf("s: %04x\t", s); #endif int goldIdx = info.goldIdx; for (int i = 0; i < length; ++i) { @@ -280,9 +264,6 @@ void nr_generate_pbch(PHY_VARS_gNB *gNB, uint8_t *interleaver = gNB->nr_pbch_interleaver; for (int i = 0; i < NR_POLAR_PBCH_PAYLOAD_BITS; i++) { pbch_a_interleaved |= ((pbch_a >> i) & 1) << (*(interleaver + i)); -#ifdef DEBUG_PBCH_ENCODING - printf("i %d out 0x%08x ilv %d (in>>i)&1) %d\n", i, pbch_a_interleaved, *(interleaver+i), (pbch_a >> i) & 1); -#endif } #ifdef DEBUG_PBCH_ENCODING diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index fcf5484ed7..3c9850bd52 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -38,9 +38,8 @@ #include "common/utils/LOG/log.h" #include "PHY/sse_intrin.h" -//#define k1 1000 -#define k1 ((long long int) 1000) -#define k2 ((long long int) (1024-k1)) +#define K1 ((long long int) 512) +#define K2 ((long long int) (1024-K1)) //#define DEBUG_MEAS_RRC //#define DEBUG_MEAS_UE @@ -136,11 +135,11 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, if (ue->init_averaging == 0) { for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) - ue->measurements.rx_power_avg[gNB_id] = (int)(((k1*((long long int)(ue->measurements.rx_power_avg[gNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[gNB_id])))) >> 10); + ue->measurements.rx_power_avg[gNB_id] = (int)((K1 * ue->measurements.rx_power_avg[gNB_id] + K2 * ue->measurements.rx_power_tot[gNB_id]) >> 10); - ue->measurements.n0_power_avg = (int)(((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10); + ue->measurements.n0_power_avg = (int)((K1 * ue->measurements.n0_power_avg + K2 * ue->measurements.n0_power_tot) >> 10); - LOG_D(PHY, "Noise Power Computation: k1 %lld k2 %lld n0 avg %u n0 tot %u\n", k1, k2, ue->measurements.n0_power_avg, ue->measurements.n0_power_tot); + LOG_D(PHY, "Noise Power Computation: K1 %lld K2 %lld n0 avg %u n0 tot %u\n", K1, K2, ue->measurements.n0_power_avg, ue->measurements.n0_power_tot); } else { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c index 2a2200557e..f9047aedd0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync_sl.c @@ -78,19 +78,6 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index) const c64_t r64 = {.r = result.r, .i = result.i}; psss_corr_value += squaredMod(r64); - -#ifdef SL_DEBUG - pss_corr_debug_values[pss_index][n] = psss_corr_value; - printf("frame:%d n:%d, pss_index:%d, pss_for_correlation[pss_index][0]:%x, rxdata[n]:%x\n", - frame_index, - n, - pss_index, - pss_for_correlation[pss_index][0], - rxdata[ar][n + frame_index * sl_fp->samples_per_frame]); - printf("result %lld, pss_corr_values[%d][%d]:%ld\n", result, pss_index, n, pss_corr_debug_values[pss_index][n]); - printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_debug_values[pss_index][n]); - printf("peak_value:%ld, peak_position:%d, pss_source:%d\n", peak_value, peak_position, pss_source); -#endif } // calculate the absolute value of sync_corr[n] @@ -99,10 +86,6 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index) peak_value = psss_corr_value; peak_position = n; pss_source = pss_index; - -#ifdef SL_DEBUG - printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)psss_corr_value); -#endif } } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 8065da24b2..00130b3642 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -263,11 +263,7 @@ void nr_pbch_unscrambling(int16_t *demod_pbch_e, *pbch_a_interleaved ^= ((unscrambling_mask >> i) & 1) ? ((pbch_a_prime >> i) & 1) << i : (((pbch_a_prime >> i) & 1) ^ ((seq[idxGold] >> ((k + offset) & 0x1f)) & 1)) << i; - k += (!((unscrambling_mask>>i)&1)); -#ifdef DEBUG_PBCH_ENCODING - printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, *pbch_a_interleaved, - (!((unscrambling_mask>>i)&1))); -#endif + k += (!((unscrambling_mask >> i) & 1)); } else { if (((i + offset) & 0x1f) == 0) idxGold++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_psbch_tx.c b/openair1/PHY/NR_UE_TRANSPORT/nr_psbch_tx.c index cc8993bc6d..5a80ca272b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_psbch_tx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_psbch_tx.c @@ -40,11 +40,6 @@ void sl_psbch_scrambling(uint32_t *output, uint32_t id, uint16_t length) // x1 is set in lte_gold_generic x2 = id; // C_INIT -#ifdef SL_DEBUG - printf("SIDELINK: Function %s\n", __func__); - printf("Scrambling params: length %d id %d \n", length, id); -#endif - #ifdef SL_DEBUG for (int i = 0; i < 56; i++) { printf("\nBEFORE SCRAMBLING output[%d]:0x%x\n", i, output[i]); @@ -334,10 +329,6 @@ void nr_tx_psbch(PHY_VARS_NR_UE *UE, uint32_t frame_tx, uint32_t slot_tx, sl_nr_ psbch_payload |= (slot_tx << 10) & 0x10000; psbch_payload |= (slot_tx << 26) & 0xFC000000; -#ifdef SL_DEBUG - printf("DEBUG PSBCH TX: DFN, SLOT included. psbch_a :0x%08x, frame:%d, slot:%d\n", psbch_payload, frame_tx, slot_tx); -#endif - LOG_D(PHY, "PSBCH TX: Frame.Slot %d.%d. Payload::0x%08x, slssid:%d\n", frame_tx, slot_tx, psbch_payload, slss_id); // GENERATE Sidelink PSS,SSS Sequences, PSBCH DMRS Symbols, PSBCH Symbols diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index 3fcbe2a2f3..611572a0a3 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -506,7 +506,12 @@ static inline void nr_pucch2_3_4_scrambling(uint16_t M_bit, uint16_t rnti, uint1 uint8_t c = (uint8_t)((s >> i) & 1); btildep[i] = (((B>>i)&1) ^ c); #ifdef DEBUG_NR_PUCCH_TX - printf("\t\t\t btilde[%d]=%x from unscrambled bit %d and scrambling %d (%x)\n",i+(iprime<<5),btilde[i],((B>>i)&1),c,s>>i); + printf("\t\t\t btilde[%d]=%x from unscrambled bit %u and scrambling %d (%x)\n", + i + (iprime << 5), + btilde[i], + ((B >> i) & 1), + c, + s >> i); #endif } } diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c index d3397b033f..6d7723d6d4 100644 --- a/openair1/PHY/TOOLS/calibration_scope.c +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -67,7 +67,7 @@ static void drawsymbol(FL_OBJECT *obj, int id, static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { if (type==WATERFALL) { graph->waterFallh=h-15; - graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); + graph->waterFallAvg = malloc_or_fail(sizeof(*graph->waterFallAvg) * graph->waterFallh); for (int i=0; i< graph->waterFallh; i++) graph->waterFallAvg[i]=0; @@ -309,7 +309,7 @@ static void puschIQ (OAIgraph_t *graph, calibData_t *context) { static OAI_phy_scope_t *createScopeCalibration(calibData_t * context) { FL_OBJECT *obj; - OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1); fdui->context=context; // Define form fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 ); @@ -380,7 +380,7 @@ static void *scopeThread(void *arg) { void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) { pthread_t forms_thread; - calibData_t * tmp=(calibData_t *) malloc(sizeof(*tmp)); + calibData_t *tmp = (calibData_t *)malloc_or_fail(sizeof(*tmp)); tmp->samplesRx=samplesRx; tmp->rfdevice=rfdevice; threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index ac754eb432..8f86bfedc4 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -614,7 +614,7 @@ static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_gnb(void) { FL_OBJECT *obj; - OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1); // Define form fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 ); fl_set_form_dblbuffer(fdui->phy_scope, 1); @@ -739,7 +739,7 @@ static void scopeUpdaterGnb(enum PlotTypeGnbIf plotType, int numElt) STATICFORXSCOPE void gNBinitScope(scopeParms_t *p) { - AssertFatal(p->gNB->scopeData = calloc(sizeof(scopeData_t), 1), ""); + AssertFatal(p->gNB->scopeData = calloc_or_fail(sizeof(scopeData_t), 1), ""); scopeData_t *scope=(scopeData_t *) p->gNB->scopeData; scope->argc=p->argc; scope->argv=p->argv; @@ -998,7 +998,7 @@ static void uePdschThroughput (scopeGraphData_t **data, OAIgraph_t *graph, PHY_ STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_nrue(int ID) { FL_OBJECT *obj; - OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); + OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1); // Define form fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 900 ); fl_set_form_dblbuffer(fdui->phy_scope, 1); @@ -1139,7 +1139,7 @@ static void *nrUEscopeThread(void *arg) { STATICFORXSCOPE void nrUEinitScope(PHY_VARS_NR_UE *ue) { - AssertFatal(ue->scopeData = calloc(sizeof(scopeData_t), 1), ""); + AssertFatal(ue->scopeData = calloc_or_fail(sizeof(scopeData_t), 1), ""); scopeData_t *scope=(scopeData_t *) ue->scopeData; scope->copyData = copyData; #ifndef WEBSRVSCOPE @@ -1185,7 +1185,7 @@ static void reset_stats_gNB(FL_OBJECT *button, } static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; - FD_stats_form *fdui = calloc(( sizeof *fdui ),1); + FD_stats_form *fdui = calloc_or_fail(( sizeof *fdui ),1); fdui->vdata = fdui->cdata = NULL; fdui->ldata = 0; fdui->stats_form = fl_bgn_form( FL_NO_BOX, 1115, 900 ); diff --git a/openair1/PHY/TOOLS/smbv.c b/openair1/PHY/TOOLS/smbv.c index a1088cc705..337fcbe13f 100644 --- a/openair1/PHY/TOOLS/smbv.c +++ b/openair1/PHY/TOOLS/smbv.c @@ -61,6 +61,8 @@ int smbv_init_config(const char* fname, uint16_t sequence_length) int k; f_ptr = fopen(fname,"w"); + if (!f_ptr) + return -1; if (sequence_length>4) { msg("ERROR invalid sequence length: %d, maximum is 4\n", sequence_length); @@ -101,6 +103,8 @@ int smbv_write_config_from_frame_parms(const char* fname, LTE_DL_FRAME_PARMS *fr FILE *f_ptr; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; fprintf(f_ptr, "BB:EUTR:SLEN %d\n",slen); @@ -188,6 +192,8 @@ int smbv_configure_datalist_for_alloc(const char* fname, uint8_t alloc, uint8_t { FILE *f_ptr; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; char strbuf[(8<<1)+1]; int i,k; strbuf[0] = '\0'; @@ -245,6 +251,8 @@ int smbv_configure_datalist_for_user(const char* fname, uint8_t user, uint8_t *b { FILE *f_ptr; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; char strbuf[(8<<1)+1]; int i,k; @@ -284,6 +292,8 @@ int smbv_configure_user(const char* fname, uint8_t user, uint8_t transmission_mo { FILE *f_ptr; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; fprintf(f_ptr, "BB:EUTR:DL:USER%d:TXM M1\n",user); fprintf(f_ptr, "BB:EUTR:DL:USER%d:UEC USER\n",user); @@ -302,6 +312,8 @@ int smbv_configure_pdcch(const char* fname,uint8_t subframe,uint8_t num_pdcch_sy FILE *f_ptr; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PCF:CREG %d\n",subframe,num_pdcch_symbols); fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PDCC:FORM VAR\n",subframe); @@ -325,6 +337,8 @@ int smbv_configure_common_dci(const char* fname, uint8_t subframe, const char* t void *dci_pdu = &dci_alloc->dci_pdu[0]; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe); @@ -383,6 +397,8 @@ int smbv_configure_ue_spec_dci(const char* fname, uint8_t subframe, uint8_t user void *dci_pdu = &dci_alloc->dci_pdu[0]; f_ptr = fopen(fname,"a"); + if (!f_ptr) + return -1; fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe); fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PDCC:EXTC:ITEM%d:USER USER%d\n",subframe,item,user); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index bd0e110565..f683a2098d 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -699,7 +699,7 @@ static uint32_t compute_csi_rm_unav_res(fapi_nr_dl_config_dlsch_pdu_rel15_t *dls int num_symb = num_l0[csi_pdu->row - 1]; for (int s = 0; s < num_symb; s++) { int l0_symb = csi_pdu->symb_l0 + s; - if (l0_symb >= dlsch_config->start_symbol && l0_symb <= dlsch_config->start_symbol + dlsch_config->number_symbols) + if (l0_symb >= dlsch_config->start_symbol && l0_symb < dlsch_config->start_symbol + dlsch_config->number_symbols) num_overlap_symb++; } // check also l1 if relevant @@ -707,7 +707,7 @@ static uint32_t compute_csi_rm_unav_res(fapi_nr_dl_config_dlsch_pdu_rel15_t *dls num_symb += 2; for (int s = 0; s < 2; s++) { // two consecutive symbols including l1 int l1_symb = csi_pdu->symb_l1 + s; - if (l1_symb >= dlsch_config->start_symbol && l1_symb <= dlsch_config->start_symbol + dlsch_config->number_symbols) + if (l1_symb >= dlsch_config->start_symbol && l1_symb < dlsch_config->start_symbol + dlsch_config->number_symbols) num_overlap_symb++; } } diff --git a/openair1/SIMULATION/CMakeLists.txt b/openair1/SIMULATION/CMakeLists.txt new file mode 100644 index 0000000000..b93118ccb7 --- /dev/null +++ b/openair1/SIMULATION/CMakeLists.txt @@ -0,0 +1,3 @@ +if(ENABLE_PHYSIM_TESTS) + add_subdirectory(tests) +endif() diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 43abb68a12..c4efb2752e 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -311,9 +311,9 @@ int main(int argc, char **argv) int i,aa;//,l; double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0; uint8_t snr1set=0; - float effRate; + double effRate; //float psnr; - float eff_tp_check = 0.7; + double eff_tp_check = 0.7; uint32_t TBS = 0; c16_t **txdata; double **s_re,**s_im,**r_re,**r_im; @@ -547,7 +547,7 @@ int main(int argc, char **argv) break; case 't': - eff_tp_check = (float)atoi(optarg)/100; + eff_tp_check = atof(optarg) / 100.0; break; case 'w': @@ -701,6 +701,8 @@ printf("%d\n", slot); .minRXTXTIME = 6, .do_CSIRS = 0, .do_SRS = 0, + .num_dlharq = 16, + .num_ulharq = 16, .maxMIMO_layers = g_nrOfLayers, .force_256qam_off = false, .timer_config.sr_ProhibitTimer = 0, @@ -743,7 +745,7 @@ printf("%d\n", slot); RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc, NULL, &conf, &rlc_config); + mac_top_init_gNB(ngran_gNB, scc, &conf, &rlc_config); gNB_mac = RC.nrmac[0]; nr_mac_config_scc(RC.nrmac[0], scc, &conf); @@ -791,11 +793,6 @@ printf("%d\n", slot); NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; */ - NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd)); - prepare_scd(scd); - /* removes unnecessary BWPs, if any */ - fix_scd(scd); - gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_XP = pdsch_AntennaPorts.XP; @@ -806,7 +803,7 @@ printf("%d\n", slot); prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_DL, g_mcsTableIdx, 0); rnti_t rnti = 0x1234; int uid = 0; - NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, uid); + NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, UE_Capability_nr, 0, 1, &conf, uid); secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc); /* -U option modify DMRS */ @@ -1081,8 +1078,6 @@ printf("%d\n", slot); Sched_INFO->sched_response_id = -1; while (round < num_rounds && !UE_harq_process->decodeResult && !stop) { - round_trials[round]++; - clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot, &Sched_INFO->DL_req, &Sched_INFO->TX_req, &Sched_INFO->UL_dci_req); UE_info->UE_sched_ctrl.harq_processes[harq_pid].ndi = !(trial&1); UE_info->UE_sched_ctrl.harq_processes[harq_pid].round = round; @@ -1235,6 +1230,9 @@ printf("%d\n", slot); if (dlsch0->last_iteration_cnt >= dlsch0->max_ldpc_iterations) n_errors[round]++; + if (dlsch0->active) + round_trials[round]++; + int16_t *UE_llr = (int16_t*)UE->phy_sim_pdsch_llr; TBS = dlsch0->dlsch_config.TBS;//rel15->TBSize[0]; @@ -1266,8 +1264,8 @@ printf("%d\n", slot); } // round if (test_input_bit == NULL) { - test_input_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS); - estimated_output_bit = (unsigned char *)malloc16(sizeof(unsigned char) * TBS); + test_input_bit = (unsigned char *)malloc16(8 * rel15->TBSize[0]); + estimated_output_bit = (unsigned char *)malloc16(8 * rel15->TBSize[0]); } for (i = 0; i < TBS; i++) { @@ -1288,12 +1286,12 @@ printf("%d\n", slot); if (n_trials == 1) printf("errors_bit = %u (trial %d)\n", errors_bit, trial); } - roundStats += ((float)round); + roundStats += round; if (UE_harq_process->decodeResult) - effRate += ((float)TBS) / round; + effRate += ((double)TBS) / round; } // noise trials - roundStats /= ((float)n_trials); + roundStats /= n_trials; for (int r = 0; r < num_rounds; r++) { blerStats[r] = (double)n_errors[r] / round_trials[r]; @@ -1316,7 +1314,7 @@ printf("%d\n", slot); printf("), Channel BER (%e", berStats[0]); for (int r = 1; r < num_rounds; r++) printf(",%e", berStats[r]); - printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats, effRate, effRate / TBS * 100, TBS); + printf(") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", roundStats, effRate, effRate / (8 * rel15->TBSize[0]) * 100, 8 * rel15->TBSize[0]); printf("*****************************************\n"); printf("\n"); // writing to csv file @@ -1324,7 +1322,7 @@ printf("%d\n", slot); fprintf(csv_file,"%f,%d/%d,",SNR,n_false_positive,n_trials); for (int r = 0; r < num_rounds; r++) fprintf(csv_file,"%d/%d,%u/%u,%f,%e,",n_errors[r], round_trials[r], errors_scrambling[r], available_bits * round_trials[r],blerStats[r],berStats[r]); - fprintf(csv_file,"%.2f,%.4f,%.2f,%u\n", roundStats, effRate, effRate / TBS * 100, TBS); + fprintf(csv_file,"%.2f,%.4f,%.2f,%u\n", roundStats, effRate, effRate / (8 * rel15->TBSize[0]) * 100, 8 * rel15->TBSize[0]); } if (print_perf==1) { printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, C %d, block %d)\n", @@ -1332,7 +1330,7 @@ printf("%d\n", slot); g_rbSize, g_mcsIndex, UE->dl_harq_processes[0][slot].C, - msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3); + 8 * rel15->TBSize[0]); printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx"); printStatIndent2(&gNB->dci_generation_stats, "DCI encoding time"); printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time"); @@ -1406,7 +1404,7 @@ printf("%d\n", slot); break; } - if (effRate > (eff_tp_check*TBS)) { + if (effRate >= (eff_tp_check * 8 * rel15->TBSize[0])) { printf("PDSCH test OK\n"); ret = 0; break; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 466ffc6822..0d3687bb4d 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -658,6 +658,8 @@ int main(int argc, char *argv[]) .minRXTXTIME = 0, .do_CSIRS = 0, .do_SRS = 0, + .num_dlharq = 16, + .num_ulharq = 16, .force_256qam_off = false, .timer_config.sr_ProhibitTimer = 0, .timer_config.sr_TransMax = 64, @@ -698,19 +700,14 @@ int main(int argc, char *argv[]) RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */, &conf, &rlc_config); + mac_top_init_gNB(ngran_gNB, scc, &conf, &rlc_config); nr_mac_config_scc(RC.nrmac[0], scc, &conf); - NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); - prepare_scd(scd); - /* removes unnecessary BWPs, if any */ - fix_scd(scd); - NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); prepare_sim_uecap(UE_Capability_nr, scc, mu, N_RB_UL, 0, mcs_table); rnti_t rnti = 0x1234; int uid = 0; - NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, uid); + NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, UE_Capability_nr, 0, 1, &conf, uid); secondaryCellGroup->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(rnti, uid, scc); NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); @@ -1478,8 +1475,8 @@ int main(int argc, char *argv[]) } for (i = 0; i < available_bits; i++) { - if (((UE->ul_harq_processes[harq_pid].f[i] == 0) && (pusch_vars->llr[i] <= 0)) - || ((UE->ul_harq_processes[harq_pid].f[i] == 1) && (pusch_vars->llr[i] >= 0))) { + const uint8_t current_bit = (UE->ul_harq_processes[harq_pid].f[i / 8] >> (i & 7)) & 1; + if (((current_bit == 0) && (pusch_vars->llr[i] <= 0)) || ((current_bit == 1) && (pusch_vars->llr[i] >= 0))) { /*if(errors_scrambling == 0) printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/ errors_scrambling[round]++; diff --git a/openair1/SIMULATION/tests/CMakeLists.txt b/openair1/SIMULATION/tests/CMakeLists.txt new file mode 100644 index 0000000000..273142a1d7 --- /dev/null +++ b/openair1/SIMULATION/tests/CMakeLists.txt @@ -0,0 +1,399 @@ +define_property(TEST PROPERTY TEST_DESCRIPTION BRIEF_DOCS "A human-readable description of this test") + +# Define a macro to add tests for different physical simulators +macro(add_physim_test test_name test_description test_exec) + # catch all the arguments past the last expected arqument and store them in the options_list + if (NOT TARGET ${test_exec}) + message(FATAL_ERROR "test executable ${test_exec} is not an executable") + endif() + set(options_list ${ARGN}) + add_test( + NAME ${test_name} + COMMAND ${test_exec} ${options_list} + COMMAND_EXPAND_LISTS + ) + set_tests_properties(${test_name} PROPERTIES + LABELS "${test_exec}" + TEST_DESCRIPTION "${test_description}" + # pass test description also through environment variable: for cmake < 3.30, + # in JSON export, we cannot recover the description otherwise + # see also https://gitlab.kitware.com/cmake/cmake/-/issues/21490 + ENVIRONMENT "LD_LIBRARY_PATH=.;TEST_DESCRIPTION=${test_description}" + ) + add_dependencies(tests ${test_exec}) +endmacro() + +define_property(TEST PROPERTY CHECK_COUNT BRIEF_DOCS "helper property to enumerate checks in environment") +function(add_timed_physim_test test_name test_description test_exec) + # catch all the arguments past the last expected arqument and store them in the options_list + if (NOT TARGET ${test_exec}) + message(FATAL_ERROR "test executable ${test_exec} is not an executable") + endif() + set(test_invocation $ ${ARGN}) + add_test( + NAME ${test_name} + COMMAND ${CMAKE_COMMAND} "-DTEST_CMD=${test_invocation}" "-DCHECK_SCRIPT=${CMAKE_CURRENT_SOURCE_DIR}/analyze-timing.sh" -P ${CMAKE_CURRENT_SOURCE_DIR}/RunTimedTest.cmake + ) + set_tests_properties(${test_name} PROPERTIES + LABELS "${test_exec}" + TEST_DESCRIPTION "${test_description}" + # pass test description also through environment variable: for cmake < 3.30, + # in JSON export, we cannot recover the description otherwise + # see also https://gitlab.kitware.com/cmake/cmake/-/issues/21490 + ENVIRONMENT "LD_LIBRARY_PATH=.;TEST_DESCRIPTION=${test_description}" + ) + set_tests_properties(${test_name} PROPERTIES CHECK_COUNT 0) +endfunction() + +function(check_threshold testname threshold condition) + # check that threshold and condition don't have a colon (;), because that + # would interfere with cmake's list management + string(FIND "${threshold}" ";" pos) + if (pos GREATER -1) + message(FATAL_ERROR "colon not allowed in threshold, but have \"${threshold}\"") + endif() + string(FIND "${condition}" ";" pos) + if (pos GREATER -1) + message(FATAL_ERROR "colon not allowed in condition, but have \"${condition}\"") + endif() + set(THRCOND "${threshold}\;${condition}") + + get_test_property(${testname} CHECK_COUNT count) + #message(STATUS "add check ${count} ${THRCOND}") + if (${count} GREATER 10) + message(FATAL_ERROR "only maximum of 10 checks per test allowed") + endif() + + # add a new environment variable CHECK_X with this threshold+condition, then + # increase test property regarding check count + set_property(TEST ${testname} APPEND PROPERTY ENVIRONMENT "CHECK_${count}=${THRCOND}") + MATH(EXPR count "${count}+1") + set_tests_properties(${testname} PROPERTIES CHECK_COUNT ${count}) +endfunction() + +function(check_threshold_range testname threshold) + cmake_parse_arguments(RANGE "" "LOWER;UPPER" "" ${ARGN}) + if (NOT RANGE_LOWER AND NOT RANGE_UPPER) + message(FATAL_ERROR "need at least one LOWER or one UPPER threshold") + endif() + if (RANGE_LOWER) + check_threshold(${testname} ${threshold} "> ${RANGE_LOWER}") + endif() + if (RANGE_UPPER) + check_threshold(${testname} ${threshold} "< ${RANGE_UPPER}") + endif() +endfunction() + +function(check_threshold_variance testname threshold) + cmake_parse_arguments(VARIANCE "" "AVG;ABS_VAR" "" ${ARGN}) + if (NOT VARIANCE_AVG AND NOT VARIANCE_ABS_VAR) + message(FATAL_ERROR "need both AVG and ABS_VAR") + endif() + MATH(EXPR upper "${VARIANCE_AVG}+${VARIANCE_ABS_VAR}") + MATH(EXPR lower "${VARIANCE_AVG}-${VARIANCE_ABS_VAR}") + check_threshold_range(${testname} ${threshold} LOWER ${lower} UPPER ${upper}) +endfunction() + + +#################################################################################### +###### dlsim unit test ###### +#################################################################################### + +add_physim_test(physim.4g.dlsim.basic.test1 "10 MHz, R2.FDD (MCS 5), EVA5, -1dB" dlsim -m=5 -g=F -s=-1 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test2 "1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)" dlsim -m=4 -g=F -s=0 -w=1.0 -f=.2 -n=1500 -B=6 -c=4 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test3 "10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)" dlsim -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test4 "5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)" dlsim -m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=1500 -B=25 -c=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test5 "10 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)" dlsim -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=25) +add_physim_test(physim.4g.dlsim.basic.test6 "5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)" dlsim -m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=1500 -B=25 -c=2 -z=2 -Tperf=25) +add_physim_test(physim.4g.dlsim.basic.test7 "5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)" dlsim -m=25 -g=F -s=17.4 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test8 "5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)" dlsim -m=25 -g=F -s=17.5 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -z=2 -r=1022 -Tperf=60) +add_physim_test(physim.4g.dlsim.basic.test9 "10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)" dlsim -m=26 -g=F -s=17.7 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.100rb.tm2.test1 "20 MHz, R.9 FDD (MCS 26), EVA5, 17.6dB (70%)" dlsim -m=26 -g=F -s=17.6 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.100rb.tm2.test2 "20 MHz, R.9-2 FDD (MCS 26, 17PRB), EVA5, 17.3dB (70%)" dlsim -m=26 -g=F -s=17.3 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -r=1600 -Tperf=60) +add_physim_test(physim.4g.dlsim.100rb.tm2.test3 "20 MHz, R.9-1 FDD (MCS 26, 83 PRB), EVA5, 16.6dB (70%)" dlsim -m=26 -g=F -s=16.6 -w=1.0 -f=.2 -n=1500 -B=100 -c=2 -z=2 -r=1899 -Tperf=60) +add_physim_test(physim.4g.dlsim.100rb.tm2.test4 "10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)" dlsim -m=14 -g=F -s=6.8 -w=1.0 -f=.2 -n=1500 -B=50 -c=2 -x=2 -y=2 -z=2 -Tperf=60) +add_physim_test(physim.4g.dlsim.100rb.tm2.test5 "5 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)" dlsim -m=13 -g=F -s=5.9 -w=1.0 -f=.2 -n=1500 -B=25 -c=3 -x=2 -y=2 -z=2 -Tperf=60) + +#################################################################################### +###### ulsim unit test ###### +#################################################################################### + +add_physim_test(physim.4g.ulsim.test1 "5 MHz, FDD (MCS 5), AWGN, 6dB" ulsim -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) +add_physim_test(physim.4g.ulsim.test2 "5 MHz, FDD (MCS 16), AWGN , 12dB (70%)" ulsim -BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) +add_physim_test(physim.4g.ulsim.test3 "10 MHz, R3.FDD (MCS 5), AWGN, 6dB (70%)" ulsim -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) +add_physim_test(physim.4g.ulsim.test4 "10 MHz, R3-1.FDD (MCS 16), AWGN, 12dB (70%)" ulsim -BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) +add_physim_test(physim.4g.ulsim.test5 "20 MHz, FDD (MCS 5), AWGN, 6dB (70%)" ulsim -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) +add_physim_test(physim.4g.ulsim.test6 "20 MHz, FDD (MCS 16), AWGN, 12 dB (70%)" ulsim -BnbRBs=100 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=1500 -Tperf=70) + +#################################################################################### +###### ldpctest unit test ###### +#################################################################################### + +add_physim_test(physim.5g.ldpctest.test1 "block length = 3872, BG1" ldpctest -l3872 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test2 "block length = 4224, BG1" ldpctest -l4224 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test3 "block length = 4576, BG1" ldpctest -l4576 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test4 "block length = 4928, BG1" ldpctest -l4928 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test5 "block length = 5280, BG1" ldpctest -l5280 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test6 "block length = 5632, BG1" ldpctest -l5632 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test7 "block length = 6336, BG1" ldpctest -l6336 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test8 "block length = 7040, BG1" ldpctest -l7040 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test9 "block length = 7744, BG1" ldpctest -l7744 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test10 "block length = 8448, BG1" ldpctest -l8448 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test11 "block length = 1, BG2" ldpctest -l1 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test12 "block length = 100, BG2" ldpctest -l100 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test13 "block length = 193, BG2" ldpctest -l193 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test14 "block length = 500, BG2" ldpctest -l500 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test15 "block length = 561, BG2" ldpctest -l561 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test16 "block length = 600, BG2" ldpctest -l600 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test17 "block length = 641, BG2" ldpctest -l641 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test18 "block length = 2000, BG1" ldpctest -l2000 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test19 "block length = 3000, BG1" ldpctest -l3000 -s10 -n300) +add_physim_test(physim.5g.ldpctest.test20 "block length = 3840, BG1" ldpctest -l3840 -s10 -n300) + +#################################################################################### +###### polartest unit test ###### +#################################################################################### + +add_physim_test(physim.5g.polartest.test1 "PBCH polar test" polartest -q -s-10 -f0) +add_physim_test(physim.5g.polartest.test2 "DCI polar test" polartest -q -s-10 -f0 -m1) +add_physim_test(physim.5g.polartest.test3 "UCI polar test,6-bit CRC" polartest -q -s-2 -f2 -m2 -k12) +add_physim_test(physim.5g.polartest.test4 "UCI polar test,11-bit CRC" polartest -q -s-2 -f2 -m2 -k20) + +#################################################################################### +###### nr_pbchsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_pbchsim.106rb.test1 "PBCH-only, 106 PRB, NID 2" nr_pbchsim -s-11 -S-8 -n30 -R106 -N2) +add_physim_test(physim.5g.nr_pbchsim.106rb.test2 "PBCH and synchronization, 106PBR" nr_pbchsim -s-11 -S-8 -n30 -o8000 -I -R106) +add_physim_test(physim.5g.nr_pbchsim.106rb.test3 "PBCH and synchronization, 106PBR, SSB SC OFFSET 6" nr_pbchsim -s-11 -S-8 -n30 -R106 -c6) +add_physim_test(physim.5g.nr_pbchsim.217rb.test1 "PBCH-only, 217 PRB" nr_pbchsim -s-10 -S-8 -n30 -R217) +add_physim_test(physim.5g.nr_pbchsim.217rb.test2 "PBCH and synchronization, 217 RPB" nr_pbchsim -s-10 -S-8 -n30 -o8000 -I -R217) +add_physim_test(physim.5g.nr_pbchsim.273rb.test1 "PBCH-only, 273 PRB" nr_pbchsim -s-10 -S-8 -n30 -R273) +add_physim_test(physim.5g.nr_pbchsim.273rb.test2 "PBCH and synchronization, 273 PRB" nr_pbchsim -s-10 -S-8 -n30 -o8000 -I -R273) +add_physim_test(physim.5g.nr_pbchsim.otherSCS.test1 "PBCH-only, 15Khz, 5Mhz" nr_pbchsim -s-10 -S-8 -n30 -m0 -R25) +add_physim_test(physim.5g.nr_pbchsim.otherSCS.test2 "PBCH-only, 120Khz, 50Mhz" nr_pbchsim -s-10 -S-8 -n30 -m3 -R32) + +#################################################################################### +###### nr_dlsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_dlsim.basic.test1 "106 PRB" nr_dlsim -n300 -R106 -b106 -s5) +add_physim_test(physim.5g.nr_dlsim.basic.test2 "217 PRB" nr_dlsim -n300 -R217 -b217 -s5) +add_physim_test(physim.5g.nr_dlsim.basic.test3 "273 PRB" nr_dlsim -n300 -R273 -b273 -s5) +add_physim_test(physim.5g.nr_dlsim.basic.test4 "HARQ test 25% TP 4 rounds" nr_dlsim -n300 -s1 -S2 -t25) +add_physim_test(physim.5g.nr_dlsim.basic.test5 "HARQ test 33% TP 3 rounds" nr_dlsim -n300 -s1 -S2 -t33) +add_physim_test(physim.5g.nr_dlsim.basic.test6 "HARQ test 50% TP 2 rounds" nr_dlsim -n300 -s5 -S7 -t50) +add_physim_test(physim.5g.nr_dlsim.basic.test7 "25 PRBs, 15 kHz SCS" nr_dlsim -n300 -m0 -e0 -R25 -b25 -i 2 1 0) +add_physim_test(physim.5g.nr_dlsim.basic.test8 "32 PRBs, 120 kHz SCS" nr_dlsim -n300 -s5 -m3 -R32 -b32) +add_physim_test(physim.5g.nr_dlsim.offset.test1 "106 PRB 25 PDSCH-Offset" nr_dlsim -n300 -R106 -a25 -s5) +add_physim_test(physim.5g.nr_dlsim.offset.test2 "106 PRB 51 PDSCH-Offset" nr_dlsim -n300 -R106 -a51 -s5) +add_physim_test(physim.5g.nr_dlsim.offset.test3 "217 PRB 100 PDSCH-PRBs" nr_dlsim -n300 -R217 -b100 -s5) +add_physim_test(physim.5g.nr_dlsim.offset.test4 "217 PRB 80 PDSCH-Offset" nr_dlsim -n300 -R217 -a80 -s5) +add_physim_test(physim.5g.nr_dlsim.offset.test5 "217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset" nr_dlsim -n300 -R217 -a110 -s5 -b100) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test1 "106 PRBs 50 PDSCH-PRBs MCS Index 27" nr_dlsim -n300 -e27 -s30) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test2 "106 PRBs 50 PDSCH-PRBs MCS Index 16" nr_dlsim -n300 -e16 -s11 -S13) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test3 "106 MCS-TABLE 256 QAM MCS Index 26" nr_dlsim -n300 -q1 -e26 -s30) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test4 "106 MCS-TABLE 256 QAM Fading Channel" nr_dlsim -n300 -q1 -e24 -s30 -gA) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test5 "MCS 0, low SNR performance" nr_dlsim -n300 -e0 -t95 -S-1.0 -i 2 1 0) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test6 "4x4 MIMO, 1 Layer" nr_dlsim -n30 -s20 -U 3 0 0 2 -gA -x1 -y4 -z4) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test7 "4x4 MIMO, 2 Layers" nr_dlsim -n30 -s20 -U 3 0 0 2 -gA -x2 -y4 -z4) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test8 "4x4 MIMO, 2 Layers 256 QAM" nr_dlsim -n30 -s25 -e22 -q1 -U 3 0 0 2 -gA -x2 -y4 -z4) +add_physim_test(physim.5g.nr_dlsim.mcs.mimo.test9 "4x4 MIMO, 4 Layers" nr_dlsim -n30 -s20 -U 3 0 0 2 -x4 -y4 -z4) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test1 "3 PTRS, 8 Interpolated Symbols" nr_dlsim -n300 -s5 -T 2 2 2) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test2 "6 PTRS, 5 Interpolated Symbols" nr_dlsim -n300 -s5 -T 2 1 2) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test3 "11 PTRS, 0 Interpolated Symbols" nr_dlsim -n300 -s5 -T 2 0 4) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test4 "Mapping type A, 2 DMRS Symbols" nr_dlsim -n300 -s5 -S7 -U 2 0 1) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test5 "Mapping type A, 3 DMRS Symbols" nr_dlsim -n300 -s5 -S7 -U 2 0 2) +add_physim_test(physim.5g.nr_dlsim.dmrs.ptrs.test6 "Mapping type B, 4 DMRS Symbols" nr_dlsim -n300 -s5 -S7 -U 2 1 3) + +#################################################################################### +###### nr_dlschsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_dlschsim.test1 "106 PRBs" nr_dlschsim -R 106 -m9 -s13 -n300) +add_physim_test(physim.5g.nr_dlschsim.test2 "217 PRBs" nr_dlschsim -R 217 -m15 -s15 -n300) +add_physim_test(physim.5g.nr_dlschsim.test3 "273 PRBs" nr_dlschsim -R 273 -m19 -s20 -n300) + +#################################################################################### +###### smallblocktest unit test ###### +#################################################################################### + +add_physim_test(physim.5g.smallblocktest.test1 "3 bits" smallblocktest -l 3 -s -4 -d 1 -i 10000) +add_physim_test(physim.5g.smallblocktest.test2 "6 bits" smallblocktest -l 6 -s -4 -d 1 -i 10000) +add_physim_test(physim.5g.smallblocktest.test3 "7 bits" smallblocktest -l 7 -s -4 -d 1 -i 10000) +add_physim_test(physim.5g.smallblocktest.test4 "11 bits" smallblocktest -l 11 -s -4 -d 1 -i 10000) + +#################################################################################### +###### nr_ulschsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_ulschsim.test1 "106 PRBs" nr_ulschsim -R 106 -m9 -s13 -n300) +add_physim_test(physim.5g.nr_ulschsim.test2 "217 PRBs" nr_ulschsim -R 217 -m15 -s15 -n300) +add_physim_test(physim.5g.nr_ulschsim.test3 "273 PRBs" nr_ulschsim -R 273 -m19 -s20 -n300) +add_physim_test(physim.5g.nr_ulschsim.test4 "106 PRBs 4-layer MIMO" nr_ulschsim -R 106 -m9 -s13 -n300 -y4 -z4 -W4) + +#################################################################################### +###### nr_pucchsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_pucchsim.test1 "Format 0 1-bit ACK miss 106 PRB" nr_pucchsim -R 106 -i 1 -P 0 -b 1 -s-2 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test2 "Format 0 2-bit ACK miss 106 PRB" nr_pucchsim -R 106 -i 1 -P 0 -b 2 -s-2 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test3 "Format 0 2-bit ACK miss, 1-bit SR 106 PRB" nr_pucchsim -R 106 -i 1 -P 0 -b 2 -s-2 -c -n3000) +add_physim_test(physim.5g.nr_pucchsim.test4 "Format 2 3-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 3 -s0 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test5 "Format 2 4-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 4 -s0 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test6 "Format 2 5-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 5 -s1 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test7 "Format 2 6-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 6 -s2 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test8 "Format 2 7-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 7 -s3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test9 "Format 2 8-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 8 -s4 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test10 "Format 2 9-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 9 -s5 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test11 "Format 2 10-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 10 -s6 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test12 "Format 2 11-bit 2/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -b 11 -s6 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test13 "Format 2 12-bit 4/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q4 -b 12 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test14 "Format 2 19-bit 4/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q4 -b 19 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test15 "Format 2 12-bit 8/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q8 -b 12 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test16 "Format 2 19-bit 8/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test17 "Format 2 32-bit 8/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q8 -b 32 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test18 "Format 2 32-bit 16/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q16 -b 32 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test19 "Format 2 64-bit 16/106 PRB" nr_pucchsim -R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test20 "Format 0 1-bit Ack miss 273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 0 -b 1 -s-2 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test21 "Format 0 2-bit Ack miss 273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 0 -b 2 -s-2 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test22 "Format 0 2-bit Ack miss+SR 273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 0 -b 2 -s-2 -c -n3000) +add_physim_test(physim.5g.nr_pucchsim.test23 "Format 2 4-bit 2/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -b 4 -s-8 -S0 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test24 "Format 2 7-bit 2/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -b 7 -s3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test25 "Format 2 11-bit 2/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -b 11 -s6 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test26 "Format 2 12-bit 8/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -q8 -b 12 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test27 "Format 2 19-bit 8/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -q8 -b 19 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test28 "Format 2 64-bit 16/273 PRB" nr_pucchsim -R 273 -z8 -i 1 -P 2 -q16 -b 64 -s-3 -n3000) +add_physim_test(physim.5g.nr_pucchsim.test29 "Format 2 64-bit 16/273 PRB Delay 2us" nr_pucchsim -R 273 -z8 -i 1 -P 2 -q16 -b 64 -s0 -S7 -d 2 -n3000) + +#################################################################################### +###### nr_ulsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_ulsim.misc.test1 "MCS 9 106 PRBs" nr_ulsim -n300 -m9 -r106 -s5) +add_physim_test(physim.5g.nr_ulsim.misc.test2 "MCS 16 50 PRBs" nr_ulsim -n300 -m16 -s10) +add_physim_test(physim.5g.nr_ulsim.misc.test3 "MCS 28 50 PRBs" nr_ulsim -n300 -m28 -s20) +add_physim_test(physim.5g.nr_ulsim.misc.test4 "MCS 27 50 PRBs 256QAM" nr_ulsim -n300 -m27 -s25 -q1) +add_physim_test(physim.5g.nr_ulsim.misc.test5 "MCS 9 217 PRBs" nr_ulsim -n300 -m9 -R217 -r217 -s5) +add_physim_test(physim.5g.nr_ulsim.misc.test6 "MCS 9 273 PRBs" nr_ulsim -n300 -m9 -R273 -r273 -s5) +add_physim_test(physim.5g.nr_ulsim.misc.test7 "PUSCH Type A, 2 DMRS Symbols" nr_ulsim -n300 -s5 -U 0,1,1,1) +add_physim_test(physim.5g.nr_ulsim.misc.test8 "PUSCH Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols" nr_ulsim -n300 -s5 -T 1,2 -U 0,2,1,1) +add_physim_test(physim.5g.nr_ulsim.misc.test9 "PUSCH Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols" nr_ulsim -n300 -s5 -T 2,2 -U 1,2,1,1) +add_physim_test(physim.5g.nr_ulsim.misc.test10 "PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols" nr_ulsim -n300 -s5 -a4 -b8 -T 1,2 -U 1,3,1,1) +add_physim_test(physim.5g.nr_ulsim.misc.test11 "25 PRBs, 15 kHz SCS" nr_ulsim -n300 -u0 -m0 -R25 -r25 -i 1,0) +add_physim_test(physim.5g.nr_ulsim.misc.test12 "32 PRBs, 120 kHz SCS" nr_ulsim -n300 -s5 -r32 -R32 -u3) +add_physim_test(physim.5g.nr_ulsim.misc.test13 "MCS 0, low SNR performance" nr_ulsim -n300 -m0 -S -0.6 -i 1,0) +add_physim_test(physim.5g.nr_ulsim.misc.test14 "MCS 28, 106 PRBs, Time shift 8" nr_ulsim -n300 -m28 -R106 -r106 -t90 -s24 -S24 -d 8) +add_physim_test(physim.5g.nr_ulsim.misc.test15 "SRS, SNR 40 dB" nr_ulsim -n300 -s40 -E 1) +add_physim_test(physim.5g.nr_ulsim.sc-fdma.test1 "SC-FDMA, 50 PRBs" nr_ulsim -n300 -s5 -Z) +add_physim_test(physim.5g.nr_ulsim.sc-fdma.test2 "SC-FDMA, 75 PRBs" nr_ulsim -n300 -s5 -Z -r75) +add_physim_test(physim.5g.nr_ulsim.sc-fdma.test3 "SC-FDMA, 216 PRBs" nr_ulsim -n150 -s5 -Z -r216 -R217) +add_physim_test(physim.5g.nr_ulsim.sc-fdma.test4 "SC-FDMA, 273 PRBs" nr_ulsim -n150 -s5 -Z -r270 -R273) +add_physim_test(physim.5g.nr_ulsim.sc-fdma.test5 "SC-FDMA, 3 DMRS" nr_ulsim -n300 -s5 -Z -U 0,2,1,2) +add_physim_test(physim.5g.nr_ulsim.mimo.test1 "MCS 19 50 PRBs 2 RX_Antenna" nr_ulsim -n300 -m19 -s10 -S15 -z2) +add_physim_test(physim.5g.nr_ulsim.mimo.test2 "MCS 9 106 PRBs MIMO 2 layers" nr_ulsim -n300 -m9 -r106 -s8 -W2 -y2 -z2) +add_physim_test(physim.5g.nr_ulsim.mimo.test3 "MCS 10 106 PRBs MIMO 2 layers" nr_ulsim -n300 -m10 -r106 -s12 -W2 -y2 -z2) +add_physim_test(physim.5g.nr_ulsim.mimo.test4 "MCS 19 106 PRBs MIMO 2 layers" nr_ulsim -n300 -m19 -r106 -s22 -W2 -y2 -z2) +add_physim_test(physim.5g.nr_ulsim.mimo.test5 "MCS 9 106 PRBs MIMO 4 layers" nr_ulsim -n300 -m9 -r106 -s10 -W4 -y4 -z4) +add_physim_test(physim.5g.nr_ulsim.3gpp.test1 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z2 -s12.4 -S12.4) +add_physim_test(physim.5g.nr_ulsim.3gpp.test2 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z4 -s8.5 -S8.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test3 "3GPP G-FR1-A5-13, PUSCH Type A, 40 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 0,1,1,2 -z8 -s5.4 -S5.4) +add_physim_test(physim.5g.nr_ulsim.3gpp.test4 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z2 -s12.5 -S12.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test5 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z4 -s8.9 -S8.9) +add_physim_test(physim.5g.nr_ulsim.3gpp.test6 "3GPP G-FR1-A5-8, PUSCH Type B, 5 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R25 -r25 -U 1,1,1,2 -z8 -s5.7 -S5.7) +add_physim_test(physim.5g.nr_ulsim.3gpp.test7 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z2 -s12.6 -S12.6) +add_physim_test(physim.5g.nr_ulsim.3gpp.test8 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z4 -s8.9 -S8.9) +add_physim_test(physim.5g.nr_ulsim.3gpp.test9 "3GPP G-FR1-A5-9, PUSCH Type B, 10 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R52 -r52 -U 1,1,1,2 -z8 -s5.8 -S5.8) +add_physim_test(physim.5g.nr_ulsim.3gpp.test10 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.3 -S12.3) +add_physim_test(physim.5g.nr_ulsim.3gpp.test11 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.8 -S8.8) +add_physim_test(physim.5g.nr_ulsim.3gpp.test12 "3GPP G-FR1-A5-10, PUSCH Type B, 20 MHz BW, 15 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 0 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.7 -S5.7) +add_physim_test(physim.5g.nr_ulsim.3gpp.test13 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z2 -s12.5 -S12.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test14 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z4 -s8.6 -S8.6) +add_physim_test(physim.5g.nr_ulsim.3gpp.test15 "3GPP G-FR1-A5-11, PUSCH Type B, 10 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R24 -r24 -U 1,1,1,2 -z8 -s5.6 -S5.6) +add_physim_test(physim.5g.nr_ulsim.3gpp.test16 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z2 -s12.5 -S12.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test17 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z4 -s8.6 -S8.6) +add_physim_test(physim.5g.nr_ulsim.3gpp.test18 "3GPP G-FR1-A5-12, PUSCH Type B, 20 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R51 -r51 -U 1,1,1,2 -z8 -s5.6 -S5.6) +add_physim_test(physim.5g.nr_ulsim.3gpp.test19 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z2 -s12.5 -S12.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test20 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z4 -s8.7 -S8.7) +add_physim_test(physim.5g.nr_ulsim.3gpp.test21 "3GPP G-FR1-A5-13, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R106 -r106 -U 1,1,1,2 -z8 -s5.5 -S5.5) +add_physim_test(physim.5g.nr_ulsim.3gpp.test22 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z2 -s13.1 -S13.1) +add_physim_test(physim.5g.nr_ulsim.3gpp.test23 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I7 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z4 -s9.2 -S9.2) +add_physim_test(physim.5g.nr_ulsim.3gpp.test24 "3GPP G-FR1-A5-14, PUSCH Type B, 100 MHz BW, 30 kHz SCS, 8 RX Antennas Requirements Test" nr_ulsim -n300 -b14 -I8 -i 0,1 -g A,l,10 -t70 -u 1 -m20 -R273 -r273 -U 1,1,1,2 -z8 -s5.9 -S5.9) +add_physim_test(physim.5g.nr_ulsim.3gpp.test25 "3GPP G-FR1-A3-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test, 2 layers" nr_ulsim -n300 -b14 -I15 -i 0,1 -g B,l -t70 -u 1 -m2 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z2 -s1.7 -S1.7) +add_physim_test(physim.5g.nr_ulsim.3gpp.test26 "3GPP G-FR1-A3-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test, 2 layers" nr_ulsim -n300 -b14 -I15 -i 0,1 -g B,l -t70 -u 1 -m2 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z4 -s-2.1 -S-2.1) +add_physim_test(physim.5g.nr_ulsim.3gpp.test27 "3GPP G-FR1-A4-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 2 RX Antennas Requirements Test, 2 layers" nr_ulsim -n300 -b14 -I15 -i 0,1 -g C,l -t70 -u 1 -m16 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z2 -s18.7 -S18.7) +add_physim_test(physim.5g.nr_ulsim.3gpp.test28 "3GPP G-FR1-A4-27, PUSCH Type B, 40 MHz BW, 30 kHz SCS, 4 RX Antennas Requirements Test, 2 layers" nr_ulsim -n300 -b14 -I15 -i 0,1 -g C,l -t70 -u 1 -m16 -R106 -r106 -U 1,1,1,2 -W2 -y2 -z4 -s11.2 -S11.2) + +#################################################################################### +###### nr_prachsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_prachsim.test1 "30kHz SCS, 106 PRBs, Prach format A2" nr_prachsim -a -s -30 -n 300 -p 63 -R 106) +add_physim_test(physim.5g.nr_prachsim.test2 "30kHz SCS, 217 PRBs, Prach format A2" nr_prachsim -a -s -30 -n 300 -p 63 -R 217) +add_physim_test(physim.5g.nr_prachsim.test3 "30kHz SCS, 273 PRBs, Prach format A2" nr_prachsim -a -s -30 -n 300 -p 63 -R 273) +add_physim_test(physim.5g.nr_prachsim.test4 "30kHz SCS, 106 PRBs, Prach format 0" nr_prachsim -a -s -30 -n 300 -p 63 -R 106 -c 4) +add_physim_test(physim.5g.nr_prachsim.test5 "120kHz SCS, 32 PRBs, Prach format A2" nr_prachsim -a -s -30 -n 300 -p 32 -R 32 -m 3 -c52) +add_physim_test(physim.5g.nr_prachsim.test6 "120kHz SCS, 66 PRBs, Prach format A2" nr_prachsim -a -s -30 -n 300 -p 32 -R 66 -m 3 -c52) +add_physim_test(physim.5g.nr_prachsim.test7 "120kHz SCS, 66 PRBs, High Speed Enabled" nr_prachsim -a -s -30 -n 300 -R 66 -m 3 -c52 -H) +add_physim_test(physim.5g.nr_prachsim.test8 "15kHz SCS, 25 PRBs" nr_prachsim -a -s -30 -n 300 -p 99 -R 25 -m 0) + +#################################################################################### +###### nr_psbchsim unit test ###### +#################################################################################### + +add_physim_test(physim.5g.nr_psbchsim.test1 "SLSS Search" nr_psbchsim -I) +add_physim_test(physim.5g.nr_psbchsim.test2 "PSBCH TxRx" nr_psbchsim -n 30) + +#################################################################################### +###### offload-specific tests ###### +#################################################################################### + +if (ENABLE_LDPC_AAL) + +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.1 "CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e5 -b106 -R106 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.1 "T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e5 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.2 "CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e15 -b106 -R106 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.2 "T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e15 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.3 "CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e25 -b106 -R106 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.3 "T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e25 -b106 -R106 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.4 "CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.4 "T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.5 "CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.5 "T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.6 "CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.6 "T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.7 "CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.7 "T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.8 "CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.8 "T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.9 "CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X 8,9,10,11,12 -x2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.9 "T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -x2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.10 "CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.10 "T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e5 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.11 "CPU: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.11 "T2 LDPC offload: SNR = 30, MCS = 20, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e15 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testCPU.12 "CPU: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X8,9,10,11,12 -x2 -z4 -y4 -P) +add_timed_physim_test(physim.5g-offload.nr_dlsim.testT2.12 "T2 LDPC offload: SNR = 30, MCS = 27, 273 PRBs, 2 layers, 4 antennas" nr_dlsim -n1000 -s30 -S30.2 -e25 -b273 -R273 -X4,5,6,7,8,9 -x2 -z4 -y4 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) + +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.1 "CPU: SNR = 30, MCS = 5, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m5 -r106 -R106 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.1 "T2 LDPC offload: SNR = 30, MCS = 5, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m5 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.2 "CPU: SNR = 30, MCS = 15, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m15 -r106 -R106 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.2 "T2 LDPC offload: SNR = 30, MCS = 15, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m15 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.3 "CPU: SNR = 30, MCS = 25, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m25 -r106 -R106 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.3 "T2 LDPC offload: SNR = 30, MCS = 25, 106 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m25 -r106 -R106 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.4 "CPU: SNR = 30, MCS = 5, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.4 "T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.5 "CPU: SNR = 30, MCS = 15, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.5 "T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.6 "CPU: SNR = 30, MCS = 25, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.6 "T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 1 layer" nr_ulsim -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.7 "CPU: SNR = 30, MCS = 5, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -W2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.7 "T2 LDPC offload: SNR = 30, MCS = 5, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m5 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.8 "CPU: SNR = 30, MCS = 15, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -W2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.8 "T2 LDPC offload: SNR = 30, MCS = 15, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m15 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testCPU.9 "CPU: SNR = 30, MCS = 25, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -W2 -z2 -y2 -P) +add_timed_physim_test(physim.5g-offload.nr_ulsim.testT2.9 "T2 LDPC offload: SNR = 30, MCS = 25, 273 PRBs, 2 layers" nr_ulsim -n1000 -s30 -S30.2 -m25 -r273 -R273 -C10 -W2 -z2 -y2 -P --loader.ldpc.shlibversion _aal --nrLDPC_coding_aal.dpdk_dev af:00.0 --nrLDPC_coding_aal.dpdk_core_list 11-12 --nrLDPC_coding_aal.is_t2 1) + +include(ThresholdsOffload.cmake) + +endif() diff --git a/openair1/SIMULATION/tests/RunTimedTest.cmake b/openair1/SIMULATION/tests/RunTimedTest.cmake new file mode 100644 index 0000000000..779d781bec --- /dev/null +++ b/openair1/SIMULATION/tests/RunTimedTest.cmake @@ -0,0 +1,41 @@ +# this script expects +# - TEST_CMD (program + options) +# - CHECK_SCRIPT (path to analyze-timing.sh) +# further, it analyzes the (test-specific) environment for CHECK_0, CHECK_1, +# etc. to construct the input to the check script. + +# the calling process writes env vars CHECK_0, CHECK_1, ... +# each has "condition;threshold" as it's content +# combine all necessary CHECK0, CHECK1, ... into a single array CHECKS +# to be passed to the check script +foreach(count RANGE 9) + set(CHECK "CHECK_${count}") + if (NOT DEFINED ENV{${CHECK}}) + break() + endif() + list(APPEND CHECKS "$ENV{${CHECK}}") +endforeach() + +# execute the actual test command TEST_CMD and pipe its output into the +# check script. Afterwards, check both commands return codes. +execute_process(COMMAND ${TEST_CMD} + COMMAND ${CHECK_SCRIPT} ${CHECKS} + COMMAND_ECHO STDOUT + RESULTS_VARIABLE RET_CODES +) +list(LENGTH RET_CODES LEN_RET_CODES) +if(NOT LEN_RET_CODES EQUAL 2) + message(SEND_ERROR "execute_process() did not run both commands!") +endif() + +list(GET RET_CODES 0 TEST_RET_CODE) +message(STATUS "test command finished with ${TEST_RET_CODE}") +if(NOT ${TEST_RET_CODE} MATCHES "0") + message(SEND_ERROR " => test failed!") +endif() + +list(GET RET_CODES 1 CHECK_RET_CODE) +message(STATUS "check command finished with ${CHECK_RET_CODE}") +if(NOT ${CHECK_RET_CODE} MATCHES "0") + message(SEND_ERROR " => check failed!") +endif() diff --git a/openair1/SIMULATION/tests/ThresholdsOffload.cmake b/openair1/SIMULATION/tests/ThresholdsOffload.cmake new file mode 100644 index 0000000000..72b2ee2569 --- /dev/null +++ b/openair1/SIMULATION/tests/ThresholdsOffload.cmake @@ -0,0 +1,43 @@ +check_threshold(physim.5g-offload.nr_dlsim.testCPU.1 "DLSCH encoding time" "< 230") +check_threshold(physim.5g-offload.nr_dlsim.testT2.1 "DLSCH encoding time" "< 100") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.2 "DLSCH encoding time" "< 300") +check_threshold(physim.5g-offload.nr_dlsim.testT2.2 "DLSCH encoding time" "< 100") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.3 "DLSCH encoding time" "< 350") +check_threshold(physim.5g-offload.nr_dlsim.testT2.3 "DLSCH encoding time" "< 200") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.4 "DLSCH encoding time" "< 300") +check_threshold(physim.5g-offload.nr_dlsim.testT2.4 "DLSCH encoding time" "< 150") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.5 "DLSCH encoding time" "< 350") +check_threshold(physim.5g-offload.nr_dlsim.testT2.5 "DLSCH encoding time" "< 250") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.6 "DLSCH encoding time" "< 400") +check_threshold(physim.5g-offload.nr_dlsim.testT2.6 "DLSCH encoding time" "< 400") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.7 "DLSCH encoding time" "< 400") +check_threshold(physim.5g-offload.nr_dlsim.testT2.7 "DLSCH encoding time" "< 200") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.8 "DLSCH encoding time" "< 450") +check_threshold(physim.5g-offload.nr_dlsim.testT2.8 "DLSCH encoding time" "< 500") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.9 "DLSCH encoding time" "< 500") +check_threshold(physim.5g-offload.nr_dlsim.testT2.9 "DLSCH encoding time" "< 500") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.10 "DLSCH encoding time" "< 400") +check_threshold(physim.5g-offload.nr_dlsim.testT2.10 "DLSCH encoding time" "< 200") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.11 "DLSCH encoding time" "< 400") +check_threshold(physim.5g-offload.nr_dlsim.testT2.11 "DLSCH encoding time" "< 300") +check_threshold(physim.5g-offload.nr_dlsim.testCPU.12 "DLSCH encoding time" "< 450") +check_threshold(physim.5g-offload.nr_dlsim.testT2.12 "DLSCH encoding time" "< 450") + +check_threshold(physim.5g-offload.nr_ulsim.testCPU.1 "ULSCH total decoding time" "< 300") +check_threshold(physim.5g-offload.nr_ulsim.testT2.1 "ULSCH total decoding time" "< 100") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.2 "ULSCH total decoding time" "< 300") +check_threshold(physim.5g-offload.nr_ulsim.testT2.2 "ULSCH total decoding time" "< 150") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.3 "ULSCH total decoding time" "< 250") +check_threshold(physim.5g-offload.nr_ulsim.testT2.3 "ULSCH total decoding time" "< 250") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.4 "ULSCH total decoding time" "< 300") +check_threshold(physim.5g-offload.nr_ulsim.testT2.4 "ULSCH total decoding time" "< 150") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.5 "ULSCH total decoding time" "< 400") +check_threshold(physim.5g-offload.nr_ulsim.testT2.5 "ULSCH total decoding time" "< 350") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.6 "ULSCH total decoding time" "< 400") +check_threshold(physim.5g-offload.nr_ulsim.testT2.6 "ULSCH total decoding time" "< 550") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.7 "ULSCH total decoding time" "< 300") +check_threshold(physim.5g-offload.nr_ulsim.testT2.7 "ULSCH total decoding time" "< 250") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.8 "ULSCH total decoding time" "< 600") +check_threshold(physim.5g-offload.nr_ulsim.testT2.8 "ULSCH total decoding time" "< 650") +check_threshold(physim.5g-offload.nr_ulsim.testCPU.9 "ULSCH total decoding time" "< 650") +check_threshold(physim.5g-offload.nr_ulsim.testT2.9 "ULSCH total decoding time" "< 1100") diff --git a/openair1/SIMULATION/tests/analyze-timing.sh b/openair1/SIMULATION/tests/analyze-timing.sh new file mode 100755 index 0000000000..2ca45f346f --- /dev/null +++ b/openair1/SIMULATION/tests/analyze-timing.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# This bash script builds an awk script. The awk script tries to match +# (provided) patterns and compares them against given thresholds condition +# (e.g., threshold is "< 10"). + +function die() { echo $@ 1>&2; exit 1; } + +# RC will be the return code. If any rule fails, it will set RC=1, which will +# make the script fail. Print also every line, because the logs are piped into +# this script, but a user is typically also interested into the raw logs. +SCRIPT=' + BEGIN { RC = 0; } + + { print $0 } +' + +NUM=0 +# for each pair of /, add corresponding rules. +while [ $# -gt 0 ]; do + [ $# -ne 1 ] || die "unmatched /" + PATTERN=${1} + COND=${2} + shift 2 + + # Add a rule that searches for a PATTERN + number, and checks against + # CONDition. If the condition does not hold, it is counted as a failure (sets + # RC to signal error). In both cases, the result is logged in an array to + # output at the end of the script. + # + # Example: pattern "PHY proc tx", condition "< 200" + # The awk script tries to match every line for "PHY proc tx _NUMBER_" (where + # number is a decimal), and compares _NUMBER_ against condition "< 200", + # i.e., "_NUMBER_ < 200". + # If the condition holds, will set "CHECK PHY proc tx _NUMBER_ < 200 SUCCESS". + # If the condition fails, will set "CHECK PHY proc tx _NUMBER_ < 200 FAIL". + SCRIPT+=' + match($0, /'${PATTERN}' +([0-9]+(\.[0-9]+)?)/, n) { + if (n[1] '${COND}') { + r = "SUCCESS"; + } else { + r = "FAIL"; + RC = 1; + } + RESULTS['${NUM}']=sprintf("CHECK %-35s %7.2f %-8s %s", "'${PATTERN}'", n[1], " '${COND}'", r); + } +' + + # Generate an additional rule for the end of the logs: if the pattern is not + # found, it is counted as a failure and logged appropriately. + # Following the above example "PHY proc tx" and "< 200": if such log is not + # found, will set "CHECK PHY proc tx < 200 NOTFOUND" + SCRIPT+=' + END { + if (!RESULTS['${NUM}']) { + RESULTS['${NUM}']=sprintf("CHECK %-35s %-7s NOTFOUND", "'${PATTERN}'", "'${COND}'"); + RC = 1; + } + } +' + + let NUM=${NUM}+1 +done + +# After passing through all logs, print all results, and exit with return code +# (0 on success, i.e..all conditions checked, otherwise 1 on failure). +SCRIPT+=' + END { + for (i = 0; i < '${NUM}'; ++i) { + print RESULTS[i] + } + exit RC + } +' + +# Read from separate file descriptor 3: this allows us to pipe the actual log +# to analyze into awk (by using the script like so: analyze-timing.sh < log) +awk -f /dev/fd/3 3<<< ${SCRIPT} diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 635fd2345d..3ee858ecca 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -82,6 +82,8 @@ #define QOSFLOW_MAX_VALUE 64 +#define NGAP_MAX_NO_TAI_PAGING 16 // 9.2.4.1 3GPP TS 38.413 + /* Security key length used within gNB * Even if only 16 bytes will be effectively used, * the key length is 32 bytes (256 bits) @@ -206,12 +208,6 @@ typedef struct fiveg_s_tmsi_s { uint32_t m_tmsi; } fiveg_s_tmsi_t; -typedef struct ngap_tai_plmn_identity_s { - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; -} ngap_plmn_identity_t; - typedef struct ngap_ue_paging_identity_s { fiveg_s_tmsi_t s_tmsi; } ngap_ue_paging_identity_t; @@ -228,7 +224,7 @@ typedef struct ngap_ue_identity_s { } ngap_ue_identity_t; typedef struct ngap_mobility_restriction_s{ - ngap_plmn_identity_t serving_plmn; + plmn_id_t serving_plmn; }ngap_mobility_restriction_t; typedef enum pdusession_qosflow_mapping_ind_e{ @@ -600,10 +596,10 @@ typedef struct ngap_paging_ind_s { ngap_cn_domain_t cn_domain; /* PLMN_identity in TAI of Paging*/ - ngap_plmn_identity_t plmn_identity[256]; + plmn_id_t plmn_identity[NGAP_MAX_NO_TAI_PAGING]; /* TAC in TAIList of Paging*/ - int16_t tac[256]; + int16_t tac[NGAP_MAX_NO_TAI_PAGING]; /* size of TAIList*/ int16_t tai_size; diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 1525c31b9a..28d5f71ff9 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -136,53 +136,6 @@ #define GNB_CONFIG_STRING_TA_COMMONDRIFT "ta-CommonDrift-r17" #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} - -/* Serving Cell Config Dedicated */ -#define GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED "servingCellConfigDedicated" -#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0 "dl_ptrsFreqDensity0_0" -#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0 "dl_ptrsFreqDensity1_0" -#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0 "dl_ptrsTimeDensity0_0" -#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0 "dl_ptrsTimeDensity1_0" -#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0 "dl_ptrsTimeDensity2_0" -#define GNB_CONFIG_STRING_DLPTRSEPRERATIO_0 "dl_ptrsEpreRatio_0" -#define GNB_CONFIG_STRING_DLPTRSREOFFSET_0 "dl_ptrsReOffset_0" -#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0 "ul_ptrsFreqDensity0_0" -#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0 "ul_ptrsFreqDensity1_0" -#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0 "ul_ptrsTimeDensity0_0" -#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0 "ul_ptrsTimeDensity1_0" -#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0 "ul_ptrsTimeDensity2_0" -#define GNB_CONFIG_STRING_ULPTRSREOFFSET_0 "ul_ptrsReOffset_0" -#define GNB_CONFIG_STRING_ULPTRSMAXPORTS_0 "ul_ptrsMaxPorts_0" -#define GNB_CONFIG_STRING_ULPTRSPOWER_0 "ul_ptrsPower_0" - -#define GNB_CONFIG_STRING_DLBWP1_ID "dl_bwp-Id_1" -#define GNB_CONFIG_STRING_DLBWP2_ID "dl_bwp-Id_2" -#define GNB_CONFIG_STRING_DLBWP3_ID "dl_bwp-Id_3" -#define GNB_CONFIG_STRING_DLBWP4_ID "dl_bwp-Id_4" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP1 "dl_bwp1_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP2 "dl_bwp2_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP3 "dl_bwp3_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP4 "dl_bwp4_locationAndBandwidth" -#define GNB_CONFIG_STRING_SCS_DLBWP1 "dl_bwp1_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_DLBWP2 "dl_bwp2_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_DLBWP3 "dl_bwp3_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_DLBWP4 "dl_bwp4_subcarrierSpacing" -#define GNB_CONFIG_STRING_FIRSTACTIVEDLBWP_ID "firstActiveDownlinkBWP-Id" -#define GNB_CONFIG_STRING_DEFAULTDLBWP_ID "defaultDownlinkBWP-Id" -#define GNB_CONFIG_STRING_ULBWP1_ID "ul_bwp-Id_1" -#define GNB_CONFIG_STRING_ULBWP2_ID "ul_bwp-Id_2" -#define GNB_CONFIG_STRING_ULBWP3_ID "ul_bwp-Id_3" -#define GNB_CONFIG_STRING_ULBWP4_ID "ul_bwp-Id_4" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP1 "ul_bwp1_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP2 "ul_bwp2_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP3 "ul_bwp3_locationAndBandwidth" -#define GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP4 "ul_bwp4_locationAndBandwidth" -#define GNB_CONFIG_STRING_SCS_ULBWP1 "ul_bwp1_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_ULBWP2 "ul_bwp2_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_ULBWP3 "ul_bwp3_subcarrierSpacing" -#define GNB_CONFIG_STRING_SCS_ULBWP4 "ul_bwp4_subcarrierSpacing" -#define GNB_CONFIG_STRING_FIRSTACTIVEULBWP_ID "firstActiveUplinkBWP-Id" - /*--------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -272,53 +225,6 @@ {GNB_CONFIG_STRING_NROFUPLINKSLOTS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSlots,.defint64val=-1,TYPE_INT64,0},\ {GNB_CONFIG_STRING_NROFUPLINKSYMBOLS2,NULL, 0,.i64ptr=&pattern2.nrofUplinkSymbols,.defint64val=-1,TYPE_INT64,0}} -/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* Serving Cell Config Dedicated configuration parameters */ -/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ - -#define SCDPARAMS_DESC(scd) { \ -{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[0],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[1],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[0],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[1],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[2],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSEPRERATIO_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio,.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLPTRSREOFFSET_0,NULL,0,.i64ptr=scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset,.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[0],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[1],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[0],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[1],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[2],.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSREOFFSET_0,NULL,0,.i64ptr=scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset,.defint64val=-1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSMAXPORTS_0,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->maxNrofPorts,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULPTRSPOWER_0,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->ptrs_Power,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_FIRSTACTIVEDLBWP_ID,NULL,0,.i64ptr=scd->firstActiveDownlinkBWP_Id,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_FIRSTACTIVEULBWP_ID,NULL,0,.i64ptr=scd->uplinkConfig->firstActiveUplinkBWP_Id,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLBWP1_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Id,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLBWP2_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Id,.defint64val=2,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLBWP3_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Id,.defint64val=3,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DLBWP4_ID,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Id,.defint64val=4,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_DLBWP1,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_DLBWP2,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_DLBWP3,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_DLBWP4,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP1,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP2,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP3,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_DLBWP4,NULL,0,.i64ptr=&scd->downlinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULBWP1_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Id,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULBWP2_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Id,.defint64val=2,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULBWP3_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Id,.defint64val=3,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_ULBWP4_ID,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Id,.defint64val=4,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_ULBWP1,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_ULBWP2,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_ULBWP3,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_SCS_ULBWP4,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.subcarrierSpacing,.defint64val=1,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP1,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP2,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[1]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP3,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[2]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_LOCATIONANDBANDWIDTH_ULBWP4,NULL,0,.i64ptr=&scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[3]->bwp_Common->genericParameters.locationAndBandwidth,.defint64val=0,TYPE_INT64,0}, \ -{GNB_CONFIG_STRING_DEFAULTDLBWP_ID,NULL,0,.i64ptr=scd->defaultDownlinkBWP_Id,.defint64val=0,TYPE_INT64,0}} /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Serving Cell Config Common configuration parameters to apply in RA 2-Step */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 94e9012855..dcd17efe22 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -661,233 +661,6 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc, uint64_t ssbmap) } } -/* Function to allocate dedicated serving cell config strutures */ -void prepare_scd(NR_ServingCellConfig_t *scd) { - // Allocate downlink structures - scd->downlinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*scd->downlinkBWP_ToAddModList)); - scd->uplinkConfig = calloc_or_fail(1, sizeof(*scd->uplinkConfig)); - scd->uplinkConfig->uplinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*scd->uplinkConfig->uplinkBWP_ToAddModList)); - scd->bwp_InactivityTimer = calloc_or_fail(1, sizeof(*scd->bwp_InactivityTimer)); - scd->uplinkConfig->firstActiveUplinkBWP_Id = calloc_or_fail(1, sizeof(*scd->uplinkConfig->firstActiveUplinkBWP_Id)); - scd->firstActiveDownlinkBWP_Id = calloc_or_fail(1, sizeof(*scd->firstActiveDownlinkBWP_Id)); - *scd->firstActiveDownlinkBWP_Id = 1; - *scd->uplinkConfig->firstActiveUplinkBWP_Id = 1; - scd->defaultDownlinkBWP_Id = calloc_or_fail(1, sizeof(*scd->defaultDownlinkBWP_Id)); - *scd->defaultDownlinkBWP_Id = 0; - - for (int j = 0; j < NR_MAX_NUM_BWP; j++) { - - // Downlink bandwidth part - NR_BWP_Downlink_t *bwp = calloc_or_fail(1, sizeof(*bwp)); - bwp->bwp_Id = j+1; - - // Allocate downlink dedicated bandwidth part and PDSCH structures - bwp->bwp_Common = calloc_or_fail(1, sizeof(*bwp->bwp_Common)); - bwp->bwp_Common->pdcch_ConfigCommon = calloc_or_fail(1, sizeof(*bwp->bwp_Common->pdcch_ConfigCommon)); - bwp->bwp_Common->pdsch_ConfigCommon = calloc_or_fail(1, sizeof(*bwp->bwp_Common->pdsch_ConfigCommon)); - bwp->bwp_Dedicated = calloc_or_fail(1, sizeof(*bwp->bwp_Dedicated)); - bwp->bwp_Dedicated->pdsch_Config = calloc_or_fail(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config)); - struct NR_SetupRelease_PDSCH_Config *pdsch_Config = bwp->bwp_Dedicated->pdsch_Config; - pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; - pdsch_Config->choice.setup = calloc_or_fail(1, sizeof(*pdsch_Config->choice.setup)); - struct NR_PDSCH_Config *pc_setup = pdsch_Config->choice.setup; - pc_setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc_or_fail(1, sizeof(*pc_setup->dmrs_DownlinkForPDSCH_MappingTypeA)); - struct NR_SetupRelease_DMRS_DownlinkConfig *typeA = pc_setup->dmrs_DownlinkForPDSCH_MappingTypeA; - typeA->present = NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; - - // Allocate DL DMRS and PTRS configuration - typeA->choice.setup = calloc_or_fail(1, sizeof(*typeA->choice.setup)); - NR_DMRS_DownlinkConfig_t *NR_DMRS_DownlinkCfg = typeA->choice.setup; - NR_DMRS_DownlinkCfg->phaseTrackingRS = calloc_or_fail(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS)); - NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; - NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = - calloc_or_fail(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); - NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; - NR_PTRS_DownlinkCfg->frequencyDensity = calloc_or_fail(1, sizeof(*NR_PTRS_DownlinkCfg->frequencyDensity)); - for (int i=0;i<2;i++) { - long *a = calloc_or_fail(1, sizeof(*a)); - asn1cSeqAdd(&NR_PTRS_DownlinkCfg->frequencyDensity->list, a); - } - NR_PTRS_DownlinkCfg->timeDensity = calloc_or_fail(1, sizeof(*NR_PTRS_DownlinkCfg->timeDensity)); - for (int i=0;i<3;i++) { - long *dl_mcs = calloc_or_fail(1, sizeof(*dl_mcs)); - asn1cSeqAdd(&NR_PTRS_DownlinkCfg->timeDensity->list, dl_mcs); - } - NR_PTRS_DownlinkCfg->epre_Ratio = calloc_or_fail(1, sizeof(*NR_PTRS_DownlinkCfg->epre_Ratio)); - NR_PTRS_DownlinkCfg->resourceElementOffset = calloc_or_fail(1, sizeof(*NR_PTRS_DownlinkCfg->resourceElementOffset)); - *NR_PTRS_DownlinkCfg->resourceElementOffset = 0; - asn1cSeqAdd(&scd->downlinkBWP_ToAddModList->list,bwp); - - // Allocate uplink structures - - NR_PUSCH_Config_t *pusch_Config = calloc_or_fail(1, sizeof(*pusch_Config)); - - // Allocate UL DMRS and PTRS structures - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc_or_fail(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB)); - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup; - pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = - calloc_or_fail(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); - NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - NR_DMRS_UplinkConfig->phaseTrackingRS = calloc_or_fail(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS)); - NR_DMRS_UplinkConfig->phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; - NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup = - calloc_or_fail(1, sizeof(*NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup)); - NR_PTRS_UplinkConfig_t *NR_PTRS_UplinkConfig = NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup; - NR_PTRS_UplinkConfig->transformPrecoderDisabled = calloc_or_fail(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); - NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = - calloc_or_fail(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); - for (int i=0;i<2;i++) { - long *n_rbs = calloc_or_fail(1, sizeof(*n_rbs)); - asn1cSeqAdd(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, n_rbs); - } - NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = - calloc_or_fail(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); - for (int i = 0; i < 3; i++) { - long *ptrs_mcs = calloc_or_fail(1, sizeof(*ptrs_mcs)); - asn1cSeqAdd(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, ptrs_mcs); - } - NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = - calloc_or_fail(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); - *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; - - // UL bandwidth part - NR_BWP_Uplink_t *ubwp = calloc_or_fail(1, sizeof(*ubwp)); - ubwp->bwp_Id = j+1; - ubwp->bwp_Common = calloc_or_fail(1, sizeof(*ubwp->bwp_Common)); - ubwp->bwp_Dedicated = calloc_or_fail(1, sizeof(*ubwp->bwp_Dedicated)); - - ubwp->bwp_Dedicated->pusch_Config = calloc_or_fail(1, sizeof(*ubwp->bwp_Dedicated->pusch_Config)); - ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup; - ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config; - - asn1cSeqAdd(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp); - } -} - -/* This function checks dedicated serving cell configuration and performs fixes as needed */ -void fix_scd(NR_ServingCellConfig_t *scd) { - - // Remove unused BWPs - int b = 0; - while (bdownlinkBWP_ToAddModList->list.count) { - if (scd->downlinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) { - ASN_STRUCT_FREE(asn_DEF_NR_BWP_Downlink, scd->downlinkBWP_ToAddModList->list.array[b]); - asn_sequence_del(&scd->downlinkBWP_ToAddModList->list,b,1); - } else { - b++; - } - } - - b = 0; - while (buplinkConfig->uplinkBWP_ToAddModList->list.count) { - if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) { - ASN_STRUCT_FREE(asn_DEF_NR_BWP_Uplink, scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[b]); - asn_sequence_del(&scd->uplinkConfig->uplinkBWP_ToAddModList->list,b,1); - } else { - b++; - } - } - - // Check for DL PTRS parameters validity - for (int bwp_i = 0 ; bwp_idownlinkBWP_ToAddModList->list.count; bwp_i++) { - - NR_DMRS_DownlinkConfig_t *dmrs_dl_config = scd->downlinkBWP_ToAddModList->list.array[bwp_i]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - - if (dmrs_dl_config->phaseTrackingRS) { - // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present - for (int i = dmrs_dl_config->phaseTrackingRS->choice.setup->frequencyDensity->list.count - 1; i >= 0; i--) { - if ((*dmrs_dl_config->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] < 1) - || (*dmrs_dl_config->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] > 276)) { - LOG_I(GNB_APP, "DL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); - free(dmrs_dl_config->phaseTrackingRS); - dmrs_dl_config->phaseTrackingRS = NULL; - break; - } - } - } - - if (dmrs_dl_config->phaseTrackingRS) { - // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present - for (int i = dmrs_dl_config->phaseTrackingRS->choice.setup->timeDensity->list.count - 1; i >= 0; i--) { - if ((*dmrs_dl_config->phaseTrackingRS->choice.setup->timeDensity->list.array[i] < 0) - || (*dmrs_dl_config->phaseTrackingRS->choice.setup->timeDensity->list.array[i] > 29)) { - LOG_I(GNB_APP, "DL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); - free(dmrs_dl_config->phaseTrackingRS); - dmrs_dl_config->phaseTrackingRS = NULL; - break; - } - } - } - - if (dmrs_dl_config->phaseTrackingRS) { - if (*dmrs_dl_config->phaseTrackingRS->choice.setup->resourceElementOffset > 2) { - LOG_I(GNB_APP, "Freeing DL PTRS resourceElementOffset \n"); - free(dmrs_dl_config->phaseTrackingRS->choice.setup->resourceElementOffset); - dmrs_dl_config->phaseTrackingRS->choice.setup->resourceElementOffset = NULL; - } - if (*dmrs_dl_config->phaseTrackingRS->choice.setup->epre_Ratio > 1) { - LOG_I(GNB_APP, "Freeing DL PTRS epre_Ratio \n"); - free(dmrs_dl_config->phaseTrackingRS->choice.setup->epre_Ratio); - dmrs_dl_config->phaseTrackingRS->choice.setup->epre_Ratio = NULL; - } - } - } - - // Check for UL PTRS parameters validity - for (int bwp_i = 0 ; bwp_iuplinkConfig->uplinkBWP_ToAddModList->list.count; bwp_i++) { - - NR_DMRS_UplinkConfig_t *dmrs_ul_config = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_i]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - - if (dmrs_ul_config->phaseTrackingRS) { - // If any of the frequencyDensity values are not set or are out of bounds, PTRS is assumed to be not present - for (int i = dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.count-1; i >= 0; i--) { - if ((*dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[i] < 1) - || (*dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[i] > 276)) { - LOG_I(GNB_APP, "UL PTRS frequencyDensity %d not set. Assuming PTRS not present! \n", i); - free(dmrs_ul_config->phaseTrackingRS); - dmrs_ul_config->phaseTrackingRS = NULL; - break; - } - } - } - - if (dmrs_ul_config->phaseTrackingRS) { - // If any of the timeDensity values are not set or are out of bounds, PTRS is assumed to be not present - for (int i = dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.count-1; i >= 0; i--) { - if ((*dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[i] < 0) - || (*dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[i] > 29)) { - LOG_I(GNB_APP, "UL PTRS timeDensity %d not set. Assuming PTRS not present! \n", i); - free(dmrs_ul_config->phaseTrackingRS); - dmrs_ul_config->phaseTrackingRS = NULL; - break; - } - } - } - - if (dmrs_ul_config->phaseTrackingRS) { - // Check for UL PTRS parameters validity - if (*dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset > 2) { - LOG_I(GNB_APP, "Freeing UL PTRS resourceElementOffset \n"); - free(dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset); - dmrs_ul_config->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset = NULL; - } - } - - } - - if (scd->downlinkBWP_ToAddModList->list.count == 0) { - free(scd->downlinkBWP_ToAddModList->list.array); - free(scd->downlinkBWP_ToAddModList); - scd->downlinkBWP_ToAddModList = NULL; - } - - if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.count == 0) { - free(scd->uplinkConfig->uplinkBWP_ToAddModList->list.array); - free(scd->uplinkConfig->uplinkBWP_ToAddModList); - scd->uplinkConfig->uplinkBWP_ToAddModList = NULL; - } -} - static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname) { char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; @@ -1261,39 +1034,6 @@ static NR_ServingCellConfigCommon_t *get_scc_config(configmodule_interface_t *cf return scc; } -static NR_ServingCellConfig_t *get_scd_config(configmodule_interface_t *cfg) -{ - NR_ServingCellConfig_t *scd = calloc(1, sizeof(*scd)); - prepare_scd(scd); - - char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; - snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - GET_PARAMS_LIST(SCDsParamList, SCDsParams, SCDPARAMS_DESC(scd), GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, aprefix); - - if (SCDsParamList.numelt > 0) { - snprintf(aprefix, sizeof(aprefix), "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); - GET_PARAMS(SCDsParams, SCDPARAMS_DESC(scd), aprefix); - const NR_BWP_UplinkDedicated_t *bwp_Dedicated = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated; - const NR_PTRS_UplinkConfig_t *setup = - bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup; - LOG_I(RRC, - "Read in ServingCellConfigDedicated UL (FreqDensity_0 %ld, FreqDensity_1 %ld, TimeDensity_0 %ld, TimeDensity_1 %ld, " - "TimeDensity_2 %ld, RE offset %ld, First_active_BWP_ID %ld SCS %ld, LocationandBW %ld\n", - *setup->transformPrecoderDisabled->frequencyDensity->list.array[0], - *setup->transformPrecoderDisabled->frequencyDensity->list.array[1], - *setup->transformPrecoderDisabled->timeDensity->list.array[0], - *setup->transformPrecoderDisabled->timeDensity->list.array[1], - *setup->transformPrecoderDisabled->timeDensity->list.array[2], - *setup->transformPrecoderDisabled->resourceElementOffset, - *scd->firstActiveDownlinkBWP_Id, - scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing, - scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth); - } - fix_scd(scd); - - return scd; -} - static int read_du_cell_info(configmodule_interface_t *cfg, bool separate_du, uint32_t *gnb_id, @@ -1465,6 +1205,49 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, return req; } +static nr_ptrs_config_t *get_ptrs_config(int gnb_idx) +{ + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + snprintf(aprefix, sizeof(aprefix), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + GET_PARAMS_LIST(ptrs_ParamsList, ptrs_Params, GNB_PTRS_PARAMS_DESC, GNB_CONFIG_STRING_PTRS, aprefix); + if (ptrs_ParamsList.numelt == 0) { + LOG_I(GNB_APP, "No PTRS configuration found\n"); + return NULL; + } + nr_ptrs_config_t *ptrs = calloc_or_fail(1, sizeof(*ptrs)); + ptrs->dl_FreqDensity0_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSFREQDENSITY0_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_FreqDensity0_0 %d\n", ptrs->dl_FreqDensity0_0); + ptrs->dl_FreqDensity1_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSFREQDENSITY1_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_FreqDensity1_0 %d\n", ptrs->dl_FreqDensity1_0); + ptrs->dl_TimeDensity0_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSTIMEDENSITY0_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_TimeDensity0_0 %d\n", ptrs->dl_TimeDensity0_0); + ptrs->dl_TimeDensity1_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSTIMEDENSITY1_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_TimeDensity1_0 %d\n", ptrs->dl_TimeDensity1_0); + ptrs->dl_TimeDensity2_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSTIMEDENSITY2_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_TimeDensity2_0 %d\n", ptrs->dl_TimeDensity2_0); + ptrs->dl_EpreRatio_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSEPRERATIO_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_EpreRatio_0 %d\n", ptrs->dl_EpreRatio_0); + ptrs->dl_ReOffset_0 = *ptrs_ParamsList.paramarray[0][GNB_DLPTRSREOFFSET_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: dl_ReOffset_0 %d\n", ptrs->dl_ReOffset_0); + ptrs->ul_FreqDensity0_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSFREQDENSITY0_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_FreqDensity0_0 %d\n", ptrs->ul_FreqDensity0_0); + ptrs->ul_FreqDensity1_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSFREQDENSITY1_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_FreqDensity1_0 %d\n", ptrs->ul_FreqDensity1_0); + ptrs->ul_TimeDensity0_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSTIMEDENSITY0_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_TimeDensity0_0 %d\n", ptrs->ul_TimeDensity0_0); + ptrs->ul_TimeDensity1_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSTIMEDENSITY1_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_TimeDensity1_0 %d\n", ptrs->ul_TimeDensity1_0); + ptrs->ul_TimeDensity2_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSTIMEDENSITY2_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_TimeDensity2_0 %d\n", ptrs->ul_TimeDensity2_0); + ptrs->ul_ReOffset_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSREOFFSET_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_ReOffset_0 %d\n", ptrs->ul_ReOffset_0); + ptrs->ul_MaxPorts_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSMAXPORTS_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_MaxPorts_0 %d\n", ptrs->ul_MaxPorts_0); + ptrs->ul_Power_0 = *ptrs_ParamsList.paramarray[0][GNB_ULPTRSPOWER_0_IDX].iptr; + LOG_I(GNB_APP, "PTRS configuration: ul_Power_0 %d\n", ptrs->ul_Power_0); + return ptrs; +} + static nr_redcap_config_t *get_redcap_config(int gnb_idx) { paramdef_t RedCap_Params[] = GNB_REDCAP_PARAMS_DESC; @@ -1479,7 +1262,7 @@ static nr_redcap_config_t *get_redcap_config(int gnb_idx) // Check for default/non-existing values in configuration file if (*RedCap_Params[GNB_REDCAP_CELL_BARRED_REDCAP1_RX_R17_IDX].i8ptr == -1 || *RedCap_Params[GNB_REDCAP_CELL_BARRED_REDCAP2_RX_R17_IDX].i8ptr == -1) { - LOG_I(NR_MAC, "No RedCap configuration found\n"); + LOG_I(GNB_APP, "No RedCap configuration found\n"); return NULL; } @@ -1571,6 +1354,31 @@ void config_pdcp(configmodule_interface_t *cfg, nr_pdcp_configuration_t *pdcp_co pdcp_config->drb.discard_timer = config_get_processedint(cfg, &pdcp_params[CONFIG_NR_PDCP_DRB_DISCARD_TIMER_IDX]); } +static void get_bwp_config(nr_mac_config_t *configuration) +{ + char path[MAX_OPTNAME_SIZE * 2 + 8]; + snprintf(path, sizeof(path), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + GET_PARAMS_LIST(BWPParamList, BWPParams, GNBBWPPARAMS_DESC, GNB_CONFIG_STRING_BWP_LIST, path, BWPPARAMS_CHECK); + configuration->num_additional_bwps = BWPParamList.numelt; + AssertFatal(configuration->num_additional_bwps >= 0 && configuration->num_additional_bwps <= 4, + "Invalid number of additional BWPs %d\n", + configuration->num_additional_bwps); + for (int i = 0; i < configuration->num_additional_bwps; i++) { + configuration->bwp_config[i].id = i + 1; + int bwp_start = *BWPParamList.paramarray[i][GNB_BWP_START_IDX].iptr; + int bwp_size = *BWPParamList.paramarray[i][GNB_BWP_SIZE_IDX].iptr; + configuration->bwp_config[i].location_and_bw = PRBalloc_to_locationandbandwidth(bwp_size, bwp_start); + configuration->bwp_config[i].scs = *BWPParamList.paramarray[i][GNB_BWP_SCS_IDX].iptr; + LOG_I(GNB_APP, + "BWP %d, start PRB %d size %d locationandbandwidth %d, scs %d\n", + configuration->bwp_config[i].id, + bwp_start, + bwp_size, + configuration->bwp_config[i].location_and_bw, + configuration->bwp_config[i].scs); + } +} + void RCconfig_nr_macrlc(configmodule_interface_t *cfg) { int j = 0; @@ -1596,6 +1404,12 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) config.pdsch_AntennaPorts.XP, config.pusch_AntennaPorts); + // BWP + get_bwp_config(&config); + AssertFatal(config.num_additional_bwps <= 4, "Impossible to configure more than 4 additional BWPs\n"); + config.first_active_bwp = *GNBParamList.paramarray[0][GNB_1ST_ACTIVE_BWP_IDX].iptr; + AssertFatal(config.first_active_bwp <= config.num_additional_bwps, "1st active BWP does not belog to the configured BWPs\n"); + // RU GET_PARAMS_LIST(RUParamList, RUParams, RUPARAMS_DESC, CONFIG_STRING_RU_LIST, NULL); int num_tx = 0; @@ -1604,8 +1418,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) num_tx += *(RUParamList.paramarray[i][RU_NB_TX_IDX].uptr); AssertFatal(num_tx >= config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2, "Number of logical antenna ports (set in config file with pdsch_AntennaPorts) cannot be larger than physical antennas (nb_tx)\n"); - } - else { + } else { // TODO temporary solution for 3rd party RU or nFAPI, in which case we don't have RU section present in the config file num_tx = config.pdsch_AntennaPorts.XP * config.pdsch_AntennaPorts.N1 * config.pdsch_AntennaPorts.N2; LOG_E(GNB_APP, "RU information not present in config file. Assuming physical antenna ports equal to logical antenna ports %d\n", num_tx); @@ -1641,6 +1454,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) AssertFatal(config.maxMIMO_layers != 0 && config.maxMIMO_layers <= tot_ant, "Invalid maxMIMO_layers %d\n", config.maxMIMO_layers); config.redcap = get_redcap_config(0); + config.ptrs = get_ptrs_config(0); char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; snprintf(aprefix, sizeof(aprefix), "%s.[%d].%s", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_TIMERS_CONFIG); @@ -1694,7 +1508,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME, config.do_SRS); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); - NR_ServingCellConfig_t *scd = get_scd_config(cfg); if (MacRLC_ParamList.numelt > 0) { /* NR RLC config is needed by mac_top_init_gNB() */ @@ -1702,7 +1515,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) config_rlc(cfg, &default_rlc_config); ngran_node_t node_type = get_node_type(); - mac_top_init_gNB(node_type, scc, scd, &config, &default_rlc_config); + mac_top_init_gNB(node_type, scc, &config, &default_rlc_config); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { @@ -2057,6 +1870,7 @@ static void fill_neighbour_cell_configuration(uint8_t gnb_idx, gNB_RRC_INST *rrc neighbourCell.nrcell_id = (uint64_t) * (NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_NR_CELLID_IDX].u64ptr); neighbourCell.physicalCellId = *NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_PHYSICAL_ID_IDX].uptr; neighbourCell.subcarrierSpacing = *NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_SCS_IDX].uptr; + neighbourCell.band = *NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_BAND_IDX].uptr; neighbourCell.absoluteFrequencySSB = *NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_ABS_FREQ_SSB_IDX].i64ptr; neighbourCell.tac = *NeighbourCellParamList.paramarray[l][GNB_CONFIG_N_CELL_TAC_IDX].uptr; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index b751d78733..373958b1e8 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -138,6 +138,7 @@ typedef enum { #define GNB_CONFIG_STRING_CU_SIB_LIST "cu_sibs" #define GNB_CONFIG_STRING_DU_SIB_LIST "du_sibs" #define GNB_CONFIG_STRING_DOSINR "do_SINR" +#define GNB_CONFIG_STRING_1ST_ACTIVE_BWP "first_active_bwp" #define GNB_CONFIG_HLP_STRING_ENABLE_SDAP "enable the SDAP layer\n" #define GNB_CONFIG_HLP_FORCE256QAMOFF "suppress activation of 256 QAM despite UE support" @@ -153,6 +154,7 @@ typedef enum { #define GNB_CONFIG_HLP_DU_SIBS "List of DU generated SIBs to be transmitted" #define GNB_CONFIG_HLP_DOSINR "Enable CSI feedback using SINR measurements on SSB" + /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -199,6 +201,7 @@ typedef enum { {GNB_CONFIG_STRING_CU_SIB_LIST, GNB_CONFIG_HLP_CU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \ {GNB_CONFIG_STRING_DU_SIB_LIST, GNB_CONFIG_HLP_DU_SIBS, 0, .iptr=NULL, .defintarrayval=0, TYPE_INTARRAY, 0}, \ {GNB_CONFIG_STRING_DOSINR, GNB_CONFIG_HLP_DOSINR, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_1ST_ACTIVE_BWP, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ } // clang-format on @@ -242,6 +245,7 @@ typedef enum { #define GNB_CU_SIBS_IDX 36 #define GNB_DU_SIBS_IDX 37 #define GNB_DO_SINR_IDX 38 +#define GNB_1ST_ACTIVE_BWP_IDX 39 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define NUM_DL_HARQ_OKVALUES {2,4,6,8,10,12,16,32} @@ -287,9 +291,33 @@ typedef enum { { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ } /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ + +#define GNB_CONFIG_STRING_BWP_LIST "bwp_list" + +#define GNB_CONFIG_STRING_BWP_SCS "scs" +#define GNB_CONFIG_STRING_BWP_START "bwpStart" +#define GNB_CONFIG_STRING_BWP_SIZE "bwpSize" + +#define GNB_BWP_SCS_IDX 0 +#define GNB_BWP_START_IDX 1 +#define GNB_BWP_SIZE_IDX 2 + +#define GNBBWPPARAMS_DESC { \ + {GNB_CONFIG_STRING_BWP_SCS, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \ + {GNB_CONFIG_STRING_BWP_START, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \ + {GNB_CONFIG_STRING_BWP_SIZE, NULL, 0, .iptr=NULL, .defintarrayval=0, TYPE_INT, 0}, \ +} + +#define BWPPARAMS_CHECK { \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ +} + /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Neighbour Cell Configurations*/ @@ -308,6 +336,7 @@ typedef enum { #define GNB_CONFIG_STRING_NEIGHBOUR_CELL_PHYSICAL_ID "physical_cellId" #define GNB_CONFIG_STRING_NEIGHBOUR_CELL_ABS_FREQ_SSB "absoluteFrequencySSB" #define GNB_CONFIG_STRING_NEIGHBOUR_CELL_SCS "subcarrierSpacing" +#define GNB_CONFIG_STRING_NEIGHBOUR_CELL_BAND "band" #define GNB_CONFIG_STRING_NEIGHBOUR_TRACKING_ARE_CODE "tracking_area_code" #define GNB_CONFIG_STRING_NEIGHBOUR_PLMN "plmn" @@ -316,7 +345,8 @@ typedef enum { #define GNB_CONFIG_N_CELL_PHYSICAL_ID_IDX 2 #define GNB_CONFIG_N_CELL_ABS_FREQ_SSB_IDX 3 #define GNB_CONFIG_N_CELL_SCS_IDX 4 -#define GNB_CONFIG_N_CELL_TAC_IDX 5 +#define GNB_CONFIG_N_CELL_BAND_IDX 5 +#define GNB_CONFIG_N_CELL_TAC_IDX 6 // clang-format off #define GNBNEIGHBOURCELLPARAMS_DESC { \ /* optname helpstr paramflags XXXptr def val type numelt */ \ @@ -325,6 +355,7 @@ typedef enum { {GNB_CONFIG_STRING_NEIGHBOUR_CELL_PHYSICAL_ID, "neighbour cell physical id", PARAMFLAG_MANDATORY, .uptr=NULL, .defuintval=0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_NEIGHBOUR_CELL_ABS_FREQ_SSB, "neighbour cell abs freq ssb", PARAMFLAG_MANDATORY, .i64ptr=NULL, .defint64val=0, TYPE_INT64, 0}, \ {GNB_CONFIG_STRING_NEIGHBOUR_CELL_SCS, "neighbour cell scs", PARAMFLAG_MANDATORY, .uptr=NULL, .defuintval=0, TYPE_UINT, 0}, \ + {GNB_CONFIG_STRING_NEIGHBOUR_CELL_BAND, "neighbour cell band", PARAMFLAG_MANDATORY, .uptr=NULL, .defuintval=78, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_NEIGHBOUR_TRACKING_ARE_CODE, "neighbour cell tracking area", PARAMFLAG_MANDATORY, .uptr=NULL, .defuintval=0, TYPE_UINT, 0}, \ } // clang-format on @@ -516,6 +547,60 @@ typedef enum { #define GNB_REDCAP_CELL_BARRED_REDCAP2_RX_R17_IDX 1 #define GNB_REDCAP_INTRA_FREQ_RESELECTION_REDCAP_R17_IDX 2 +/*-------------------------------------------------------------------------------------------------------------------------------------*/ +/* PTRS configuration parameters */ +/*-------------------------------------------------------------------------------------------------------------------------------------*/ + +#define GNB_CONFIG_STRING_PTRS "phaseTrackingRS" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0 "dl_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0 "dl_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0 "dl_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0 "dl_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0 "dl_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_DLPTRSEPRERATIO_0 "dl_ptrsEpreRatio_0" +#define GNB_CONFIG_STRING_DLPTRSREOFFSET_0 "dl_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0 "ul_ptrsFreqDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0 "ul_ptrsFreqDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0 "ul_ptrsTimeDensity0_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0 "ul_ptrsTimeDensity1_0" +#define GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0 "ul_ptrsTimeDensity2_0" +#define GNB_CONFIG_STRING_ULPTRSREOFFSET_0 "ul_ptrsReOffset_0" +#define GNB_CONFIG_STRING_ULPTRSMAXPORTS_0 "ul_ptrsMaxPorts_0" +#define GNB_CONFIG_STRING_ULPTRSPOWER_0 "ul_ptrsPower_0" + +#define GNB_PTRS_PARAMS_DESC { \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY0_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSFREQDENSITY1_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY0_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY1_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSTIMEDENSITY2_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSEPRERATIO_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_DLPTRSREOFFSET_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY0_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSFREQDENSITY1_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY0_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY1_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSTIMEDENSITY2_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSREOFFSET_0, NULL, 0, .iptr=NULL, .defintval=-1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSMAXPORTS_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_ULPTRSPOWER_0, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}} + +#define GNB_DLPTRSFREQDENSITY0_0_IDX 0 +#define GNB_DLPTRSFREQDENSITY1_0_IDX 1 +#define GNB_DLPTRSTIMEDENSITY0_0_IDX 2 +#define GNB_DLPTRSTIMEDENSITY1_0_IDX 3 +#define GNB_DLPTRSTIMEDENSITY2_0_IDX 4 +#define GNB_DLPTRSEPRERATIO_0_IDX 5 +#define GNB_DLPTRSREOFFSET_0_IDX 6 +#define GNB_ULPTRSFREQDENSITY0_0_IDX 7 +#define GNB_ULPTRSFREQDENSITY1_0_IDX 8 +#define GNB_ULPTRSTIMEDENSITY0_0_IDX 9 +#define GNB_ULPTRSTIMEDENSITY1_0_IDX 10 +#define GNB_ULPTRSTIMEDENSITY2_0_IDX 11 +#define GNB_ULPTRSREOFFSET_0_IDX 12 +#define GNB_ULPTRSMAXPORTS_0_IDX 13 +#define GNB_ULPTRSPOWER_0_IDX 14 + /*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/ /* SCTP configuration parameters section name */ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c index b9f41a64a3..922a0153d9 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c @@ -138,6 +138,10 @@ static uint8_t set_tdd_bmap_period(const NR_TDD_UL_DL_Pattern_t *pattern, tdd_pe n_ul_slot, n_dl_symbols, n_ul_symbols); + AssertFatal(n_dl_symbols + n_ul_symbols < 14, + "number of mixed slot symbols must be smaller than 14: DL %d, UL %d\n", + n_dl_symbols, + n_ul_symbols); return total_slot; } @@ -174,6 +178,11 @@ static void config_tdd_patterns(const NR_TDD_UL_DL_ConfigCommon_t *tdd, frame_st num_of_patterns, nb_slots_p1, nb_slots_p2); + AssertFatal(nb_slots_p1 + nb_slots_p2 == fs->numb_slots_period, + "total number of slots must equal to %d: p1 %d + p2 %d\n", + fs->numb_slots_period, + nb_slots_p1, + nb_slots_p2); } /** diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index d764f7cb86..bb37c3d582 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -2680,8 +2680,8 @@ static void configure_BWPs(NR_UE_MAC_INST_t *mac, NR_ServingCellConfig_t *scd) if (scd->downlinkBWP_ToReleaseList) { for (int i = 0; i < scd->downlinkBWP_ToReleaseList->list.count; i++) { for (int j = 0; j < mac->dl_BWPs.count; j++) { - if (*scd->downlinkBWP_ToReleaseList->list.array[i] == mac->dl_BWPs.array[i]->bwp_id) - release_dl_BWP(mac, i); + if (*scd->downlinkBWP_ToReleaseList->list.array[i] == mac->dl_BWPs.array[j]->bwp_id) + release_dl_BWP(mac, j); } } } @@ -2702,8 +2702,8 @@ static void configure_BWPs(NR_UE_MAC_INST_t *mac, NR_ServingCellConfig_t *scd) if (scd->uplinkConfig->uplinkBWP_ToReleaseList) { for (int i = 0; i < scd->uplinkConfig->uplinkBWP_ToReleaseList->list.count; i++) { for (int j = 0; j < mac->ul_BWPs.count; j++) { - if (*scd->uplinkConfig->uplinkBWP_ToReleaseList->list.array[i] == mac->ul_BWPs.array[i]->bwp_id) - release_ul_BWP(mac, i); + if (*scd->uplinkConfig->uplinkBWP_ToReleaseList->list.array[i] == mac->ul_BWPs.array[j]->bwp_id) + release_ul_BWP(mac, j); } } } diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 1a43dd2972..3348c6b278 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -198,6 +198,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) // stop any ongoing RACH procedure if (nr_mac->ra.RA_active) { + nr_mac->msg3_C_RNTI = false; nr_mac->ra.ra_state = nrRA_UE_IDLE; nr_mac->ra.RA_active = false; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 741842319e..a4362a346e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -284,7 +284,8 @@ static void configure_ratematching_csi(fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsc int slot, int mu, int slots_per_frame, - const NR_PDSCH_Config_t *pdsch_config) + const NR_PDSCH_Config_t *pdsch_config, + NR_CSI_MeasConfig_t *csi_MeasConfig) { // only for C-RNTI, MCS-C-RNTI, CS-RNTI (and only C-RNTI is supported for now) if (rnti_type != TYPE_C_RNTI_) @@ -319,6 +320,25 @@ static void configure_ratematching_csi(fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsc } } + // Handle NZP CSI-RS for rate matching + if (csi_MeasConfig && csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList) { + for (int i = 0; i < csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list.count; i++) { + NR_NZP_CSI_RS_Resource_t *nzp_res = csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list.array[i]; + if (nzp_res->periodicityAndOffset) { + int period, offset; + csi_period_offset(NULL, nzp_res->periodicityAndOffset, &period, &offset); + if ((frame * slots_per_frame + slot - offset) % period != 0) + continue; + AssertFatal(dlsch_pdu->numCsiRsForRateMatching < NFAPI_MAX_NUM_CSI_RATEMATCH, "csiRsForRateMatching out of bounds\n"); + fapi_nr_dl_config_csirs_pdu_rel15_t *csi_pdu = &dlsch_pdu->csiRsForRateMatching[dlsch_pdu->numCsiRsForRateMatching]; + csi_pdu->csi_type = 1; // NZP CSI-RS + csi_pdu->subcarrier_spacing = mu; + configure_csi_resource_mapping(csi_pdu, &nzp_res->resourceMapping, dlsch_pdu->BWPSize, dlsch_pdu->BWPStart); + dlsch_pdu->numCsiRsForRateMatching++; + } + } + } + for (int i = 0; i < dl_config->number_pdus; i++) { // This assumes that CSI-RS are scheduled before this moment which is true in current implementation const fapi_nr_dl_config_request_pdu_t *csi_req = &dl_config->dl_config_list[i]; @@ -769,8 +789,15 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac, dlsch_pdu->numCsiRsForRateMatching = 0; int slots_frame = mac->frame_structure.numb_slots_frame; - configure_ratematching_csi(dlsch_pdu, dl_config, rnti_type, frame, slot, dlsch_pdu->SubcarrierSpacing, slots_frame, pdsch_config); - + configure_ratematching_csi(dlsch_pdu, + dl_config, + rnti_type, + frame, + slot, + dlsch_pdu->SubcarrierSpacing, + slots_frame, + pdsch_config, + mac->sc_info.csi_MeasConfig); /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ @@ -1105,7 +1132,15 @@ static int nr_ue_process_dci_dl_11(NR_UE_MAC_INST_t *mac, nr_rnti_type_t rnti_type = get_rnti_type(mac, dci_ind->rnti); dlsch_pdu->numCsiRsForRateMatching = 0; int slots_frame = mac->frame_structure.numb_slots_frame; - configure_ratematching_csi(dlsch_pdu, dl_config, rnti_type, frame, slot, current_DL_BWP->scs, slots_frame, pdsch_Config); + configure_ratematching_csi(dlsch_pdu, + dl_config, + rnti_type, + frame, + slot, + current_DL_BWP->scs, + slots_frame, + pdsch_Config, + mac->sc_info.csi_MeasConfig); /* IDENTIFIER_DCI_FORMATS */ /* CARRIER_IND */ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index b95597a0ba..cf7fda5ccf 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2375,7 +2375,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac, int short_bsr_sz = sizeof(NR_BSR_SHORT) + sizeof(NR_MAC_SUBHEADER_FIXED); int num_lcg_id_with_data = 0; for (int lcg_id = 0; lcg_id < NR_MAX_NUM_LCGID; lcg_id++) - num_lcg_id_with_data += LCG_bytes > 0; + num_lcg_id_with_data += LCG_bytes[lcg_id] > 0; int long_bsr_sz = num_lcg_id_with_data + sizeof(NR_BSR_LONG) + sizeof(NR_MAC_SUBHEADER_SHORT); if (num_lcg_id_with_data < 2 && padding_len >= short_bsr_sz) { mac_ce_p->bsr.type_bsr = b_short; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index df5c8e1474..552b1fa041 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,7 +628,7 @@ static void pf_dl(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_DL_BWP_t *current_BWP = &UE->current_DL_BWP; - if (sched_ctrl->ul_failure) + if (!nr_mac_ue_is_active(UE)) continue; const NR_mac_dir_stats_t *stats = &UE->mac_stats.dl; @@ -683,7 +683,8 @@ static void pf_dl(module_id_t module_id, const int max_mcs_table = current_BWP->mcsTableIdx == 1 ? 27 : 28; const int max_mcs = min(sched_ctrl->dl_max_mcs, max_mcs_table); if (bo->harq_round_max == 1) { - sched_pdsch->mcs = min(bo->max_mcs, max_mcs); + int new_mcs = min(bo->max_mcs, max_mcs); + sched_pdsch->mcs = max(bo->min_mcs, new_mcs); sched_ctrl->dl_bler_stats.mcs = sched_pdsch->mcs; } else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); @@ -1037,7 +1038,7 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_DL_BWP_t *current_BWP = &UE->current_DL_BWP; - if (sched_ctrl->ul_failure && !get_softmodem_params()->phy_test) + if (!nr_mac_ue_is_active(UE) && !get_softmodem_params()->phy_test) continue; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 3d2d1254bf..ae5305d77c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -248,6 +248,38 @@ uint16_t get_pm_index(const gNB_MAC_INST *nrmac, } } +// look-up table for AMC. Based on BLER vs SNR curves from the nr_dlsim simulation +// command line: nr_dlsim -n 10000 -m 0 -R 25 -b 25 -e MCS -s START_SNR -t 99.99 +// SNR Thresholds for MCS=[0,...,28]; START_SNR=chosen values with a resolution of 0.2dB to maintain a BLER of 10^-3 +static const int SINRx10_MCS_mapping[29] = { + -10, -4, 6, 16, 24, 34, 42, 50, 56, 62, // 0..9 + 86, 92, 98, 104, 112, 118, 124, 140, 146, 154, // 10..19 + 162, 170, 178, 186, 194, 202, 212, 220, 245 // 20..28 +}; + +int get_mcs_from_SINRx10(int mcs_table, int SINRx10, int Nl) +{ + if (mcs_table != 0) { + LOG_E(MAC, "mcs_table = %d, but get_mcs_from_SINRx10() only supports MCS table 0 (TS 38.214 - Table 5.1.3.1-1)\n", mcs_table); + return 28; + } + + int MIMO_SNRx10 = 0; + if (Nl == 2) + MIMO_SNRx10 = 40; + else if (Nl == 4) + MIMO_SNRx10 = 70; + + for (int i = 28; i >= 0; i--) { + if (SINRx10 >= SINRx10_MCS_mapping[i] + MIMO_SNRx10) + return i; + } + + LOG_W(MAC, "SINR (%d.%d dB) too low, no MCS possible to achieve BLER of 10^-3\n", SINRx10 / 10, SINRx10 % 10); + + return 0; +} + uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx) { if (cqi_idx <= 0) { @@ -3432,22 +3464,65 @@ void nr_measgap_scheduling(gNB_MAC_INST *nr_mac, frame_t frame, sub_frame_t slot interrupt_followup_action_t a = nr_timer_is_active(t) ? UE->interrupt_action : FOLLOW_INSYNC; // start a timer to stop scheduling UE during MeasGap, or extend timer for // duration of measGap with existing follow-up action - // TODO: if the timer is running, it might be to stop scheduling of the UE afterwards, but then it does not make sense to stop - // scheduling the UE now, we should maybe just skip it? if (!nr_timer_is_active(t) || nr_timer_remaining_time(t) < mgc->mgl_slots) { - nr_mac_trigger_ul_failure(&UE->UE_sched_ctrl, UE->current_DL_BWP.scs); /* set the UE to "not active" */ nr_mac_interrupt_ue_transmission(nr_mac, UE, a, mgc->mgl_slots); } } } +void clean_bwp_structures(NR_SpCellConfig_t *spCellConfig) +{ + NR_ServingCellConfig_t *spCellConfigDedicated = spCellConfig->spCellConfigDedicated; + if (spCellConfigDedicated->downlinkBWP_ToReleaseList) { + struct NR_ServingCellConfig__downlinkBWP_ToReleaseList *rel_dl = spCellConfigDedicated->downlinkBWP_ToReleaseList; + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *add_dl = spCellConfigDedicated->downlinkBWP_ToAddModList; + int num_rel = rel_dl->list.count; + int num_add = add_dl->list.count; + for (int i = 0; i < num_rel; i++) { + NR_BWP_Id_t *rel_id = rel_dl->list.array[i]; + for (int j = 0; j < num_add; j++) { + NR_BWP_Downlink_t *dl_bwp = add_dl->list.array[j]; + if (*rel_id == dl_bwp->bwp_Id) { + asn_sequence_del(&add_dl->list, j, 1); + } + } + asn_sequence_del(&rel_dl->list, i, 1); + } + if (rel_dl->list.count == 0) + free_and_zero(rel_dl); + if (add_dl->list.count == 0) + free_and_zero(add_dl); + } + if (spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList) { + struct NR_UplinkConfig__uplinkBWP_ToReleaseList *rel_ul = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *add_ul = spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList; + int num_rel = rel_ul->list.count; + int num_add = add_ul->list.count; + for (int i = 0; i < num_rel; i++) { + NR_BWP_Id_t *rel_id = rel_ul->list.array[i]; + for (int j = 0; j < num_add; j++) { + NR_BWP_Uplink_t *ul_bwp = add_ul->list.array[j]; + if (*rel_id == ul_bwp->bwp_Id) { + asn_sequence_del(&add_ul->list, j, 1); + } + } + asn_sequence_del(&rel_ul->list, i, 1); + } + if (rel_ul->list.count == 0) + free_and_zero(rel_ul); + if (add_ul->list.count == 0) + free_and_zero(add_ul); + } +} + void nr_mac_clean_cellgroup(NR_CellGroupConfig_t *cell_group) { DevAssert(cell_group != NULL); + NR_SpCellConfig_t *spCellConfig = cell_group->spCellConfig; /* remove a reconfigurationWithSync, we don't need it anymore */ - if (cell_group->spCellConfig && cell_group->spCellConfig->reconfigurationWithSync != NULL) { - ASN_STRUCT_FREE(asn_DEF_NR_ReconfigurationWithSync, cell_group->spCellConfig->reconfigurationWithSync); - cell_group->spCellConfig->reconfigurationWithSync = NULL; + if (spCellConfig && spCellConfig->reconfigurationWithSync != NULL) { + ASN_STRUCT_FREE(asn_DEF_NR_ReconfigurationWithSync, spCellConfig->reconfigurationWithSync); + spCellConfig->reconfigurationWithSync = NULL; } /* remove the rlc_BearerToReleaseList, we don't need it anymore */ if (cell_group->rlc_BearerToReleaseList != NULL) { @@ -3459,6 +3534,8 @@ void nr_mac_clean_cellgroup(NR_CellGroupConfig_t *cell_group) /* remove reestablishRLC, we don't need it anymore */ for (int i = 0; i < cell_group->rlc_BearerToAddModList->list.count; ++i) free_and_zero(cell_group->rlc_BearerToAddModList->list.array[i]->reestablishRLC); + /* clean BWP structures */ + clean_bwp_structures(spCellConfig); } int nr_mac_get_reconfig_delay_slots(NR_SubcarrierSpacing_t scs) @@ -3564,12 +3641,9 @@ void nr_mac_update_timers(module_id_t module_id, frame_t frame, slot_t slot) if (nr_timer_tick(&sched_ctrl->transm_interrupt)) { /* expired */ nr_timer_stop(&sched_ctrl->transm_interrupt); - if (UE->interrupt_action == FOLLOW_OUTOFSYNC) { + if (UE->interrupt_action == FOLLOW_OUTOFSYNC) nr_mac_trigger_ul_failure(sched_ctrl, UE->current_DL_BWP.scs); - } else { - DevAssert(UE->interrupt_action == FOLLOW_INSYNC); - nr_mac_reset_ul_failure(sched_ctrl); - } + /* else: default FOLLOW_INSYNC: nothing to do (UE is now active again) */ } } } @@ -3744,8 +3818,7 @@ bool prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) int CC_id = 0; int srb_id = 1; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; - const NR_ServingCellConfig_t *sccd = UE->is_redcap ? NULL : mac->common_channels[CC_id].pre_ServingCellConfig; - NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config, &mac->rlc_config); + NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, &mac->radio_config, &mac->rlc_config); ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); UE->CellGroup = cellGroupConfig; @@ -3777,6 +3850,17 @@ bool nr_mac_check_release(NR_UE_sched_ctrl_t *sched_ctrl, int rnti) return sched_ctrl->release_timer == 0; } +bool nr_mac_ue_is_active(const NR_UE_info_t *ue) +{ + /* pass NR_UE_info_t, so that later we could adapt, e.g., for DRX */ + const NR_UE_sched_ctrl_t *sched_ctrl = &ue->UE_sched_ctrl; + if (sched_ctrl->ul_failure) + return false; + if (nr_timer_is_active(&sched_ctrl->transm_interrupt)) + return false; + return true; +} + #define UL_FAILURE_REQ_GRACE 10000 #define UL_FAILURE_TIMEOUT 30000 void nr_mac_trigger_ul_failure(NR_UE_sched_ctrl_t *sched_ctrl, NR_SubcarrierSpacing_t subcarrier_spacing) @@ -3841,11 +3925,29 @@ bool nr_mac_check_ul_failure(gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ctrl_t * return false; } -void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE) +void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE, int new_bwp_id) { DevAssert(UE->CellGroup != NULL); + NR_CellGroupConfig_t *cellGroup_for_UE = NULL; + if (new_bwp_id >= 0) { + AssertFatal(UE->current_DL_BWP.bwp_id == UE->current_UL_BWP.bwp_id, "We only support same BWP for UL and DL\n"); + if (new_bwp_id == UE->current_DL_BWP.bwp_id) + LOG_E(NR_MAC, "Source BWP ID and target BWP ID are the same, can't perform switch\n"); + else + cellGroup_for_UE = update_cellGroupConfig_for_BWP_switch(UE->CellGroup, + &nrmac->radio_config, + UE->capability, + nrmac->common_channels[0].ServingCellConfigCommon, + UE->uid, + UE->current_DL_BWP.bwp_id, + new_bwp_id); + } uint8_t buf[2048]; - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, UE->CellGroup, buf, sizeof(buf)); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + cellGroup_for_UE ? cellGroup_for_UE : UE->CellGroup, + buf, + sizeof(buf)); AssertFatal(enc_rval.encoded > 0, "ASN1 encoding of CellGroupConfig failed, failed type %s\n", enc_rval.failed_type->name); du_to_cu_rrc_information_t du2cu = { .cellGroupConfig = buf, @@ -3860,6 +3962,8 @@ void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_ .cause_value = F1AP_CauseRadioNetwork_action_desirable_for_radio_reasons, }; nrmac->mac_rrc.ue_context_modification_required(&required); + if (cellGroup_for_UE) + free_cellGroupConfig(cellGroup_for_UE); } /* \brief add bearers from CellGroupConfig. diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c index 45bb68fa5c..cf58252ed9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_srs.c @@ -462,8 +462,14 @@ static void nr_configure_srs(gNB_MAC_INST *nrmac, srs_pdu->srs_parameters_v4.iq_representation = 1; srs_pdu->srs_parameters_v4.prg_size = 1; srs_pdu->srs_parameters_v4.num_total_ue_antennas = 1 << srs_pdu->num_ant_ports; + /* For srs usage: codebook, this is a bitmask of the antenna ports that should be used for data. + * num_ant_ports num_total_ue_antennas sampled_ue_antennas + * 0 1 1 + * 1 2 3 + * 2 4 15 */ + srs_pdu->srs_parameters_v4.sampled_ue_antennas = (2 << srs_pdu->num_ant_ports) - 1; if (srs_resource_set->usage == NR_SRS_ResourceSet__usage_beamManagement) { - // srs_pdu->beamforming.trp_scheme = 0; + srs_pdu->beamforming.trp_scheme = 0; srs_pdu->beamforming.num_prgs = m_SRS[srs_pdu->config_index]; srs_pdu->beamforming.prg_size = srs_pdu->srs_parameters_v4.srs_bandwidth_size; } @@ -527,10 +533,9 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) UE_iterator(UE_info->connected_ue_list, UE) { const int CC_id = 0; - NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP; - if ((sched_ctrl->ul_failure && !get_softmodem_params()->phy_test) || nr_timer_is_active(&sched_ctrl->transm_interrupt)) { + if (!nr_mac_ue_is_active(UE) && !get_softmodem_params()->phy_test) { continue; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 00201cdd8d..682ea765ac 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -236,7 +236,7 @@ void nr_csi_meas_reporting(int Mod_idP,frame_t frame, slot_t slot) NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; const int n_slots_frame = nrmac->frame_structure.numb_slots_frame; - if (nr_timer_is_active(&sched_ctrl->transm_interrupt) || (sched_ctrl->ul_failure && !get_softmodem_params()->phy_test)) { + if (!nr_mac_ue_is_active(UE) && !get_softmodem_params()->phy_test) { continue; } const NR_CSI_MeasConfig_t *csi_measconfig = UE->sc_info.csi_MeasConfig; @@ -414,6 +414,25 @@ static void handle_dl_harq(NR_UE_info_t * UE, } } +// Referred Table 10.1.16.1-1 in 38.133 V16.7.0. +static int get_measured_sinr(int index) +{ + if (index < 0 || index > 127) + return INT_MAX; + + return -235 + index * 5; +} + +// Referred Table 10.1.16.1-2 in 38.133 V16.7.0. +static int get_diff_sinr(int index, int best_SINRx10) +{ + if (index <= 0) + return best_SINRx10; + if (index >= 15) + return best_SINRx10 - 150; + return best_SINRx10 - index * 10; +} + //returns the measured RSRP value (upper limit) static bool get_measured_rsrp(uint8_t index, int *rsrp) { @@ -498,22 +517,33 @@ static void evaluate_sinr_report(gNB_MAC_INST *nrmac, } curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); - sinr_report->SINR_index[0] = curr_payload & 0x7f; + int sinr_index = curr_payload & 0x7f; *cumul_bits += 7; csi_report->nb_of_csi_ssb_report++; - if (sinr_report->SINR_index[0] < 0 || sinr_report->SINR_index[0] > 127) { - LOG_E(NR_MAC, "UE %04x: reported SINR index %d invalid\n", UE->rnti, sinr_report->SINR_index[0]); + int SINRx10 = get_measured_sinr(sinr_index); + if (SINRx10 == INT_MAX) { + LOG_E(NR_MAC, "UE %04x: reported SINR index %d invalid\n", UE->rnti, sinr_index); return; } + sinr_report->SINRx10[0] = SINRx10; for (int i = 1; i < sinr_report->nr_reports; i++) { curr_payload = pickandreverse_bits(payload, 4, *cumul_bits); - sinr_report->SINR_index[i] = curr_payload & 0x0f; + sinr_report->SINRx10[i] = get_diff_sinr(curr_payload & 0x0f, sinr_report->SINRx10[0]); *cumul_bits += 4; } - LOG_D(MAC, "Reported SSB-SINR index = %d\n", sinr_report->SINR_index[0]); + NR_mac_stats_t *stats = &UE->mac_stats; + // including ssb SINR in mac stats + stats->cumul_sinrx10 += sinr_report->SINRx10[0]; + stats->num_sinr_meas++; + + const int mcs_table = UE->current_DL_BWP.mcsTableIdx; + const int nrOfLayers = get_dl_nrOfLayers(sched_ctrl, UE->current_DL_BWP.dci_format); + sched_ctrl->dl_max_mcs = get_mcs_from_SINRx10(mcs_table, sinr_report->SINRx10[0], nrOfLayers); + + LOG_D(MAC, "Reported SSB-SINR = %d.%d, dl_max_mcs %d\n", sinr_report->SINRx10[0] / 10, sinr_report->SINRx10[0] % 10, sched_ctrl->dl_max_mcs); } static void evaluate_rsrp_report(gNB_MAC_INST *nrmac, @@ -1250,7 +1280,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, slot_t slot) NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; const int n_slots_frame = nrmac->frame_structure.numb_slots_frame; - if (sched_ctrl->ul_failure || nr_timer_is_active(&sched_ctrl->transm_interrupt)) + if (!nr_mac_ue_is_active(UE)) continue; NR_PUCCH_Config_t *pucch_Config = ul_bwp->pucch_Config; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b08e703076..ac4b1717a8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -595,6 +595,7 @@ static int nr_process_mac_pdu(instance_t module_idP, /* Extract short BSR value */ ce_ptr = &pduP[mac_subheader_len]; sched_ctrl->estimated_ul_buffer = estimate_ul_buffer_short_bsr((NR_BSR_SHORT *)ce_ptr); + sched_ctrl->sched_ul_bytes = 0; LOG_D(NR_MAC, "SHORT BSR at %4d.%2d, est buf %d\n", frameP, slot, sched_ctrl->estimated_ul_buffer); break; @@ -603,6 +604,7 @@ static int nr_process_mac_pdu(instance_t module_idP, /* Extract long BSR value */ ce_ptr = &pduP[mac_subheader_len]; sched_ctrl->estimated_ul_buffer = estimate_ul_buffer_long_bsr((NR_BSR_LONG *)ce_ptr); + sched_ctrl->sched_ul_bytes = 0; LOG_D(NR_MAC, "LONG BSR at %4d.%2d, estim buf %d\n", frameP, slot, sched_ctrl->estimated_ul_buffer); break; @@ -880,7 +882,7 @@ static void nr_rx_ra_sdu(const module_id_t mod_id, if (!old_UE->reconfigSpCellConfig) { LOG_I(NR_MAC, "Received UL_SCH_LCID_C_RNTI with C-RNTI 0x%04x, triggering RRC Reconfiguration\n", crnti); // Trigger RRCReconfiguration - nr_mac_trigger_reconfiguration(mac, old_UE); + nr_mac_trigger_reconfiguration(mac, old_UE, -1); // we configure the UE using common search space with DCIX0 while waiting for a reconfiguration configure_UE_BWP(mac, scc, old_UE, false, NR_SearchSpace__searchSpaceType_PR_common, -1, -1); } @@ -1805,7 +1807,7 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, new_sched.bwp_info = bwp_info; DevAssert(new_sched.ul_harq_pid == harq_pid); - bool reuse_old_tda = (retInfo->tda_info.startSymbolIndex == tda_info->startSymbolIndex) && (retInfo->tda_info.nrOfSymbols <= tda_info->nrOfSymbols); + bool reuse_old_tda = retInfo->time_domain_allocation == tda; if (reuse_old_tda && nrOfLayers == retInfo->nrOfLayers) { /* Check the resource is enough for retransmission */ const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols); @@ -1887,6 +1889,7 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, fill_pdcch_vrb_map(nrmac, CC_id, &sched_ctrl->sched_pdcch, CCEIndex, sched_ctrl->aggregation_level, dci_beam_idx); // signal new allocation + DevAssert(new_sched.time_domain_allocation == tda); post_process_ulsch(nrmac, pp_pusch, UE, &new_sched); LOG_D(NR_MAC, "%4d.%2d Allocate UL retransmission RNTI %04x sched %4d.%2d (%d RBs)\n", @@ -1963,7 +1966,7 @@ static int pf_ul(gNB_MAC_INST *nrmac, UE_iterator(UE_list, UE) { NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - if (sched_ctrl->ul_failure) + if (!nr_mac_ue_is_active(UE)) continue; LOG_D(NR_MAC,"pf_ul: preparing UL scheduling for UE %04x\n",UE->rnti); @@ -2061,7 +2064,11 @@ static int pf_ul(gNB_MAC_INST *nrmac, const int max_mcs = min(bo->max_mcs, max_mcs_table); /* no per-user maximum MCS yet */ int selected_mcs; if (bo->harq_round_max == 1) { - selected_mcs = sched_ctrl->ul_bler_stats.mcs = max_mcs; + int nrOfLayers = get_ul_nrOfLayers(sched_ctrl, current_BWP->dci_format); + selected_mcs = get_mcs_from_SINRx10(current_BWP->mcs_table, sched_ctrl->pusch_snrx10, nrOfLayers); + selected_mcs = min(max_mcs, selected_mcs); + selected_mcs = max(bo->min_mcs, selected_mcs); + sched_ctrl->ul_bler_stats.mcs = selected_mcs; } else { selected_mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->ul_bler_stats, max_mcs, frame); LOG_D(NR_MAC, "%d.%d starting mcs %d bler %f\n", frame, slot, selected_mcs, sched_ctrl->ul_bler_stats.bler); @@ -2420,16 +2427,11 @@ void post_process_ulsch(gNB_MAC_INST *nr_mac, post_process_pusch_t *pusch, NR_UE /* Statistics */ AssertFatal(cur_harq->round < nr_mac->ul_bler.harq_round_max, "Indexing ulsch_rounds[%d] is out of bounds\n", cur_harq->round); UE->mac_stats.ul.rounds[cur_harq->round]++; + /* Save information on MCS, TBS etc for the current initial transmission + * so we have access to it when retransmitting */ + cur_harq->sched_pusch = *sched_pusch; if (cur_harq->round == 0) { UE->mac_stats.ulsch_total_bytes_scheduled += sched_pusch->tb_size; - /* Save information on MCS, TBS etc for the current initial transmission - * so we have access to it when retransmitting */ - cur_harq->sched_pusch = *sched_pusch; - /* save which time allocation and nrOfLayers have been used, to be used on - * retransmissions */ - cur_harq->sched_pusch.time_domain_allocation = sched_pusch->time_domain_allocation; - cur_harq->sched_pusch.nrOfLayers = sched_pusch->nrOfLayers; - cur_harq->sched_pusch.tpmi = sched_pusch->tpmi; sched_ctrl->sched_ul_bytes += sched_pusch->tb_size; UE->mac_stats.ul.total_rbs += sched_pusch->rbSize; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 84a0923e8b..be5d9d37b9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -52,7 +52,6 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, - NR_ServingCellConfig_t *scd, const nr_mac_config_t *conf, const nr_rlc_configuration_t *default_rlc_config); void mac_top_destroy_gNB(gNB_MAC_INST *mac); @@ -403,6 +402,7 @@ uint16_t get_pm_index(const gNB_MAC_INST *nrmac, int layers, int xp_pdsch_antenna_ports); +int get_mcs_from_SINRx10(int mcs_table, int SINRx10, int Nl); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_format_t dci_format); @@ -477,12 +477,15 @@ bool nr_mac_check_release(NR_UE_sched_ctrl_t *sched_ctrl, int rnti); void nr_mac_trigger_release_complete(gNB_MAC_INST *mac, int rnti); void nr_mac_release_ue(gNB_MAC_INST *mac, int rnti); bool nr_mac_request_release_ue(const gNB_MAC_INST *nrmac, int rnti); +void clean_bwp_structures(NR_SpCellConfig_t *spCellConfig); + +bool nr_mac_ue_is_active(const NR_UE_info_t *ue); void nr_mac_trigger_ul_failure(NR_UE_sched_ctrl_t *sched_ctrl, NR_SubcarrierSpacing_t subcarrier_spacing); void nr_mac_reset_ul_failure(NR_UE_sched_ctrl_t *sched_ctrl); bool nr_mac_check_ul_failure(gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ctrl_t *sched_ctrl); -void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE); +void nr_mac_trigger_reconfiguration(const gNB_MAC_INST *nrmac, const NR_UE_info_t *UE, int new_bwp_id); void process_addmod_bearers_cellGroupConfig(NR_UE_sched_ctrl_t *sched_ctrl, const struct NR_CellGroupConfig__rlc_BearerToAddModList *addmod); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index d9b0136069..f73f4b8f70 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -569,14 +569,13 @@ static NR_UE_info_t *create_new_UE(gNB_MAC_INST *mac, uint32_t cu_id, const NR_C NR_CellGroupConfig_t *cellGroupConfig = NULL; NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; const NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - const NR_ServingCellConfig_t *sccd = cc->pre_ServingCellConfig; const nr_mac_config_t *configuration = &mac->radio_config; if (is_SA) { - cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config, &mac->rlc_config); + cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, &mac->radio_config, &mac->rlc_config); cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc); } else { NR_UE_NR_Capability_t *cap = get_ue_nr_cap_from_cg_config_info(cgci); - cellGroupConfig = get_default_secondaryCellGroup(scc, sccd, cap, 1, 1, configuration, UE->uid); + cellGroupConfig = get_default_secondaryCellGroup(scc, cap, 1, 1, configuration, UE->uid); cellGroupConfig->spCellConfig->reconfigurationWithSync = get_reconfiguration_with_sync(UE->rnti, UE->uid, scc); // TODO: in NSA we assign capabilities here, otherwise outside => not logic UE->capability = cap; @@ -786,8 +785,8 @@ void ue_context_modification_request(const f1ap_ue_context_mod_req_t *req) } } // we re-configure the BWP to apply the CellGroup and to use UE specific Search Space with DCIX1 - nr_mac_clean_cellgroup(UE->CellGroup); configure_UE_BWP(mac, scc, UE, false, NR_SearchSpace__searchSpaceType_PR_ue_Specific, -1, -1); + nr_mac_clean_cellgroup(UE->CellGroup); } if (ue_cap != NULL) { diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index e80f852022..fa66125bf7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -126,24 +126,37 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_mac_stats_t *stats = &UE->mac_stats; const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; + const int avg_sinrx10 = stats->num_sinr_meas > 0 ? stats->cumul_sinrx10 / stats->num_sinr_meas : 0; output += snprintf(output, end - output, "UE RNTI %04x CU-UE-ID ", UE->rnti); if (du_exists_f1_ue_data(UE->rnti)) { f1_ue_data_t ued = du_get_f1_ue_data(UE->rnti); output += snprintf(output, end - output, "%d", ued.secondary_ue); } else { - output += snprintf(output, end-output, "(none)"); + output += snprintf(output, end - output, "(none)"); } bool in_sync = !sched_ctrl->ul_failure; output += snprintf(output, end - output, - " %s PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n", + " %s PH %d dB PCMAX %d dBm", in_sync ? "in-sync" : "out-of-sync", sched_ctrl->ph, - sched_ctrl->pcmax, - avg_rsrp, - stats->num_rsrp_meas); + sched_ctrl->pcmax); + + if (stats->num_rsrp_meas) + output += snprintf(output, end - output, ", average RSRP %d (%d meas)", avg_rsrp, stats->num_rsrp_meas); + + if (stats->num_sinr_meas) { + output += snprintf(output, + end - output, + ", average SINR %d.%d (%d meas)", + avg_sinrx10 / 10, + avg_sinrx10 % 10, + stats->num_sinr_meas); + } + + output += snprintf(output, end - output, "\n"); if(sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.print_report) output += snprintf(output, @@ -178,6 +191,8 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset if (reset_rsrp) { stats->num_rsrp_meas = 0; stats->cumul_rsrp = 0; + stats->num_sinr_meas = 0; + stats->cumul_sinrx10 = 0; } output += snprintf(output, end - output, @@ -240,7 +255,6 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type) void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, - NR_ServingCellConfig_t *scd, const nr_mac_config_t *config, const nr_rlc_configuration_t *default_rlc_config) { @@ -275,8 +289,6 @@ void mac_top_init_gNB(ngran_node_t node_type, RC.nrmac[i]->radio_config = *config; RC.nrmac[i]->rlc_config = *default_rlc_config; - RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; - RC.nrmac[i]->first_MIB = true; RC.nrmac[i]->num_scheduled_prach_rx = 0; RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc); @@ -330,7 +342,6 @@ void mac_top_destroy_gNB(gNB_MAC_INST *mac) NR_COMMON_channels_t *cc = &mac->common_channels[0]; ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, cc->mib); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_DL_SCH_Message, cc->sib1); - ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfig, cc->pre_ServingCellConfig); ASN_STRUCT_FREE(asn_DEF_NR_ServingCellConfigCommon, cc->ServingCellConfigCommon); NR_UEs_t *UE_info = &mac->UE_info; for (int i = 0; i < sizeofArray(UE_info->connected_ue_list); ++i) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2627c9162b..af62663de7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -155,6 +155,30 @@ typedef struct nr_redcap_config { uint8_t intraFreqReselectionRedCap_r17; } nr_redcap_config_t; +typedef struct { +int dl_FreqDensity0_0; +int dl_FreqDensity1_0; +int dl_TimeDensity0_0; +int dl_TimeDensity1_0; +int dl_TimeDensity2_0; +int dl_EpreRatio_0; +int dl_ReOffset_0; +int ul_FreqDensity0_0; +int ul_FreqDensity1_0; +int ul_TimeDensity0_0; +int ul_TimeDensity1_0; +int ul_TimeDensity2_0; +int ul_ReOffset_0; +int ul_MaxPorts_0; +int ul_Power_0; +} nr_ptrs_config_t; + +typedef struct { + int id; + int scs; + int location_and_bw; +} nr_bwp_config_t; + typedef struct nr_mac_config_t { int sib1_tda; nr_pdsch_AntennaPorts_t pdsch_AntennaPorts; @@ -172,11 +196,16 @@ typedef struct nr_mac_config_t { nr_mac_timers_t timer_config; int num_dlharq; int num_ulharq; + // BWP information + int num_additional_bwps; + int first_active_bwp; + nr_bwp_config_t bwp_config[4]; /// beamforming weight matrix size int nb_bfw[2]; int32_t *bw_list; int num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; nr_redcap_config_t *redcap; + nr_ptrs_config_t *ptrs; bool do_SINR; } nr_mac_config_t; @@ -263,8 +292,6 @@ typedef struct { NR_BCCH_DL_SCH_Message_t *sib1; seq_arr_t *du_SIBs; NR_ServingCellConfigCommon_t *ServingCellConfigCommon; - /// pre-configured ServingCellConfig that is default for every UE - NR_ServingCellConfig_t *pre_ServingCellConfig; /// Outgoing MIB PDU for PHY uint8_t MIB_pdu[3]; /// Outgoing BCCH pdu for PHY @@ -521,8 +548,7 @@ typedef struct RSRP_report { uint8_t nr_reports; uint8_t resource_id[MAX_NR_OF_REPORTED_RS]; int RSRP[MAX_NR_OF_REPORTED_RS]; - // SINR index according to tables 10.1.16.1-1, 10.1.16.1-2 - int SINR_index[MAX_NR_OF_REPORTED_RS]; + int SINRx10[MAX_NR_OF_REPORTED_RS]; } RSRP_report_t; struct CSI_Report { @@ -694,6 +720,8 @@ typedef struct NR_mac_stats { uint32_t pucch0_DTX; int cumul_rsrp; uint8_t num_rsrp_meas; + int cumul_sinrx10; + uint8_t num_sinr_meas; char srs_stats[50]; // Statistics may differ depending on SRS usage int pusch_snrx10; int deltaMCS; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c index 5fba6dcaaf..bb108d4004 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c +++ b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c @@ -210,20 +210,6 @@ static NR_SetupRelease_PDSCH_ConfigCommon_t *clone_pdsch_configcommon(const NR_S return clone; } -static NR_PUSCH_Config_t *clone_pusch_config(const NR_PUSCH_Config_t *pc) -{ - if (pc == NULL) - return NULL; - - uint8_t buf[1024]; - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_PUSCH_Config, NULL, pc, buf, sizeof(buf)); - AssertFatal(enc_rval.encoded > 0 && enc_rval.encoded < sizeof(buf), "could not clone NR_PUSCH_Config: problem while encoding\n"); - NR_PUSCH_Config_t *clone = NULL; - asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_PUSCH_Config, (void **)&clone, buf, enc_rval.encoded, 0, 0); - AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed == enc_rval.encoded, "could not clone NR_PUSCH_Config: problem while decoding\n"); - return clone; -} - static int get_nb_pucch2_per_slot(const NR_ServingCellConfigCommon_t *scc, int bwp_size) { const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; @@ -1123,20 +1109,22 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay, i // make TDA for the mixed slot long mixed_sliv = get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1); - if (ul_symb > 1 && (k2 <= N_dl1 || (p2 && N_ul2 == 0))) { + int mixed_min_ul_symb = 3; // need at least two symbols PUSCH + PUCCH + bool has_ul_mixed = ul_symb >= mixed_min_ul_symb; + if (has_ul_mixed && (k2 <= N_dl1 || (p2 && N_ul2 == 0))) { // UL TDA index 2 for mixed slot (TDD) (no pattern 2 and enough DL slots, or pattern2 only DL) tda = set_TimeDomainResourceAllocation(k2, mixed_sliv); // to be reached from suitable DL slot asn1cSeqAdd(&tda_list->list, tda); - } else if (ul_symb > 1 && !p2 && k2 > N_dl1) { // k2 > N_Dl1 + } else if (has_ul_mixed && !p2 && k2 > N_dl1) { // k2 > N_Dl1 // UL TDA for mixed slot without pattern 2 and less DL slots than k2 tda = set_TimeDomainResourceAllocation(nb_slots_per_period, mixed_sliv); // to be reached from last DL (mixed) slot, if any asn1cSeqAdd(&tda_list->list, tda); - } else if (ul_symb > 1 && N_ul2 > 0 && k2 > N_dl1) { + } else if (has_ul_mixed && N_ul2 > 0 && k2 > N_dl1) { // we have pattern 2 with UL, and less p1 DL slots than k2 tda = set_TimeDomainResourceAllocation(N_dl1 + N_ul2 + 1, mixed_sliv); asn1cSeqAdd(&tda_list->list, tda); } else { - AssertFatal(ul_symb == 0, "unhandled case of mixed slot: N_dl1 %d N_ul1 %d N_dl2 %d N_ul2 %d\n", N_dl1, N_ul1, N_dl2, N_ul2); + LOG_I(NR_RRC, "mixed slot has %d UL symbols, cannot create mixed slot TDA\n", ul_symb); } // make TDA for UL slots that are not reachable within k2/min_rxtxtime @@ -1149,11 +1137,27 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay, i tda = set_TimeDomainResourceAllocation(i, get_SLIV(0, 13)); asn1cSeqAdd(&tda_list->list, tda); if (do_SRS) { - tda = set_TimeDomainResourceAllocation(k2, get_SLIV(0, 12)); + tda = set_TimeDomainResourceAllocation(i, get_SLIV(0, 12)); asn1cSeqAdd(&tda_list->list, tda); } } } + + // for Msg3, an additional get_delta_for_k2(mu) is added to k2. + // check that any UL slot is reachable under this condition + // the below is designed to only hit specific (known) cases + // examples: DDDSU (no TDA in S), + int N_dl = max(N_dl1, N_dl2); + int delta = get_delta_for_k2(mu); + int k2_msg3 = k2 + delta; + if (nb_slots_per_period % k2_msg3 == 0 /* see example above */ + && k2_msg3 > N_dl /* otherwise, can always have a D that reaches U */ + && k2_msg3 > N_ul /* otherwise, can always have a D that reaches U */ + && !has_ul_mixed /* if mixed slot, even for DDDSU would reach */) { + /* reach next UL from mixed slot in previous period */ + tda = set_TimeDomainResourceAllocation(k2_msg3, get_SLIV(0, 13)); + asn1cSeqAdd(&tda_list->list, tda); + } } AssertFatal(tda_list->list.count <= 16, "cannot reach all UL slots with current TDD configuration\n"); @@ -1445,15 +1449,61 @@ static void set_dl_mcs_table(int scs, bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL; } -static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusch_Config, - const bool use_deltaMCS, - const NR_ServingCellConfigCommon_t *scc, - const NR_UE_NR_Capability_t *uecap) +static NR_PTRS_UplinkConfig_t *config_ulptrs(const nr_ptrs_config_t *ptrs) { - struct NR_SetupRelease_PUSCH_Config *setup_puschconfig = calloc(1, sizeof(*setup_puschconfig)); + struct NR_PTRS_UplinkConfig__transformPrecoderDisabled *ptrs_config = calloc_or_fail(1, sizeof(*ptrs_config)); + AssertFatal(ptrs->ul_FreqDensity0_0 < 277, "Invalid ul_FreqDensity0_0 %d\n", ptrs->ul_FreqDensity0_0); + if (ptrs->ul_FreqDensity0_0 > 0) { + ptrs_config->frequencyDensity = calloc_or_fail(1, sizeof(*ptrs_config->frequencyDensity)); + asn1cSequenceAdd(ptrs_config->frequencyDensity->list, long, f0); + *f0 = ptrs->ul_FreqDensity0_0; + AssertFatal(ptrs->ul_FreqDensity1_0 < 277, "Invalid ul_FreqDensity1_0 %d\n", ptrs->ul_FreqDensity1_0); + if (ptrs->ul_FreqDensity1_0 > 0) { + asn1cSequenceAdd(ptrs_config->frequencyDensity->list, long, f1); + *f1 = ptrs->ul_FreqDensity1_0; + } + } + + AssertFatal(ptrs->ul_TimeDensity0_0 < 30, "Invalid ul_TimeDensity0_0 %d\n", ptrs->ul_TimeDensity0_0); + if (ptrs->ul_TimeDensity0_0 >= 0) { + ptrs_config->timeDensity = calloc_or_fail(1, sizeof(*ptrs_config->timeDensity)); + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t0); + *t0 = ptrs->ul_TimeDensity0_0; + AssertFatal(ptrs->ul_TimeDensity1_0 < 30, "Invalid ul_TimeDensity1_0 %d\n", ptrs->ul_TimeDensity1_0); + if (ptrs->ul_TimeDensity1_0 >= 0) { + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t1); + *t1 = ptrs->ul_TimeDensity1_0; + } + AssertFatal(ptrs->ul_TimeDensity2_0 < 30, "Invalid ul_TimeDensity2_0 %d\n", ptrs->ul_TimeDensity2_0); + if (ptrs->ul_TimeDensity2_0 >= 0) { + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t2); + *t2 = ptrs->ul_TimeDensity2_0; + } + } + + AssertFatal(ptrs->ul_ReOffset_0 < 3, "Invalid ul_ReOffset_0 %d\n", ptrs->ul_ReOffset_0); + if (ptrs->ul_ReOffset_0 >= 0) { + ptrs_config->resourceElementOffset = calloc_or_fail(1, sizeof(*ptrs_config->resourceElementOffset)); + *ptrs_config->resourceElementOffset = ptrs->ul_ReOffset_0; + } + AssertFatal(ptrs->ul_MaxPorts_0 == 0 || ptrs->ul_MaxPorts_0 == 1, "Invalid ul_MaxPorts_0 %d\n", ptrs->ul_MaxPorts_0); + ptrs_config->maxNrofPorts = ptrs->ul_MaxPorts_0; + AssertFatal(ptrs->ul_Power_0 >= 0 || ptrs->ul_Power_0 < 4, "Invalid ul_Power_0 %d\n", ptrs->ul_Power_0); + ptrs_config->ptrs_Power = ptrs->ul_Power_0; + + NR_PTRS_UplinkConfig_t *ulptrs = calloc_or_fail(1, sizeof(*ptrs_config)); + ulptrs->transformPrecoderDisabled = ptrs_config; + return ulptrs; +} + +static NR_SetupRelease_PUSCH_Config_t *config_pusch(const bool use_deltaMCS, + const NR_ServingCellConfigCommon_t *scc, + const NR_UE_NR_Capability_t *uecap, + const nr_ptrs_config_t *ptrs) +{ + NR_SetupRelease_PUSCH_Config_t *setup_puschconfig = calloc(1, sizeof(*setup_puschconfig)); setup_puschconfig->present = NR_SetupRelease_PUSCH_Config_PR_setup; - if (!pusch_Config) - pusch_Config = calloc(1, sizeof(*pusch_Config)); + NR_PUSCH_Config_t *pusch_Config = calloc(1, sizeof(*pusch_Config)); setup_puschconfig->choice.setup = pusch_Config; pusch_Config->dataScramblingIdentityPUSCH = NULL; @@ -1467,6 +1517,13 @@ static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusc if (!pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup) pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1, sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup)); NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + if (ptrs) { + NR_PTRS_UplinkConfig_t *ptrs_config = config_ulptrs(ptrs); + NR_SetupRelease_PTRS_UplinkConfig_t *phaseTrackingRS = calloc(1, sizeof(*phaseTrackingRS)); + phaseTrackingRS->present = NR_SetupRelease_PTRS_UplinkConfig_PR_setup; + phaseTrackingRS->choice.setup = ptrs_config; + NR_DMRS_UplinkConfig->phaseTrackingRS = phaseTrackingRS; + } NR_DMRS_UplinkConfig->dmrs_Type = NULL; NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NULL; NR_DMRS_UplinkConfig->phaseTrackingRS = NULL; @@ -1531,9 +1588,54 @@ static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusc return setup_puschconfig; } -static struct NR_SetupRelease_PDSCH_Config *config_pdsch(uint64_t ssb_bitmap, int bwp_Id, int dl_antenna_ports) +static NR_PTRS_DownlinkConfig_t *config_dlptrs(const nr_ptrs_config_t *ptrs) { - struct NR_SetupRelease_PDSCH_Config *setup_pdsch_Config = calloc(1,sizeof(*setup_pdsch_Config)); + NR_PTRS_DownlinkConfig_t *ptrs_config = calloc_or_fail(1, sizeof(*ptrs_config)); + AssertFatal(ptrs->dl_FreqDensity0_0 < 277, "Invalid dl_FreqDensity0_0 %d\n", ptrs->dl_FreqDensity0_0); + if (ptrs->dl_FreqDensity0_0 > 0) { + ptrs_config->frequencyDensity = calloc_or_fail(1, sizeof(*ptrs_config->frequencyDensity)); + asn1cSequenceAdd(ptrs_config->frequencyDensity->list, long, f0); + *f0 = ptrs->dl_FreqDensity0_0; + AssertFatal(ptrs->dl_FreqDensity1_0 < 277, "Invalid dl_FreqDensity1_0 %d\n", ptrs->dl_FreqDensity1_0); + if (ptrs->dl_FreqDensity1_0 > 0) { + asn1cSequenceAdd(ptrs_config->frequencyDensity->list, long, f1); + *f1 = ptrs->dl_FreqDensity1_0; + } + } + + AssertFatal(ptrs->dl_TimeDensity0_0 < 30, "Invalid dl_TimeDensity0_0 %d\n", ptrs->dl_TimeDensity0_0); + if (ptrs->dl_TimeDensity0_0 >= 0) { + ptrs_config->timeDensity = calloc_or_fail(1, sizeof(*ptrs_config->timeDensity)); + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t0); + *t0 = ptrs->dl_TimeDensity0_0; + AssertFatal(ptrs->dl_TimeDensity1_0 < 30, "Invalid dl_TimeDensity1_0 %d\n", ptrs->dl_TimeDensity1_0); + if (ptrs->dl_TimeDensity1_0 >= 0) { + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t1); + *t1 = ptrs->dl_TimeDensity1_0; + } + AssertFatal(ptrs->dl_TimeDensity2_0 < 30, "Invalid dl_TimeDensity2_0 %d\n", ptrs->dl_TimeDensity2_0); + if (ptrs->dl_TimeDensity2_0 >= 0) { + asn1cSequenceAdd(ptrs_config->timeDensity->list, long, t2); + *t2 = ptrs->dl_TimeDensity2_0; + } + } + + AssertFatal(ptrs->dl_EpreRatio_0 < 4, "Invalid dl_EpreRatio_0 %d\n", ptrs->dl_EpreRatio_0); + if (ptrs->dl_EpreRatio_0 >= 0) { + ptrs_config->epre_Ratio = calloc_or_fail(1, sizeof(*ptrs_config->epre_Ratio)); + *ptrs_config->epre_Ratio = ptrs->dl_EpreRatio_0; + } + AssertFatal(ptrs->dl_ReOffset_0 < 3, "Invalid dl_ReOffset_0 %d\n", ptrs->dl_ReOffset_0); + if (ptrs->dl_ReOffset_0 >= 0) { + ptrs_config->resourceElementOffset = calloc_or_fail(1, sizeof(*ptrs_config->resourceElementOffset)); + *ptrs_config->resourceElementOffset = ptrs->dl_ReOffset_0; + } + return ptrs_config; +} + +static NR_SetupRelease_PDSCH_Config_t *config_pdsch(uint64_t ssb_bitmap, int bwp_Id, int dl_antenna_ports, nr_ptrs_config_t *ptrs) +{ + NR_SetupRelease_PDSCH_Config_t *setup_pdsch_Config = calloc(1,sizeof(*setup_pdsch_Config)); setup_pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; NR_PDSCH_Config_t *pdsch_Config = calloc(1, sizeof(*pdsch_Config)); setup_pdsch_Config->choice.setup = pdsch_Config; @@ -1541,6 +1643,13 @@ static struct NR_SetupRelease_PDSCH_Config *config_pdsch(uint64_t ssb_bitmap, in pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present = NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1, sizeof(*pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); NR_DMRS_DownlinkConfig_t *dmrs_DownlinkForPDSCH_MappingTypeA = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + if (ptrs) { + NR_PTRS_DownlinkConfig_t *ptrs_config = config_dlptrs(ptrs); + NR_SetupRelease_PTRS_DownlinkConfig_t *phaseTrackingRS = calloc(1, sizeof(*phaseTrackingRS)); + phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; + phaseTrackingRS->choice.setup = ptrs_config; + dmrs_DownlinkForPDSCH_MappingTypeA->phaseTrackingRS = phaseTrackingRS; + } dmrs_DownlinkForPDSCH_MappingTypeA->dmrs_Type = NULL; dmrs_DownlinkForPDSCH_MappingTypeA->maxLength = NULL; dmrs_DownlinkForPDSCH_MappingTypeA->scramblingID0 = NULL; @@ -1574,24 +1683,22 @@ static struct NR_SetupRelease_PDSCH_Config *config_pdsch(uint64_t ssb_bitmap, in return setup_pdsch_Config; } -static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, - const NR_ServingCellConfigCommon_t *scc, - const NR_ServingCellConfig_t *servingcellconfigdedicated, - const NR_UE_NR_Capability_t *uecap, - int dl_antenna_ports, - bool force_256qam_off, - int bwp_loop, - bool is_SA, - const int num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]) +static NR_BWP_Downlink_t *config_downlinkBWP(const NR_ServingCellConfigCommon_t *scc, + const NR_UE_NR_Capability_t *uecap, + int dl_antenna_ports, + bool force_256qam_off, + int bwp_loop, + bool is_SA, + const nr_mac_config_t *configuration) { + NR_BWP_Downlink_t *bwp = calloc_or_fail(1, sizeof(*bwp)); bwp->bwp_Common = calloc(1,sizeof(*bwp->bwp_Common)); - - if(servingcellconfigdedicated->downlinkBWP_ToAddModList && - bwp_loop < servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count) { - bwp->bwp_Id = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Id; - bwp->bwp_Common->genericParameters.locationAndBandwidth = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.locationAndBandwidth; - bwp->bwp_Common->genericParameters.subcarrierSpacing = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.subcarrierSpacing; - bwp->bwp_Common->genericParameters.cyclicPrefix = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.cyclicPrefix; + if(configuration->num_additional_bwps > 0) { + const nr_bwp_config_t *bwp_config = &configuration->bwp_config[bwp_loop]; + bwp->bwp_Id = bwp_config->id; + bwp->bwp_Common->genericParameters.locationAndBandwidth = bwp_config->location_and_bw; + bwp->bwp_Common->genericParameters.subcarrierSpacing = bwp_config->scs; + bwp->bwp_Common->genericParameters.cyclicPrefix = NULL; } else { bwp->bwp_Id=bwp_loop+1; bwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); @@ -1619,7 +1726,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, NR_SearchSpace_t *ss = NULL; if (!is_SA) { int num_cces = get_coreset_num_cces(coreset->frequencyDomainResources.buf, coreset->duration); - verify_agg_levels(num_cces, num_agg_level_candidates, coreset->controlResourceSetId, agg_level_candidates); + verify_agg_levels(num_cces, configuration->num_agg_level_candidates, coreset->controlResourceSetId, agg_level_candidates); ss = rrc_searchspace_config(true, searchspaceid, coreset->controlResourceSetId, agg_level_candidates); } else { agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; @@ -1665,7 +1772,7 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset2); int rrc_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; int num_cces = get_coreset_num_cces(coreset2->frequencyDomainResources.buf, coreset2->duration); - verify_agg_levels(num_cces, num_agg_level_candidates, coreset2->controlResourceSetId, rrc_num_agg_level_candidates); + verify_agg_levels(num_cces, configuration->num_agg_level_candidates, coreset2->controlResourceSetId, rrc_num_agg_level_candidates); searchspaceid = 10 + bwp->bwp_Id; NR_SearchSpace_t *ss2 = rrc_searchspace_config(true, searchspaceid, is_SA ? 0 : coreset2->controlResourceSetId, agg_level_candidates); @@ -1677,30 +1784,30 @@ static void config_downlinkBWP(NR_BWP_Downlink_t *bwp, asn1cSeqAdd(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss3); bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL; - bwp->bwp_Dedicated->pdsch_Config = config_pdsch(ssb_bitmap, bwp->bwp_Id, dl_antenna_ports); + bwp->bwp_Dedicated->pdsch_Config = config_pdsch(ssb_bitmap, bwp->bwp_Id, dl_antenna_ports, configuration->ptrs); set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, scc); + return bwp; } -static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, - long bwp_loop, - bool is_SA, - int uid, - const nr_mac_config_t *configuration, - const NR_ServingCellConfig_t *servingcellconfigdedicated, - const NR_ServingCellConfigCommon_t *scc, - const NR_UE_NR_Capability_t *uecap) +static NR_BWP_Uplink_t *config_uplinkBWP(long bwp_loop, + bool is_SA, + int uid, + int maxMIMO_Layers, + const nr_mac_config_t *configuration, + const NR_ServingCellConfigCommon_t *scc, + const NR_UE_NR_Capability_t *uecap) { - ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common)); - if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList && - bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) { - ubwp->bwp_Id = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Id; - ubwp->bwp_Common->genericParameters.locationAndBandwidth = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.locationAndBandwidth; - ubwp->bwp_Common->genericParameters.subcarrierSpacing = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.subcarrierSpacing; - ubwp->bwp_Common->genericParameters.cyclicPrefix = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Common->genericParameters.cyclicPrefix; + NR_BWP_Uplink_t *ubwp = calloc_or_fail(1, sizeof(*ubwp)); + ubwp->bwp_Common = calloc(1, sizeof(*ubwp->bwp_Common)); + if(configuration->num_additional_bwps > 0) { + ubwp->bwp_Id = configuration->bwp_config[bwp_loop].id; + ubwp->bwp_Common->genericParameters.locationAndBandwidth = configuration->bwp_config[bwp_loop].location_and_bw; + ubwp->bwp_Common->genericParameters.subcarrierSpacing = configuration->bwp_config[bwp_loop].scs; + ubwp->bwp_Common->genericParameters.cyclicPrefix = NULL; } else { ubwp->bwp_Id=bwp_loop+1; ubwp->bwp_Common->genericParameters.locationAndBandwidth = PRBalloc_to_locationandbandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0); @@ -1739,20 +1846,10 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, scheduling_request_config(scc, pucch_Config, ubwp->bwp_Common->genericParameters.subcarrierSpacing); set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, ubwp->bwp_Common->genericParameters.subcarrierSpacing); - NR_PUSCH_Config_t *pusch_Config = NULL; - if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList && - bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) { - pusch_Config = clone_pusch_config(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop] - ->bwp_Dedicated->pusch_Config->choice.setup); - } - ubwp->bwp_Dedicated->pusch_Config = config_pusch(pusch_Config, configuration->use_deltaMCS, scc, configuration->force_UL256qam_off ? NULL : uecap); - - long maxMIMO_Layers = servingcellconfigdedicated && - servingcellconfigdedicated->uplinkConfig - && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig - && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 - && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ? - *servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1; + ubwp->bwp_Dedicated->pusch_Config = config_pusch(configuration->use_deltaMCS, + scc, + configuration->force_UL256qam_off ? NULL : uecap, + configuration->ptrs); ubwp->bwp_Dedicated->srs_Config = get_config_srs(scc, NULL, @@ -1765,6 +1862,7 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, ubwp->bwp_Dedicated->configuredGrantConfig = NULL; ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL; + return ubwp; } static void set_phr_config(NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) @@ -2988,7 +3086,7 @@ static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(const nr_mac_timers_t * NR_MAC_CellGroupConfig_t * mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig)); AssertFatal(mac_CellGroupConfig != NULL, "Couldn't allocate mac-CellGroupConfig. Out of memory!\n"); mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config)); - mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; + mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf5; mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80; mac_CellGroupConfig->tag_Config = calloc(1, sizeof(*mac_CellGroupConfig->tag_Config)); mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL; @@ -3025,16 +3123,28 @@ static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(const nr_mac_timers_t * return mac_CellGroupConfig; } -// Set HARQ related IEs according to the number of DL, UL harqprocesses configured -static void fill_harq_IEs(NR_ServingCellConfig_t *scc, int num_dlharq, int num_ulharq) +static void allocate_32_harq(NR_PDSCH_Config_t *pdsch_Config) { + if (!pdsch_Config->ext3) + pdsch_Config->ext3 = calloc(1, sizeof(*pdsch_Config->ext3)); + asn1cCallocOne(pdsch_Config->ext3->harq_ProcessNumberSizeDCI_1_1_r17, 5); +} - AssertFatal(scc && scc->pdsch_ServingCellConfig && - scc->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup, +static void allocate_32_ul_harq(NR_PUSCH_Config_t *pusch_Config) +{ + if (!pusch_Config->ext2) + pusch_Config->ext2 = calloc(1, sizeof(*pusch_Config->ext2)); + asn1cCallocOne(pusch_Config->ext2->harq_ProcessNumberSizeDCI_0_1_r17, 5); +} + +// Set HARQ related IEs according to the number of DL, UL harqprocesses configured +static void fill_harq_IEs(NR_ServingCellConfig_t *scc, int num_dlharq, int num_ulharq, int bwp_id) +{ + AssertFatal(scc + && scc->pdsch_ServingCellConfig + && scc->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup, "PDSCH_Servingcellconfig IEs NOT present\n"); - NR_PDSCH_ServingCellConfig_t *pdsch_scc = scc->pdsch_ServingCellConfig->choice.setup; - switch (num_dlharq) { case 2: *pdsch_scc->nrofHARQ_ProcessesForPDSCH = NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n2; @@ -3063,34 +3173,27 @@ static void fill_harq_IEs(NR_ServingCellConfig_t *scc, int num_dlharq, int num_u pdsch_scc->ext3 = calloc(1, sizeof(*pdsch_scc->ext3)); asn1cCallocOne(pdsch_scc->ext3->nrofHARQ_ProcessesForPDSCH_v1700, NR_PDSCH_ServingCellConfig__ext3__nrofHARQ_ProcessesForPDSCH_v1700_n32); - NR_BWP_DownlinkDedicated_t *dlbwp = scc->initialDownlinkBWP; - if (dlbwp && dlbwp->pdsch_Config && - dlbwp->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) { - NR_PDSCH_Config_t *dlcfg = scc->initialDownlinkBWP->pdsch_Config->choice.setup; - if (!dlcfg->ext3) - dlcfg->ext3 = calloc(1, sizeof(*dlcfg->ext3)); - asn1cCallocOne(dlcfg->ext3->harq_ProcessNumberSizeDCI_1_1_r17, 5); - } - int num_dl_bwp = 0; - if (scc->downlinkBWP_ToAddModList) - num_dl_bwp = scc->downlinkBWP_ToAddModList->list.count; - for (int i = 0;i < num_dl_bwp; i++) { - dlbwp = scc->downlinkBWP_ToAddModList->list.array[i]->bwp_Dedicated; - if (dlbwp && dlbwp->pdsch_Config && - dlbwp->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) { - NR_PDSCH_Config_t *dlcfg = dlbwp->pdsch_Config->choice.setup; - if (!dlcfg->ext3) - dlcfg->ext3 = calloc(1, sizeof(*dlcfg->ext3)); - asn1cCallocOne(dlcfg->ext3->harq_ProcessNumberSizeDCI_1_1_r17, 5); + NR_BWP_DownlinkDedicated_t *dlbwp = NULL; + if (bwp_id == 0) { + dlbwp = scc->initialDownlinkBWP; + if (dlbwp && dlbwp->pdsch_Config && dlbwp->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) + allocate_32_harq(scc->initialDownlinkBWP->pdsch_Config->choice.setup); + } else { + for (int i = 0; i < scc->downlinkBWP_ToAddModList->list.count; i++) { + if (scc->downlinkBWP_ToAddModList->list.array[i]->bwp_Id != bwp_id) + continue; + dlbwp = scc->downlinkBWP_ToAddModList->list.array[i]->bwp_Dedicated; + if (dlbwp && dlbwp->pdsch_Config && dlbwp->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) + allocate_32_harq(dlbwp->pdsch_Config->choice.setup); } } break; default: // Already IE should have been set to 16 harq processes + AssertFatal(false, "Invalid number of HARQ processes\n"); break; } - - AssertFatal(scc->uplinkConfig,"uplinkConfig IE NOT present\n"); + AssertFatal(scc->uplinkConfig, "uplinkConfig IE NOT present\n"); if (num_ulharq == 32) { if (!scc->uplinkConfig->pusch_ServingCellConfig) @@ -3103,50 +3206,31 @@ static void fill_harq_IEs(NR_ServingCellConfig_t *scc, int num_dlharq, int num_u pusch_scc->ext3 = calloc(1, sizeof(*pusch_scc->ext3)); asn1cCallocOne(pusch_scc->ext3->nrofHARQ_ProcessesForPUSCH_r17, NR_PUSCH_ServingCellConfig__ext3__nrofHARQ_ProcessesForPUSCH_r17_n32); - NR_BWP_UplinkDedicated_t *ulbwp = scc->uplinkConfig->initialUplinkBWP; - if (ulbwp && ulbwp->pusch_Config && - ulbwp->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) { - NR_PUSCH_Config_t *ulcfg = ulbwp->pusch_Config->choice.setup; - if (!ulcfg->ext2) - ulcfg->ext2 = calloc(1, sizeof(*ulcfg->ext2)); - asn1cCallocOne(ulcfg->ext2->harq_ProcessNumberSizeDCI_0_1_r17, 5); - } - int num_ul_bwp = 0; - if (scc->uplinkConfig->uplinkBWP_ToAddModList) - num_ul_bwp = scc->uplinkConfig->uplinkBWP_ToAddModList->list.count; - for (int i = 0;i < num_ul_bwp; i++) { - ulbwp = scc->uplinkConfig->uplinkBWP_ToAddModList->list.array[i]->bwp_Dedicated; - if (ulbwp && ulbwp->pusch_Config && - ulbwp->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) { - NR_PUSCH_Config_t *ulcfg = ulbwp->pusch_Config->choice.setup; - if (!ulcfg->ext2) - ulcfg->ext2 = calloc(1, sizeof(*ulcfg->ext2)); - asn1cCallocOne(ulcfg->ext2->harq_ProcessNumberSizeDCI_0_1_r17, 5); + NR_BWP_UplinkDedicated_t *ulbwp = NULL; + if (bwp_id == 0) { + ulbwp = scc->uplinkConfig->initialUplinkBWP; + if (ulbwp && ulbwp->pusch_Config && ulbwp->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) + allocate_32_ul_harq(ulbwp->pusch_Config->choice.setup); + } else { + for (int i = 0; i < scc->uplinkConfig->uplinkBWP_ToAddModList->list.count; i++) { + if (bwp_id != scc->uplinkConfig->uplinkBWP_ToAddModList->list.array[i]->bwp_Id) + continue; + ulbwp = scc->uplinkConfig->uplinkBWP_ToAddModList->list.array[i]->bwp_Dedicated; + if (ulbwp && ulbwp->pusch_Config && ulbwp->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) + allocate_32_ul_harq(ulbwp->pusch_Config->choice.setup); } } } } -static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, - const NR_ServingCellConfigCommon_t *scc, - const NR_ServingCellConfig_t *servingcellconfigdedicated, - const nr_mac_config_t *configuration) +static NR_BWP_UplinkDedicated_t *configure_initial_ul_bwp(const NR_ServingCellConfigCommon_t *scc, + const nr_mac_config_t *configuration, + int maxMIMO_Layers, + int id) { - const int pdsch_AntennaPorts = - configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; - int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - NR_SpCellConfig_t *SpCellConfig = calloc(1, sizeof(*SpCellConfig)); - SpCellConfig->servCellIndex = NULL; - SpCellConfig->reconfigurationWithSync = NULL; - SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - SpCellConfig->rlf_TimersAndConstants = NULL; - - SpCellConfig->spCellConfigDedicated = calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated)); - SpCellConfig->spCellConfigDedicated->uplinkConfig = calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig)); - NR_UplinkConfig_t *uplinkConfig = SpCellConfig->spCellConfigDedicated->uplinkConfig; - NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1, sizeof(*initialUplinkBWP)); - uplinkConfig->initialUplinkBWP = initialUplinkBWP; + NR_BWP_t *genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + int curr_bwp = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); initialUplinkBWP->pucch_Config = calloc(1, sizeof(*initialUplinkBWP->pucch_Config)); initialUplinkBWP->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup; NR_PUCCH_Config_t *pucch_Config = calloc(1, sizeof(*pucch_Config)); @@ -3156,44 +3240,35 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, pucch_Config->resourceToAddModList = calloc(1, sizeof(*pucch_Config->resourceToAddModList)); pucch_Config->resourceToReleaseList = NULL; int num_pucch2 = get_nb_pucch2_per_slot(scc, curr_bwp); - config_pucch_resset0(pucch_Config, uid, curr_bwp, num_pucch2, NULL); - config_pucch_resset1(pucch_Config, uid, num_pucch2, NULL); + config_pucch_resset0(pucch_Config, id, curr_bwp, num_pucch2, NULL); + config_pucch_resset1(pucch_Config, id, num_pucch2, NULL); set_pucch_power_config(pucch_Config, configuration->do_CSIRS); - initialUplinkBWP->pusch_Config = config_pusch(NULL, configuration->use_deltaMCS, scc, NULL); - - long maxMIMO_Layers = uplinkConfig && uplinkConfig->pusch_ServingCellConfig - && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 - && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - ? *uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - : 1; + initialUplinkBWP->pusch_Config = config_pusch(configuration->use_deltaMCS, scc, NULL, configuration->ptrs); // We are using do_srs = 0 here because the periodic SRS will only be enabled in update_cellGroupConfig() if do_srs == 1 - initialUplinkBWP->srs_Config = get_config_srs(scc, NULL, curr_bwp, uid, 0, maxMIMO_Layers, configuration->minRXTXTIME, 0); + initialUplinkBWP->srs_Config = get_config_srs(scc, NULL, curr_bwp, id, 0, maxMIMO_Layers, configuration->minRXTXTIME, 0); scheduling_request_config(scc, pucch_Config, scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing); + set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, genericParameters->subcarrierSpacing); + return initialUplinkBWP; +} - set_dl_DataToUL_ACK(pucch_Config, - configuration->minRXTXTIME, - scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing); - - SpCellConfig->spCellConfigDedicated->initialDownlinkBWP = - calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated->initialDownlinkBWP)); - NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; +static NR_BWP_DownlinkDedicated_t *configure_initial_dl_bwp(const NR_ServingCellConfigCommon_t *scc, + const int pdsch_AntennaPorts, + uint64_t bitmap, + const nr_mac_config_t *configuration) +{ + NR_BWP_DownlinkDedicated_t *bwp_Dedicated = calloc(1, sizeof(*bwp_Dedicated)); bwp_Dedicated->pdcch_Config = calloc(1, sizeof(*bwp_Dedicated->pdcch_Config)); bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup; - bwp_Dedicated->pdcch_Config->choice.setup = calloc(1, sizeof(*bwp_Dedicated->pdcch_Config->choice.setup)); - - bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = - calloc(1, sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList)); - - bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = - calloc(1, sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList)); - - uint64_t bitmap = get_ssb_bitmap(scc); + NR_PDCCH_Config_t *pdcch_Config = calloc(1, sizeof(*pdcch_Config)); + pdcch_Config->searchSpacesToAddModList = calloc(1, sizeof(*pdcch_Config->searchSpacesToAddModList)); + pdcch_Config->controlResourceSetToAddModList = calloc(1, sizeof(*pdcch_Config->controlResourceSetToAddModList)); + NR_BWP_t *genericParameters = &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + int curr_bwp = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); NR_ControlResourceSet_t *coreset = get_coreset_config(0, curr_bwp, bitmap); - - asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset); + asn1cSeqAdd(&pdcch_Config->controlResourceSetToAddModList->list, coreset); int css_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; css_num_agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; @@ -3206,22 +3281,159 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, searchspaceid = 5; int rrc_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; int num_cces = get_coreset_num_cces(coreset->frequencyDomainResources.buf, coreset->duration); - verify_agg_levels(num_cces, - configuration->num_agg_level_candidates, - coreset->controlResourceSetId, - rrc_num_agg_level_candidates); + verify_agg_levels(num_cces, configuration->num_agg_level_candidates, coreset->controlResourceSetId, rrc_num_agg_level_candidates); NR_SearchSpace_t *ss2 = rrc_searchspace_config(false, searchspaceid, coreset->controlResourceSetId, rrc_num_agg_level_candidates); - asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss); - asn1cSeqAdd(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list, ss2); + asn1cSeqAdd(&pdcch_Config->searchSpacesToAddModList->list, ss); + asn1cSeqAdd(&pdcch_Config->searchSpacesToAddModList->list, ss2); + bwp_Dedicated->pdcch_Config->choice.setup = pdcch_Config; - bwp_Dedicated->pdsch_Config = config_pdsch(bitmap, 0, pdsch_AntennaPorts); + bwp_Dedicated->pdsch_Config = config_pdsch(bitmap, 0, pdsch_AntennaPorts, configuration->ptrs); + return bwp_Dedicated; +} - SpCellConfig->spCellConfigDedicated->tag_Id = 0; - SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig = - calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig)); +static NR_CSI_MeasConfig_t *get_csiMeasConfig(const NR_ServingCellConfig_t *configDedicated, + const NR_ServingCellConfigCommon_t *scc, + const nr_mac_config_t *configuration, + int uid, + int bwp_id, + uint64_t bitmap) +{ + NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1, sizeof(*csi_MeasConfig)); + csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); + csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; + csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); + csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; + csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); + csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; + + NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1, sizeof(*ssbresset0)); + ssbresset0->csi_SSB_ResourceSetId = 0; + + for (int i = 0; i < 64; i++) { + if ((bitmap >> (63 - i)) & 0x01) { + NR_SSB_Index_t *ssbres = NULL; + asn1cCallocOne(ssbres, i); + asn1cSeqAdd(&ssbresset0->csi_SSB_ResourceList.list, ssbres); + } + } + asn1cSeqAdd(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list, ssbresset0); + + int curr_bwp; + NR_SetupRelease_PDSCH_Config_t *pdsch_Config; + if (bwp_id == 0) { + pdsch_Config = configDedicated->initialDownlinkBWP->pdsch_Config; + curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { + NR_BWP_Downlink_t *bwp = configDedicated->downlinkBWP_ToAddModList->list.array[0]; + pdsch_Config = bwp->bwp_Dedicated->pdsch_Config; + curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + AssertFatal(bwp_id == bwp->bwp_Id, "BWP ID doesn't match\n"); + } + + const int pdsch_AntennaPorts = + configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; + config_csirs(scc, csi_MeasConfig, pdsch_AntennaPorts, curr_bwp, configuration->do_CSIRS, bwp_id); + config_csiim(configuration->do_CSIRS, pdsch_AntennaPorts, curr_bwp, csi_MeasConfig, bwp_id); + + NR_CSI_ResourceConfig_t *csires1 = calloc(1, sizeof(*csires1)); + csires1->csi_ResourceConfigId = bwp_id + 20; + csires1->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; + csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = + calloc(1, sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); + csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = + calloc(1, sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); + NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1, sizeof(*ssbres00)); + *ssbres00 = 0; + asn1cSeqAdd(&csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list, ssbres00); + csires1->bwp_Id = bwp_id; + csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; + asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires1); + + int pucch_Resource = 2; + if (configuration->do_CSIRS) { + NR_CSI_ResourceConfig_t *csires0 = calloc(1, sizeof(*csires0)); + csires0->csi_ResourceConfigId = bwp_id; + csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = + calloc(1, sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = + calloc(1, sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); + NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1, sizeof(*nzp0)); + *nzp0 = bwp_id; + asn1cSeqAdd(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list, nzp0); + csires0->bwp_Id = bwp_id; + csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; + asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires0); + } + + if (configuration->do_CSIRS && pdsch_AntennaPorts > 1) { + NR_CSI_ResourceConfig_t *csires2 = calloc(1, sizeof(*csires2)); + csires2->csi_ResourceConfigId = bwp_id + 10; + csires2->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList; + csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList = + calloc(1, sizeof(*csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList)); + NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1, sizeof(*csiim00)); + *csiim00 = bwp_id; + asn1cSeqAdd(&csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list, csiim00); + csires2->bwp_Id = bwp_id; + csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; + asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires2); + + NR_PUCCH_CSI_Resource_t *pucchcsi = calloc(1, sizeof(*pucchcsi)); + pucchcsi->uplinkBandwidthPartId = bwp_id; + pucchcsi->pucch_Resource = pucch_Resource; + config_csi_meas_report(csi_MeasConfig, + scc, + pucchcsi, + pdsch_Config, + &configuration->pdsch_AntennaPorts, + *configDedicated->pdsch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers, + bwp_id, + uid, + curr_bwp); + } + NR_PUCCH_CSI_Resource_t *pucchrsrp = calloc(1, sizeof(*pucchrsrp)); + pucchrsrp->uplinkBandwidthPartId = bwp_id; + pucchrsrp->pucch_Resource = pucch_Resource; + config_rsrp_meas_report(csi_MeasConfig, + scc, + pucchrsrp, + configuration->do_CSIRS, + bwp_id + 10, + uid, + curr_bwp, + pdsch_AntennaPorts, + configuration->do_SINR); + return csi_MeasConfig; +} + +static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, + const NR_ServingCellConfigCommon_t *scc, + const nr_mac_config_t *configuration) +{ + const int pdsch_AntennaPorts = + configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; + NR_SpCellConfig_t *SpCellConfig = calloc(1, sizeof(*SpCellConfig)); + SpCellConfig->servCellIndex = NULL; + SpCellConfig->reconfigurationWithSync = NULL; + SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL; + SpCellConfig->rlf_TimersAndConstants = NULL; + + NR_ServingCellConfig_t *configDedicated = calloc(1, sizeof(*configDedicated)); + configDedicated->uplinkConfig = calloc(1, sizeof(*configDedicated->uplinkConfig)); + NR_UplinkConfig_t *uplinkConfig = configDedicated->uplinkConfig; + long maxMIMO_Layers = uplinkConfig + && uplinkConfig->pusch_ServingCellConfig + && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 + && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers + ? *uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers + : 1; + + configDedicated->tag_Id = 0; + configDedicated->pdsch_ServingCellConfig = calloc(1, sizeof(*configDedicated->pdsch_ServingCellConfig)); NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1, sizeof(*pdsch_servingcellconfig)); - SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; - SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; + configDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; + configDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; @@ -3242,166 +3454,42 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, pdsch_servingcellconfig->ext3->downlinkHARQ_FeedbackDisabled_r17->choice.setup.buf[3] = 0xFF; } - // Downlink BWPs - int n_dl_bwp = 0; - if (servingcellconfigdedicated && servingcellconfigdedicated->downlinkBWP_ToAddModList - && servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count > 0) { - n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count; - } - int default_dl_bwp = 0; - int first_active_dl_bwp = 0; - if (n_dl_bwp > 0) { - SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = - calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); - for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) { - NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); - config_downlinkBWP(bwp, scc, servingcellconfigdedicated, NULL, 0, false, bwp_loop, true, configuration->num_agg_level_candidates); - asn1cSeqAdd(&SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list, bwp); - } - const NR_BWP_Id_t *firstActiveDownlinkBWP_Id = servingcellconfigdedicated->firstActiveDownlinkBWP_Id; - first_active_dl_bwp = firstActiveDownlinkBWP_Id ? *firstActiveDownlinkBWP_Id : 1; - const NR_BWP_Id_t *defaultDownlinkBWP_Id = servingcellconfigdedicated->defaultDownlinkBWP_Id; - default_dl_bwp = defaultDownlinkBWP_Id ? *defaultDownlinkBWP_Id : 1; - } - asn1cCallocOne(SpCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id, first_active_dl_bwp); - asn1cCallocOne(SpCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id, default_dl_bwp); + uint64_t bitmap = get_ssb_bitmap(scc); + int first_active_bwp = 0; + if (configuration->num_additional_bwps > 0) + first_active_bwp = configuration->first_active_bwp; - // Uplink BWPs - int n_ul_bwp = 0; - if (servingcellconfigdedicated && servingcellconfigdedicated->uplinkConfig - && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList - && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count > 0) { - n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; - } - int first_active_ul_bwp = 0; - if (n_ul_bwp > 0) { + asn1cCallocOne(configDedicated->firstActiveDownlinkBWP_Id, first_active_bwp); + asn1cCallocOne(uplinkConfig->firstActiveUplinkBWP_Id, first_active_bwp); + if (first_active_bwp == 0) { + uplinkConfig->initialUplinkBWP = configure_initial_ul_bwp(scc, configuration, maxMIMO_Layers, uid); + configDedicated->initialDownlinkBWP = configure_initial_dl_bwp(scc, pdsch_AntennaPorts, bitmap, configuration); + } else { + configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList)); + NR_BWP_Downlink_t *bwp = config_downlinkBWP(scc, + NULL, + 0, + false, + first_active_bwp - 1, + true, + configuration); + asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp); uplinkConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*uplinkConfig->uplinkBWP_ToAddModList)); - for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) { - NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp)); - config_uplinkBWP(ubwp, bwp_loop, true, uid, configuration, servingcellconfigdedicated, scc, NULL); - asn1cSeqAdd(&uplinkConfig->uplinkBWP_ToAddModList->list, ubwp); - } - const NR_BWP_Id_t *firstActiveUplinkBWP_Id = servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id; - first_active_ul_bwp = firstActiveUplinkBWP_Id ? *firstActiveUplinkBWP_Id : 1; - } - asn1cCallocOne(uplinkConfig->firstActiveUplinkBWP_Id, first_active_ul_bwp); - - SpCellConfig->spCellConfigDedicated->csi_MeasConfig = calloc(1, sizeof(*SpCellConfig->spCellConfigDedicated->csi_MeasConfig)); - SpCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; - - NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1, sizeof(*csi_MeasConfig)); - SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig; - - csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); - csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; - csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); - csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; - csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); - csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; - - NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1, sizeof(*ssbresset0)); - ssbresset0->csi_SSB_ResourceSetId = 0; - - for (int i = 0; i < 64; i++) { - if ((bitmap >> (63 - i)) & 0x01) { - NR_SSB_Index_t *ssbres = NULL; - asn1cCallocOne(ssbres, i); - asn1cSeqAdd(&ssbresset0->csi_SSB_ResourceList.list, ssbres); - } - } - asn1cSeqAdd(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list, ssbresset0); - - int bwp_loop_end = n_dl_bwp + 1; - for (int bwp_loop = 0; bwp_loop < bwp_loop_end; bwp_loop++) { - int curr_bwp, bwp_id; - struct NR_SetupRelease_PDSCH_Config *pdsch_Config; - if (bwp_loop == 0) { - pdsch_Config = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config; - curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - bwp_id = 0; - } else { - NR_BWP_Downlink_t *bwp = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_loop - 1]; - pdsch_Config = bwp->bwp_Dedicated->pdsch_Config; - curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - bwp_id = bwp->bwp_Id; - } - - config_csirs(scc, csi_MeasConfig, pdsch_AntennaPorts, curr_bwp, configuration->do_CSIRS, bwp_loop); - config_csiim(configuration->do_CSIRS, pdsch_AntennaPorts, curr_bwp, csi_MeasConfig, bwp_loop); - - NR_CSI_ResourceConfig_t *csires1 = calloc(1, sizeof(*csires1)); - csires1->csi_ResourceConfigId = bwp_id + 20; - csires1->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; - csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = - calloc(1, sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = - calloc(1, sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); - NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1, sizeof(*ssbres00)); - *ssbres00 = 0; - asn1cSeqAdd(&csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list, ssbres00); - csires1->bwp_Id = bwp_id; - csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires1); - - int pucch_Resource = 2; - - if (configuration->do_CSIRS) { - NR_CSI_ResourceConfig_t *csires0 = calloc(1, sizeof(*csires0)); - csires0->csi_ResourceConfigId = bwp_id; - csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = - calloc(1, sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = - calloc(1, sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); - NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1, sizeof(*nzp0)); - *nzp0 = bwp_loop; - asn1cSeqAdd(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list, nzp0); - csires0->bwp_Id = bwp_id; - csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires0); - } - - if (configuration->do_CSIRS && pdsch_AntennaPorts > 1) { - NR_CSI_ResourceConfig_t *csires2 = calloc(1, sizeof(*csires2)); - csires2->csi_ResourceConfigId = bwp_id + 10; - csires2->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList; - csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList = - calloc(1, sizeof(*csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList)); - NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1, sizeof(*csiim00)); - *csiim00 = bwp_loop; - asn1cSeqAdd(&csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list, csiim00); - csires2->bwp_Id = bwp_id; - csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires2); - - NR_PUCCH_CSI_Resource_t *pucchcsi = calloc(1, sizeof(*pucchcsi)); - pucchcsi->uplinkBandwidthPartId = bwp_id; - pucchcsi->pucch_Resource = pucch_Resource; - config_csi_meas_report(csi_MeasConfig, - scc, - pucchcsi, - pdsch_Config, - &configuration->pdsch_AntennaPorts, - *pdsch_servingcellconfig->ext1->maxMIMO_Layers, - bwp_id, - uid, - curr_bwp); - } - NR_PUCCH_CSI_Resource_t *pucchrsrp = calloc(1, sizeof(*pucchrsrp)); - pucchrsrp->uplinkBandwidthPartId = bwp_id; - pucchrsrp->pucch_Resource = pucch_Resource; - config_rsrp_meas_report(csi_MeasConfig, - scc, - pucchrsrp, - configuration->do_CSIRS, - bwp_id + 10, - uid, - curr_bwp, - pdsch_AntennaPorts, - configuration->do_SINR); + NR_BWP_Uplink_t *ubwp = config_uplinkBWP(first_active_bwp - 1, true, uid, maxMIMO_Layers, configuration, scc, NULL); + asn1cSeqAdd(&uplinkConfig->uplinkBWP_ToAddModList->list, ubwp); } - fill_harq_IEs(SpCellConfig->spCellConfigDedicated, configuration->num_dlharq, configuration->num_ulharq); + configDedicated->csi_MeasConfig = calloc(1, sizeof(*configDedicated->csi_MeasConfig)); + configDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; + configDedicated->csi_MeasConfig->choice.setup = get_csiMeasConfig(configDedicated, + scc, + configuration, + uid, + first_active_bwp, + bitmap); + + fill_harq_IEs(configDedicated, configuration->num_dlharq, configuration->num_ulharq, first_active_bwp); + SpCellConfig->spCellConfigDedicated = configDedicated; if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_SpCellConfig, SpCellConfig); @@ -3528,7 +3616,7 @@ NR_RLC_BearerConfig_t *get_DRB_RLC_BearerConfig(long lcChannelId, return rlc_BearerConfig; } -static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *scd) +static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *configuration) { frame_structure_t *fs = &RC.nrmac[0]->frame_structure; int srs_offset = get_ul_slot_offset(fs, uid, false); @@ -3538,8 +3626,7 @@ static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon return false; } - /* for RedCap, scd is NULL */ - int n_dl_bwp = scd && scd->downlinkBWP_ToAddModList ? scd->downlinkBWP_ToAddModList->list.count : 1; + int n_dl_bwp = 1 + configuration->num_additional_bwps; // initial + additional bwps int csi_offset = fs->numb_slots_period * n_dl_bwp; // see set_csirs_periodicity if (csi_offset / 320 >= get_full_dl_slots_per_period(fs)) { @@ -3573,14 +3660,13 @@ static bool verify_radio_configuration(int uid, const NR_ServingCellConfigCommon NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, - const NR_ServingCellConfig_t *servingcellconfigdedicated, const nr_mac_config_t *configuration, const nr_rlc_configuration_t *default_rlc_config) { - if (!verify_radio_configuration(uid, scc, servingcellconfigdedicated)) + if (!verify_radio_configuration(uid, scc, configuration)) return NULL; - NR_SpCellConfig_t *spCellConfig = get_initial_SpCellConfig(uid, scc, servingcellconfigdedicated, configuration); + NR_SpCellConfig_t *spCellConfig = get_initial_SpCellConfig(uid, scc, configuration); NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig)); cellGroupConfig->cellGroupId = 0; @@ -3605,35 +3691,11 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, return cellGroupConfig; } -void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, - const int uid, - const NR_UE_NR_Capability_t *uecap, - const nr_mac_config_t *configuration, - const NR_ServingCellConfigCommon_t *scc) +static long set_ul_max_layers(const nr_mac_config_t *configuration, const NR_UE_NR_Capability_t *uecap) { - DevAssert(cellGroupConfig != NULL); - DevAssert(cellGroupConfig->spCellConfig != NULL); - DevAssert(configuration != NULL); - DevAssert(scc != NULL); - - NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; - - NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup; - set_dl_maxmimolayers(pdsch_servingcellconfig, scc, uecap, configuration->maxMIMO_layers); - - NR_CSI_MeasConfig_t *csi_MeasConfig = SpCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - for (int report = 0; report < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; report++) { - NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[report]; - if(csirep->codebookConfig) - config_csi_codebook(&configuration->pdsch_AntennaPorts, *pdsch_servingcellconfig->ext1->maxMIMO_Layers, csirep->codebookConfig); - } - - int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - NR_UplinkConfig_t *uplinkConfig = - SpCellConfig && SpCellConfig->spCellConfigDedicated ? SpCellConfig->spCellConfigDedicated->uplinkConfig : NULL; - - uint8_t ul_max_layers = 1; - if (uecap && uecap->featureSets && uecap->featureSets->featureSetsUplinkPerCC + long ul_max_layers = 1; + if (uecap && uecap->featureSets + && uecap->featureSets->featureSetsUplinkPerCC && uecap->featureSets->featureSetsUplinkPerCC->list.count > 0) { NR_FeatureSetUplinkPerCC_t *ul_feature_setup_per_cc = uecap->featureSets->featureSetsUplinkPerCC->list.array[0]; if (ul_feature_setup_per_cc->mimo_CB_PUSCH->maxNumberMIMO_LayersCB_PUSCH) { @@ -3649,88 +3711,186 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, } } ul_max_layers = min(ul_max_layers, configuration->pusch_AntennaPorts); - if (uplinkConfig->initialUplinkBWP->pusch_Config) { - NR_PUSCH_Config_t *pusch_Config = uplinkConfig->initialUplinkBWP->pusch_Config->choice.setup; - if (pusch_Config->maxRank == NULL) { - pusch_Config->maxRank = calloc(1, sizeof(*pusch_Config->maxRank)); - } - *pusch_Config->maxRank = ul_max_layers; + } + return ul_max_layers; +} + +NR_CellGroupConfig_t * update_cellGroupConfig_for_BWP_switch(NR_CellGroupConfig_t *cellGroupConfig, + const nr_mac_config_t *configuration, + const NR_UE_NR_Capability_t *uecap, + const NR_ServingCellConfigCommon_t *scc, + int uid, + int old_bwp, + int new_bwp) +{ + NR_SpCellConfig_t *spCellConfig = cellGroupConfig->spCellConfig; + NR_ServingCellConfig_t *configDedicated = spCellConfig->spCellConfigDedicated; + *configDedicated->firstActiveDownlinkBWP_Id = new_bwp; + NR_UplinkConfig_t *uplinkConfig = configDedicated->uplinkConfig; + *uplinkConfig->firstActiveUplinkBWP_Id = new_bwp; + long ul_maxMIMO_Layers = set_ul_max_layers(configuration, uecap); + + // release old BWP + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *dl_BWP_list = configDedicated->downlinkBWP_ToAddModList; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *ul_BWP_list = uplinkConfig->uplinkBWP_ToAddModList; + if (old_bwp > 0) { // we need to remove old BWP only if it is not the initial + AssertFatal(dl_BWP_list, "Source BWP %d should be present in the list\n", old_bwp); + AssertFatal(ul_BWP_list, "Source BWP %d should be present in the list\n", old_bwp); + NR_BWP_Id_t id = dl_BWP_list->list.array[0]->bwp_Id; + if (!configDedicated->downlinkBWP_ToReleaseList) + configDedicated->downlinkBWP_ToReleaseList = calloc_or_fail(1, sizeof(*configDedicated->downlinkBWP_ToReleaseList)); + asn1cSequenceAdd(configDedicated->downlinkBWP_ToReleaseList->list, NR_BWP_Id_t, rel_id); + *rel_id = id; + AssertFatal(configDedicated->downlinkBWP_ToReleaseList->list.count == 1, + "logic error: there shouldn't be more than 1 BWP to release, but downlinkBWP_ToReleaseList has %d\n", + configDedicated->downlinkBWP_ToReleaseList->list.count); + + id = ul_BWP_list->list.array[0]->bwp_Id; + if (!uplinkConfig->uplinkBWP_ToReleaseList) + uplinkConfig->uplinkBWP_ToReleaseList = calloc_or_fail(1, sizeof(*uplinkConfig->uplinkBWP_ToReleaseList)); + asn1cSequenceAdd(uplinkConfig->uplinkBWP_ToReleaseList->list, NR_BWP_Id_t, ul_rel_id); + *ul_rel_id = id; + AssertFatal(uplinkConfig->uplinkBWP_ToReleaseList->list.count == 1, + "logic error: there shouldn't be more than 1 BWP to release, but uplinkBWP_ToReleaseList has %d\n", + uplinkConfig->uplinkBWP_ToReleaseList->list.count); + } + + uint64_t bitmap = get_ssb_bitmap(scc); + const int pdsch_AntennaPorts = + configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; + // add new BWP + if (new_bwp == 0) { + if (!configDedicated->initialDownlinkBWP) + configDedicated->initialDownlinkBWP = calloc_or_fail(1, sizeof(*configDedicated->initialDownlinkBWP)); + if (!uplinkConfig->initialUplinkBWP) + uplinkConfig->initialUplinkBWP = calloc_or_fail(1, sizeof(*uplinkConfig->initialUplinkBWP)); + uplinkConfig->initialUplinkBWP = configure_initial_ul_bwp(scc, configuration, ul_maxMIMO_Layers, uid); + configDedicated->initialDownlinkBWP = configure_initial_dl_bwp(scc, pdsch_AntennaPorts, bitmap, configuration); + } else { + if (!configDedicated->downlinkBWP_ToAddModList) + configDedicated->downlinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*configDedicated->downlinkBWP_ToAddModList)); + NR_BWP_Downlink_t *dl_bwp = config_downlinkBWP(scc, + uecap, + pdsch_AntennaPorts, + configuration->force_256qam_off, + new_bwp - 1, + true, + configuration); + asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, dl_bwp); + + if (!uplinkConfig->uplinkBWP_ToAddModList) + uplinkConfig->uplinkBWP_ToAddModList = calloc_or_fail(1, sizeof(*uplinkConfig->uplinkBWP_ToAddModList)); + NR_BWP_Uplink_t *ul_bwp = config_uplinkBWP(new_bwp - 1, true, uid, ul_maxMIMO_Layers, configuration, scc, uecap); + asn1cSeqAdd(&uplinkConfig->uplinkBWP_ToAddModList->list, ul_bwp); + } + + ASN_STRUCT_FREE(asn_DEF_NR_CSI_MeasConfig, configDedicated->csi_MeasConfig->choice.setup); + configDedicated->csi_MeasConfig->choice.setup = get_csiMeasConfig(configDedicated, + scc, + configuration, + uid, + new_bwp, + bitmap); + + // we temporarily need to keep both the old and the new BWP in the CG used by the gNB + // while removing the old from the CG sent to the UE + if (old_bwp > 0) { + NR_CellGroupConfig_t *clone_cg = NULL; + const int copy_result = asn_copy(&asn_DEF_NR_CellGroupConfig, (void **)&clone_cg, cellGroupConfig); + AssertFatal(copy_result == 0, "unable to copy NR_CellGroupConfig for cloning\n"); + clean_bwp_structures(clone_cg->spCellConfig); + return clone_cg; + } + return NULL; +} + +void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, + const int uid, + const NR_UE_NR_Capability_t *uecap, + const nr_mac_config_t *configuration, + const NR_ServingCellConfigCommon_t *scc) +{ + DevAssert(cellGroupConfig != NULL); + DevAssert(cellGroupConfig->spCellConfig != NULL); + DevAssert(cellGroupConfig->spCellConfig->spCellConfigDedicated != NULL); + DevAssert(configuration != NULL); + DevAssert(scc != NULL); + + NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; + NR_ServingCellConfig_t *spCellConfigDedicated = SpCellConfig->spCellConfigDedicated; + NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup; + set_dl_maxmimolayers(pdsch_servingcellconfig, scc, uecap, configuration->maxMIMO_layers); + + NR_CSI_MeasConfig_t *csi_MeasConfig = spCellConfigDedicated->csi_MeasConfig->choice.setup; + for (int report = 0; report < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; report++) { + NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[report]; + if(csirep->codebookConfig) + config_csi_codebook(&configuration->pdsch_AntennaPorts, *pdsch_servingcellconfig->ext1->maxMIMO_Layers, csirep->codebookConfig); + } + + NR_UplinkConfig_t *uplinkConfig = spCellConfigDedicated->uplinkConfig; + long maxMIMO_Layers = set_ul_max_layers(configuration, uecap); + if (!uplinkConfig->pusch_ServingCellConfig) + uplinkConfig->pusch_ServingCellConfig = calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig)); + uplinkConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; + if (!uplinkConfig->pusch_ServingCellConfig->choice.setup) + uplinkConfig->pusch_ServingCellConfig->choice.setup = calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup)); + if (!uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1) + uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 = + calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1)); + asn1cCallocOne(uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers, maxMIMO_Layers); + + // Update UL BWP + NR_BWP_UplinkDedicated_t *ul_bwp_Dedicated = NULL; + int curr_bwp = 0; + int bwp_id = 0; + if (uplinkConfig && uplinkConfig->initialUplinkBWP) { + ul_bwp_Dedicated = uplinkConfig->initialUplinkBWP; + curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else if (uplinkConfig && uplinkConfig->uplinkBWP_ToAddModList) { + struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig->uplinkBWP_ToAddModList; + AssertFatal(UL_BWP_list->list.count == 1, "We should only have 1 BWP configured at a given time\n"); + NR_BWP_Uplink_t *ul_bwp = UL_BWP_list->list.array[0]; + curr_bwp = NRRIV2BW(ul_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + ul_bwp_Dedicated = ul_bwp->bwp_Dedicated; + bwp_id = ul_bwp->bwp_Id; + } + if (ul_bwp_Dedicated) { + NR_PUSCH_Config_t *pusch_Config = ul_bwp_Dedicated->pusch_Config->choice.setup; + if (!pusch_Config->maxRank) + pusch_Config->maxRank = calloc(1, sizeof(*pusch_Config->maxRank)); + *pusch_Config->maxRank = maxMIMO_Layers; + if (configuration->do_SRS) { + ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_SRS_Config, ul_bwp_Dedicated->srs_Config); + ul_bwp_Dedicated->srs_Config = get_config_srs(scc, + uecap, + curr_bwp, + uid, + bwp_id, + maxMIMO_Layers, + configuration->minRXTXTIME, + configuration->do_SRS); } - if (!uplinkConfig->pusch_ServingCellConfig) - uplinkConfig->pusch_ServingCellConfig = calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig)); - uplinkConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; - if (!uplinkConfig->pusch_ServingCellConfig->choice.setup) - uplinkConfig->pusch_ServingCellConfig->choice.setup = calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup)); - if (!uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1) - uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 = - calloc(1, sizeof(*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1)); - asn1cCallocOne(uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers, ul_max_layers); + set_ul_mcs_table(configuration->force_UL256qam_off ? NULL : uecap, scc, pusch_Config); } - long maxMIMO_Layers = uplinkConfig && uplinkConfig->pusch_ServingCellConfig - && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 - && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - ? *uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - : 1; - - // UL and SRS configuration - if (configuration->do_SRS && uplinkConfig && uplinkConfig->initialUplinkBWP) { - ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_SRS_Config, uplinkConfig->initialUplinkBWP->srs_Config); - uplinkConfig->initialUplinkBWP->srs_Config = get_config_srs(scc, - uecap, - curr_bwp, - uid, - 0, - maxMIMO_Layers, - configuration->minRXTXTIME, - configuration->do_SRS); + // Update DL BWP + NR_BWP_DownlinkDedicated_t *bwp_Dedicated = NULL; + int scs = -1; + if (spCellConfigDedicated->initialDownlinkBWP) { + bwp_Dedicated = spCellConfigDedicated->initialDownlinkBWP; + scs = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + } else if (spCellConfigDedicated->downlinkBWP_ToAddModList) { + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = spCellConfigDedicated->downlinkBWP_ToAddModList; + AssertFatal(DL_BWP_list->list.count == 1, "We should only have 1 BWP configured at a given time\n"); + NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[0]; + bwp_Dedicated = bwp->bwp_Dedicated; + scs = bwp->bwp_Common->genericParameters.subcarrierSpacing; } - - // Set DL MCS table - NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; - set_dl_mcs_table(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, - configuration->force_256qam_off ? NULL : uecap, - bwp_Dedicated, - scc); - - NR_BWP_UplinkDedicated_t *ul_bwp_Dedicated = SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; - set_ul_mcs_table(configuration->force_UL256qam_off ? NULL : uecap, scc, ul_bwp_Dedicated->pusch_Config->choice.setup); - - struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = - SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; - struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig ? uplinkConfig->uplinkBWP_ToAddModList : NULL; - if (DL_BWP_list) { - for (int i = 0; i < DL_BWP_list->list.count; i++) { - NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i]; - int scs = bwp->bwp_Common->genericParameters.subcarrierSpacing; - set_dl_mcs_table(scs, configuration->force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, scc); - } + if (bwp_Dedicated) { + set_dl_mcs_table(scs, configuration->force_256qam_off ? NULL : uecap, bwp_Dedicated, scc); + update_cqitables(bwp_Dedicated->pdsch_Config, csi_MeasConfig); } - if (UL_BWP_list) { - for (int i = 0; i < UL_BWP_list->list.count; i++) { - NR_BWP_Uplink_t *ul_bwp = UL_BWP_list->list.array[i]; - int bwp_size = NRRIV2BW(ul_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - if (ul_bwp->bwp_Dedicated->pusch_Config) { - NR_PUSCH_Config_t *pusch_Config = ul_bwp->bwp_Dedicated->pusch_Config->choice.setup; - set_ul_mcs_table(configuration->force_UL256qam_off ? NULL : uecap, scc, pusch_Config); - if (pusch_Config->maxRank == NULL) { - pusch_Config->maxRank = calloc(1, sizeof(*pusch_Config->maxRank)); - } - *pusch_Config->maxRank = ul_max_layers; - } - - ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_SRS_Config, ul_bwp->bwp_Dedicated->srs_Config); - ul_bwp->bwp_Dedicated->srs_Config = get_config_srs(scc, - uecap, - bwp_size, - uid, - i + 1, - maxMIMO_Layers, - configuration->minRXTXTIME, - configuration->do_SRS); - } - } - update_cqitables(bwp_Dedicated->pdsch_Config, csi_MeasConfig); } void free_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig) @@ -3771,7 +3931,6 @@ static NR_ServingCellConfigCommon_t *clone_ServingCellConfigCommon(const NR_Serv } NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, - const NR_ServingCellConfig_t *servingcellconfigdedicated, const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, @@ -3780,10 +3939,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC { const nr_pdsch_AntennaPorts_t *pdschap = &configuration->pdsch_AntennaPorts; const int dl_antenna_ports = pdschap->N1 * pdschap->N2 * pdschap->XP; - const int do_csirs = configuration->do_CSIRS; - AssertFatal(servingcellconfigcommon, "servingcellconfigcommon is null\n"); - AssertFatal(servingcellconfigdedicated, "servingcellconfigdedicated is null\n"); if (uecap == NULL) LOG_E(RRC, "No UE Capabilities available when programming default CellGroup in NSA\n"); @@ -3815,46 +3971,35 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC NR_RLF_TimersAndConstants__ext1__t311_ms30000; secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; + NR_ServingCellConfig_t *configDedicated = calloc(1, sizeof(*configDedicated)); + configDedicated->tdd_UL_DL_ConfigurationDedicated = NULL; /// initialDownlinkBWP - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config = - config_pdsch(bitmap, 0, dl_antenna_ports); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->sps_Config = - NULL; // calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); + configDedicated->initialDownlinkBWP = calloc(1, sizeof(*configDedicated->initialDownlinkBWP)); + configDedicated->initialDownlinkBWP->pdcch_Config = NULL; + configDedicated->initialDownlinkBWP->pdsch_Config = + config_pdsch(bitmap, 0, dl_antenna_ports, configuration->ptrs); + configDedicated->initialDownlinkBWP->sps_Config = NULL; // calloc(1,sizeof(struct NR_SetupRelease_SPS_Config)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = NULL; + configDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = NULL; /// initialUplinkBWP - if (!secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig) { - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig)); + if (!configDedicated->uplinkConfig) { + configDedicated->uplinkConfig = calloc(1, sizeof(*configDedicated->uplinkConfig)); } + NR_UplinkConfig_t *ulConfig = configDedicated->uplinkConfig; NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1, sizeof(*initialUplinkBWP)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP; + ulConfig->initialUplinkBWP = initialUplinkBWP; initialUplinkBWP->pucch_Config = NULL; - NR_PUSCH_Config_t *pusch_Config = NULL; - if (servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) { - pusch_Config = clone_pusch_config( - servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup); - } - initialUplinkBWP->pusch_Config = config_pusch(pusch_Config, configuration->use_deltaMCS,servingcellconfigcommon, uecap); - - long maxMIMO_Layers = - servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig - && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 - && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - ? *servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers - : 1; + initialUplinkBWP->pusch_Config = config_pusch(configuration->use_deltaMCS, + servingcellconfigcommon, + uecap, + configuration->ptrs); + long maxMIMO_Layers = set_ul_max_layers(configuration, uecap); int curr_bwp = NRRIV2BW(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); initialUplinkBWP->srs_Config = get_config_srs(servingcellconfigcommon, @@ -3868,89 +4013,70 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC // Downlink BWPs int n_dl_bwp = 1; - if (servingcellconfigdedicated->downlinkBWP_ToAddModList) { - n_dl_bwp = servingcellconfigdedicated->downlinkBWP_ToAddModList->list.count; + int firstActiveDownlinkBWP_Id = 1; + if (configuration->num_additional_bwps > 0) { + n_dl_bwp = configuration->num_additional_bwps; + firstActiveDownlinkBWP_Id = configuration->first_active_bwp; } - if (n_dl_bwp > 0) { - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)); - for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) { - NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); - config_downlinkBWP(bwp, - servingcellconfigcommon, - servingcellconfigdedicated, - uecap, - dl_antenna_ports, - configuration->force_256qam_off, - bwp_loop, - false, - configuration->num_agg_level_candidates); - asn1cSeqAdd(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list, bwp); - } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id = - servingcellconfigdedicated->firstActiveDownlinkBWP_Id ? *servingcellconfigdedicated->firstActiveDownlinkBWP_Id : 1; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = - servingcellconfigdedicated->defaultDownlinkBWP_Id ? *servingcellconfigdedicated->defaultDownlinkBWP_Id : 1; + configDedicated->downlinkBWP_ToAddModList = calloc(1, sizeof(*configDedicated->downlinkBWP_ToAddModList)); + for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) { + NR_BWP_Downlink_t *bwp = config_downlinkBWP(servingcellconfigcommon, + uecap, + dl_antenna_ports, + configuration->force_256qam_off, + bwp_loop, + false, + configuration); + asn1cSeqAdd(&configDedicated->downlinkBWP_ToAddModList->list, bwp); + configDedicated->firstActiveDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->firstActiveDownlinkBWP_Id)); + *configDedicated->firstActiveDownlinkBWP_Id = firstActiveDownlinkBWP_Id; + configDedicated->defaultDownlinkBWP_Id = calloc(1, sizeof(*configDedicated->defaultDownlinkBWP_Id)); + *configDedicated->defaultDownlinkBWP_Id = 1; } // Uplink BWPs int n_ul_bwp = 1; - if (servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList) { - n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count; + int firstActiveUplinkBWP_Id = 1; + if (configuration->num_additional_bwps > 0) { + n_ul_bwp = configuration->num_additional_bwps; + firstActiveUplinkBWP_Id = configuration->first_active_bwp; } if (n_ul_bwp > 0) { - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)); + ulConfig->uplinkBWP_ToAddModList = calloc(1, sizeof(*ulConfig->uplinkBWP_ToAddModList)); for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) { - NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp)); - config_uplinkBWP(ubwp, bwp_loop, false, uid, configuration, servingcellconfigdedicated, servingcellconfigcommon, uecap); - asn1cSeqAdd(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list, ubwp); + NR_BWP_Uplink_t *ubwp = config_uplinkBWP(bwp_loop, false, uid, maxMIMO_Layers, configuration, servingcellconfigcommon, uecap); + asn1cSeqAdd(&ulConfig->uplinkBWP_ToAddModList->list, ubwp); } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = - servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id - ? *servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id - : 1; + ulConfig->firstActiveUplinkBWP_Id = calloc(1, sizeof(*ulConfig->firstActiveUplinkBWP_Id)); + *ulConfig->firstActiveUplinkBWP_Id = firstActiveUplinkBWP_Id; } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->bwp_InactivityTimer = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL; + configDedicated->bwp_InactivityTimer = NULL; + configDedicated->downlinkBWP_ToReleaseList = NULL; + ulConfig->uplinkBWP_ToReleaseList = NULL; - if (!secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig) - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->present = - NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; - if (!secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup) - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup = calloc( - 1, - sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup)); - NR_PUSCH_ServingCellConfig_t *pusch_scc = - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup; + if (!ulConfig->pusch_ServingCellConfig) + ulConfig->pusch_ServingCellConfig = calloc(1, sizeof(*ulConfig->pusch_ServingCellConfig)); + ulConfig->pusch_ServingCellConfig->present = NR_SetupRelease_PUSCH_ServingCellConfig_PR_setup; + if (!ulConfig->pusch_ServingCellConfig->choice.setup) + ulConfig->pusch_ServingCellConfig->choice.setup = calloc(1, sizeof(*ulConfig->pusch_ServingCellConfig->choice.setup)); + NR_PUSCH_ServingCellConfig_t *pusch_scc = ulConfig->pusch_ServingCellConfig->choice.setup; pusch_scc->codeBlockGroupTransmission = NULL; pusch_scc->rateMatching = NULL; pusch_scc->xOverhead = NULL; if (!pusch_scc->ext1) pusch_scc->ext1 = calloc(1, sizeof(*pusch_scc->ext1)); - asn1cCallocOne(pusch_scc->ext1->maxMIMO_Layers, 1); + asn1cCallocOne(pusch_scc->ext1->maxMIMO_Layers, maxMIMO_Layers); pusch_scc->ext1->processingType2Enabled = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdcch_ServingCellConfig = NULL; + ulConfig->carrierSwitching = NULL; + configDedicated->supplementaryUplink = NULL; + configDedicated->pdcch_ServingCellConfig = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig)); + configDedicated->pdsch_ServingCellConfig = calloc(1, sizeof(*configDedicated->pdsch_ServingCellConfig)); NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1, sizeof(*pdsch_servingcellconfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = - NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; + configDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup; + configDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig; pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; asn1cCallocOne(pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH, NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH_n16); @@ -3971,119 +4097,25 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC pdsch_servingcellconfig->ext3->downlinkHARQ_FeedbackDisabled_r17->choice.setup.buf[3] = 0xFF; } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig = - calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; + configDedicated->csi_MeasConfig = NULL; + configDedicated->csi_MeasConfig = calloc(1, sizeof(*configDedicated->csi_MeasConfig)); + configDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup; + configDedicated->csi_MeasConfig->choice.setup = get_csiMeasConfig(configDedicated, + servingcellconfigcommon, + configuration, + uid, + firstActiveUplinkBWP_Id, + bitmap); - NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1, sizeof(*csi_MeasConfig)); - secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig; + configDedicated->sCellDeactivationTimer = NULL; + configDedicated->crossCarrierSchedulingConfig = NULL; + configDedicated->tag_Id = 0; + configDedicated->dummy1 = NULL; + configDedicated->pathlossReferenceLinking = NULL; + configDedicated->servingCellMO = NULL; - csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); - csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; - - csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); - csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; - - csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); - csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; - - NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1, sizeof(*ssbresset0)); - ssbresset0->csi_SSB_ResourceSetId = 0; - - for (int i = 0; i < 64; i++) { - if ((bitmap >> (63 - i)) & 0x01) { - NR_SSB_Index_t *ssbres = NULL; - asn1cCallocOne(ssbres, i); - asn1cSeqAdd(&ssbresset0->csi_SSB_ResourceList.list, ssbres); - } - } - asn1cSeqAdd(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list, ssbresset0); - - for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) { - NR_BWP_Downlink_t *bwp = - secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_loop]; - int curr_bwp = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - - config_csirs(servingcellconfigcommon, csi_MeasConfig, dl_antenna_ports, curr_bwp, do_csirs, bwp_loop); - config_csiim(do_csirs, dl_antenna_ports, curr_bwp, csi_MeasConfig, bwp_loop); - - if (do_csirs) { - NR_CSI_ResourceConfig_t *csires = calloc(1, sizeof(*csires)); - csires->csi_ResourceConfigId = bwp->bwp_Id; - csires->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; - csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = - calloc(1, sizeof(*csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = - calloc(1, sizeof(*csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); - NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1, sizeof(*nzp0)); - *nzp0 = bwp_loop; - asn1cSeqAdd(&csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list, nzp0); - csires->bwp_Id = bwp->bwp_Id; - csires->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires); - } - if (do_csirs && dl_antenna_ports > 1) { - NR_CSI_ResourceConfig_t *csiresim = calloc(1, sizeof(*csiresim)); - csiresim->csi_ResourceConfigId = bwp->bwp_Id + 10; - csiresim->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList; - csiresim->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList = - calloc(1, sizeof(*csiresim->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList)); - NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1, sizeof(*csiim00)); - *csiim00 = bwp_loop; - asn1cSeqAdd(&csiresim->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list, csiim00); - csiresim->bwp_Id = bwp->bwp_Id; - csiresim->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csiresim); - } - NR_CSI_ResourceConfig_t *ssbres = calloc(1, sizeof(*ssbres)); - ssbres->csi_ResourceConfigId = bwp->bwp_Id + 20; - ssbres->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; - ssbres->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1, sizeof(*ssbres->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - ssbres->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = - calloc(1, sizeof(*ssbres->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); - NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1, sizeof(*ssbres00)); - *ssbres00 = 0; - asn1cSeqAdd(&ssbres->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list, ssbres00); - ssbres->bwp_Id = bwp->bwp_Id; - ssbres->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; - asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, ssbres); - - NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1, sizeof(*pucchcsires1)); - pucchcsires1->uplinkBandwidthPartId = bwp->bwp_Id; - pucchcsires1->pucch_Resource = 2; - config_csi_meas_report(csi_MeasConfig, - servingcellconfigcommon, - pucchcsires1, - bwp->bwp_Dedicated->pdsch_Config, - pdschap, - *pdsch_servingcellconfig->ext1->maxMIMO_Layers, - bwp->bwp_Id, - uid, - curr_bwp); - // this is the same resource as pucchcsires1, but duplicated to avoid - // double free when releasing the CellGroupConfig - NR_PUCCH_CSI_Resource_t *pucchcsires2 = calloc(1, sizeof(*pucchcsires2)); - pucchcsires2->uplinkBandwidthPartId = bwp->bwp_Id; - pucchcsires2->pucch_Resource = 2; - config_rsrp_meas_report(csi_MeasConfig, - servingcellconfigcommon, - pucchcsires2, - do_csirs, - bwp->bwp_Id + 10, - uid, - curr_bwp, - dl_antenna_ports, - configuration->do_SINR); - } - secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id = 0; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->dummy1 = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->pathlossReferenceLinking = NULL; - secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO = NULL; - - fill_harq_IEs(secondaryCellGroup->spCellConfig->spCellConfigDedicated, configuration->num_dlharq, configuration->num_ulharq); + fill_harq_IEs(configDedicated, configuration->num_dlharq, configuration->num_ulharq, firstActiveDownlinkBWP_Id); + secondaryCellGroup->spCellConfig->spCellConfigDedicated = configDedicated; if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_SpCellConfig, (void *)secondaryCellGroup->spCellConfig); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h index 28993e13cf..d5df69b3c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h @@ -89,7 +89,6 @@ NR_SIB19_r17_t *get_SIB19_NR(const NR_ServingCellConfigCommon_t *scc); NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, - const NR_ServingCellConfig_t *servingcellconfigdedicated, const nr_mac_config_t *configuration, const nr_rlc_configuration_t *default_rlc_config); void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, @@ -105,7 +104,6 @@ NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int max_buff * configuration, but it will also overwrite the ServingCellConfig passed in * parameter servingcellconfigdedicated! */ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, - const NR_ServingCellConfig_t *servingcellconfigdedicated, const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, @@ -123,7 +121,13 @@ NR_RLC_BearerConfig_t *get_DRB_RLC_BearerConfig(long lcChannelId, NR_RLC_Config_PR rlc_conf, long priority, const nr_rlc_configuration_t *default_rlc_config); - +NR_CellGroupConfig_t * update_cellGroupConfig_for_BWP_switch(NR_CellGroupConfig_t *cellGroupConfig, + const nr_mac_config_t *configuration, + const NR_UE_NR_Capability_t *uecap, + const NR_ServingCellConfigCommon_t *scc, + int uid, + int old_bwp, + int new_bwp); NR_MeasurementTimingConfiguration_t *get_nr_mtc(uint8_t *buf, uint32_t len); measgap_config_t create_measgap_config(const NR_MeasurementTimingConfiguration_t *mtc, int scs, int min_rxtxtime); int encode_measgap_config(const measgap_config_t *c, uint8_t *buf); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index c016e4c899..3ff6aecea9 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -995,22 +995,32 @@ static NR_MeasIdToAddMod_t *get_MeasId(NR_MeasId_t measId, NR_ReportConfigId_t r NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, int band, int scs, + int nr_pci, NR_ReportConfigToAddMod_t *rc_PER, NR_ReportConfigToAddMod_t *rc_A2, seq_arr_t *rc_A3_seq, seq_arr_t *neigh_seq) { + DevAssert(mt != NULL && mt->frequencyAndTiming != NULL); + const struct NR_MeasTiming__frequencyAndTiming *ft = mt->frequencyAndTiming; + NR_MeasConfig_t *mc = calloc_or_fail(1, sizeof(*mc)); mc->measObjectToAddModList = calloc_or_fail(1, sizeof(*mc->measObjectToAddModList)); mc->reportConfigToAddModList = calloc_or_fail(1, sizeof(*mc->reportConfigToAddModList)); mc->measIdToAddModList = calloc_or_fail(1, sizeof(*mc->measIdToAddModList)); + // Report Configuration: A reporting configuration defines the reporting criteria. The reporting criteria are classified as event + // triggered reporting, periodic reporting, CGI reporting or SFTD reporting. + + // Periodic report if (rc_PER) asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_PER); + // Event A2 if (rc_A2) asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_A2); + // Event A3 if (rc_A3_seq) { for (int i = 0; i < rc_A3_seq->size; i++) { NR_ReportConfigToAddMod_t *rc_A3 = (NR_ReportConfigToAddMod_t *)seq_arr_at(rc_A3_seq, i); @@ -1018,50 +1028,69 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, } } - DevAssert(mt != NULL && mt->frequencyAndTiming != NULL); - const struct NR_MeasTiming__frequencyAndTiming *ft = mt->frequencyAndTiming; - // Measurement Objects: Specifies what is to be measured. For NR and inter-RAT E-UTRA measurements, this may include // cell-specific offsets, blacklisted cells to be ignored and whitelisted cells to consider for measurements. + + // Serving cell NR_MeasObjectToAddMod_t *mo1 = get_MeasObject(ft, band, ft->carrierFreq, 1); - if (neigh_seq) { - NR_MeasObjectNR_t *monr1 = mo1->measObject.choice.measObjectNR; - if (monr1->cellsToAddModList == NULL) - monr1->cellsToAddModList = calloc_or_fail(1, sizeof(*monr1->cellsToAddModList)); - FOR_EACH_SEQ_ARR(nr_neighbour_cell_t *, n, neigh_seq) { - NR_CellsToAddMod_t *cell = calloc_or_fail(1, sizeof(*cell)); - cell->physCellId = n->physicalCellId; - ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell); - } - } + NR_MeasObjectNR_t *monr1 = mo1->measObject.choice.measObjectNR; + monr1->cellsToAddModList = calloc_or_fail(1, sizeof(*monr1->cellsToAddModList)); + NR_CellsToAddMod_t *cell = calloc_or_fail(1, sizeof(*cell)); + cell->physCellId = nr_pci; + ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell); asn1cSeqAdd(&mc->measObjectToAddModList->list, mo1); - // Preparation of measId - uint8_t reportIdx = 0; - for (; reportIdx < mc->reportConfigToAddModList->list.count; reportIdx++) { - const NR_ReportConfigId_t reportId = mc->reportConfigToAddModList->list.array[reportIdx]->reportConfigId; - NR_MeasIdToAddMod_t *measid = get_MeasId(reportIdx + 1, reportId, 1); - asn1cSeqAdd(&mc->measIdToAddModList->list, measid); - } - - // Preparation of measId for neighbour cells for periodic report + // Neighbour cells if (neigh_seq) { int mo_id = 2; FOR_EACH_SEQ_ARR(nr_neighbour_cell_t *, neigh_cell, neigh_seq) { - NR_MeasObjectToAddMod_t *mo_neighbour = get_MeasObject(ft, band, neigh_cell->absoluteFrequencySSB, mo_id); + NR_MeasObjectToAddMod_t *mo_neighbour = get_MeasObject(ft, neigh_cell->band, neigh_cell->absoluteFrequencySSB, mo_id); NR_MeasObjectNR_t *monr = mo_neighbour->measObject.choice.measObjectNR; monr->cellsToAddModList = calloc_or_fail(1, sizeof(*monr->cellsToAddModList)); NR_CellsToAddMod_t *cell = calloc_or_fail(1, sizeof(*cell)); cell->physCellId = neigh_cell->physicalCellId; ASN_SEQUENCE_ADD(&monr->cellsToAddModList->list, cell); asn1cSeqAdd(&mc->measObjectToAddModList->list, mo_neighbour); - NR_MeasIdToAddMod_t *measid = get_MeasId(reportIdx + 1, rc_PER->reportConfigId, mo_id); - asn1cSeqAdd(&mc->measIdToAddModList->list, measid); - reportIdx++; mo_id++; } } + // Measurement identities: A list of measurement identities where each measurement identity links one measurement object with one + // reporting configuration. By configuring multiple measurement identities, it is possible to link more than one measurement + // object to the same reporting configuration, as well as to link more than one reporting configuration to the same measurement + // object. + + // MeasId for Periodic report + int meas_idx = 0; + if (rc_PER) { + for (; meas_idx < mc->measObjectToAddModList->list.count; meas_idx++) { + const NR_MeasObjectId_t measObjectId = mc->measObjectToAddModList->list.array[meas_idx]->measObjectId; + NR_MeasIdToAddMod_t *measid = get_MeasId(meas_idx + 1, rc_PER->reportConfigId, measObjectId); + asn1cSeqAdd(&mc->measIdToAddModList->list, measid); + } + } + + // MeasId for Event A2 + if (rc_A2) { + NR_MeasIdToAddMod_t *measid_A2 = get_MeasId(meas_idx + 1, rc_A2->reportConfigId, 1); + meas_idx++; + asn1cSeqAdd(&mc->measIdToAddModList->list, measid_A2); + } + + // MeasId for Event A3 + if (neigh_seq) { + int i = 0; + FOR_EACH_SEQ_ARR(nr_neighbour_cell_t *, neigh_cell, neigh_seq) { + NR_ReportConfigId_t reportConfigId = neigh_cell->physicalCellId == -1 ? 3 : i + 4; + NR_MeasIdToAddMod_t *measid_A3 = get_MeasId(meas_idx + 1, reportConfigId, i + 2); + meas_idx++; + asn1cSeqAdd(&mc->measIdToAddModList->list, measid_A3); + i++; + } + } + + // Quantity configurations: The quantity configuration defines the measurement filtering configuration used for measurement event + // evaluation and related reporting, and for periodical reporting of that measurement. mc->quantityConfig = calloc_or_fail(1, sizeof(*mc->quantityConfig)); mc->quantityConfig->quantityConfigNR_List = calloc_or_fail(1, sizeof(*mc->quantityConfig->quantityConfigNR_List)); NR_QuantityConfigNR_t *qcnr = calloc_or_fail(1, sizeof(*qcnr)); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 432db0e5cd..dde62d142f 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -153,6 +153,7 @@ int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t r NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, int band, int scs, + int nr_pci, NR_ReportConfigToAddMod_t *rc_PER, NR_ReportConfigToAddMod_t *rc_A2, seq_arr_t *rc_A3_seq, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 68a83c9545..f1d9acba7b 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -314,6 +314,7 @@ typedef struct { int physicalCellId; int absoluteFrequencySSB; int subcarrierSpacing; + int band; plmn_identity_t plmn; uint32_t tac; bool isIntraFrequencyNeighbour; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 000c4f46cb..0e5912aafe 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -544,12 +544,12 @@ static NR_ReportConfigToAddMod_t *prepare_a2_event_report(const nr_a2_event_t *a return rc_A2; } -static NR_ReportConfigToAddMod_t *prepare_a3_event_report(const nr_a3_event_t *a3_event) +static NR_ReportConfigToAddMod_t *prepare_a3_event_report(const nr_a3_event_t *a3_event, NR_ReportConfigId_t reportConfigId) { NR_ReportConfigToAddMod_t *rc_A3 = calloc(1, sizeof(*rc_A3)); // 3 is default A3 Report Config ID. So cellId(0) specific Report Config ID // starts from 4 - rc_A3->reportConfigId = a3_event->pci == -1 ? 3 : a3_event->pci + 4; + rc_A3->reportConfigId = reportConfigId; rc_A3->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; NR_EventTriggerConfig_t *etrc_A3 = calloc(1, sizeof(*etrc_A3)); etrc_A3->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA3; @@ -593,6 +593,7 @@ NR_MeasConfig_t *nr_rrc_get_measconfig(const gNB_RRC_INST *rrc, uint64_t nr_cell NR_ReportConfigToAddMod_t *rc_PER = NULL; NR_ReportConfigToAddMod_t *rc_A2 = NULL; seq_arr_t *rc_A3_seq = NULL; + seq_arr_t *neigh_seq = NULL; if (du->mtc != NULL) { int scs = get_ssb_scs(cell_info); int band = get_dl_band(cell_info); @@ -609,24 +610,30 @@ NR_MeasConfig_t *nr_rrc_get_measconfig(const gNB_RRC_INST *rrc, uint64_t nr_cell If default one added once as a report, no need to add it again && duplication. */ rc_A3_seq = malloc(sizeof(seq_arr_t)); + neigh_seq = malloc(sizeof(seq_arr_t)); seq_arr_init(rc_A3_seq, sizeof(NR_ReportConfigToAddMod_t)); - LOG_D(NR_RRC, "HO LOG: Preparing A3 Event Measurement Configuration!\n"); - bool is_default_a3_added = false; + seq_arr_init(neigh_seq, sizeof(nr_neighbour_cell_t)); + LOG_D(NR_RRC, "Preparing A3 Event Measurement Configuration!\n"); + bool default_a3_added = false; // To ensure that the default configuration is only added once for (int i = 0; i < neighbour_cells->size; i++) { nr_neighbour_cell_t *neighbourCell = (nr_neighbour_cell_t *)seq_arr_at(neighbour_cells, i); - const nr_a3_event_t *a3Event = get_a3_configuration((gNB_RRC_INST *)rrc, neighbourCell->physicalCellId); - if (!a3Event || is_default_a3_added) + if (default_a3_added && neighbourCell->physicalCellId == -1) continue; - if (a3Event->pci == -1) - is_default_a3_added = true; - seq_arr_push_back(rc_A3_seq, prepare_a3_event_report(a3Event), sizeof(NR_ReportConfigToAddMod_t)); + seq_arr_push_back(neigh_seq, neighbourCell, sizeof(nr_neighbour_cell_t)); + const nr_a3_event_t *a3Event = get_a3_configuration((gNB_RRC_INST *)rrc, neighbourCell->physicalCellId); + if (a3Event) { + NR_ReportConfigId_t reportConfigId = neighbourCell->physicalCellId == -1 ? 3 : i + 4; + seq_arr_push_back(rc_A3_seq, prepare_a3_event_report(a3Event, reportConfigId), sizeof(NR_ReportConfigToAddMod_t)); + if (neighbourCell->physicalCellId == -1) + default_a3_added = true; + } } } if (rrc->measurementConfiguration.per_event) rc_PER = prepare_periodic_event_report(rrc->measurementConfiguration.per_event); if (rrc->measurementConfiguration.a2_event) rc_A2 = prepare_a2_event_report(rrc->measurementConfiguration.a2_event); - return get_MeasConfig(mt, band, scs, rc_PER, rc_A2, rc_A3_seq, neighbour_cells); + return get_MeasConfig(mt, band, scs, cell_info->nr_pci, rc_PER, rc_A2, rc_A3_seq, neigh_seq); } return NULL; } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 240a591846..407a0d03b7 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -209,7 +209,8 @@ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRC } int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1; // Convert 1-based PLMN Identity IE to 0-based index req->plmn = rrc->configuration.plmn[selected_plmn_identity]; // Select from the stored list - LOG_I(NGAP, "Selected PLMN in the NG Initial UE Message: MCC %u, MNC %u\n", req->plmn.mcc, req->plmn.mnc); + plmn_id_t *p = &req->plmn; + LOG_I(NGAP, "Selected PLMN in the NG Initial UE Message: MCC=%03d MNC=%0*d\n", p->mcc, p->mnc_digit_length, p->mnc); /* 5G-S-TMSI */ if (UE->Initialue_identity_5g_s_TMSI.presence) { @@ -1261,25 +1262,29 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_ int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) { - for (uint16_t tai_size = 0; tai_size < NGAP_PAGING_IND(msg_p).tai_size; tai_size++) { - LOG_I(NR_RRC,"[gNB %ld] In NGAP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, - NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, NGAP_PAGING_IND(msg_p).tac[tai_size]); + ngap_paging_ind_t *msg = &NGAP_PAGING_IND(msg_p); + for (uint16_t tai_size = 0; tai_size < msg->tai_size; tai_size++) { + plmn_id_t *p = &msg->plmn_identity[tai_size]; + LOG_I(NR_RRC, + "[gNB %ld] TAI List for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n", + instance, + p->mcc, + p->mnc_digit_length, + p->mnc, + msg->tac[tai_size]); gNB_RrcConfigurationReq *req = &RC.nrrrc[instance]->configuration; for (uint8_t j = 0; j < req->num_plmn; j++) { - plmn_id_t *plmn = &req->plmn[j]; - if (plmn->mcc == NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc - && plmn->mnc == NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc && req->tac == NGAP_PAGING_IND(msg_p).tac[tai_size]) { + plmn_id_t *req_plmn = &req->plmn[j]; + if (req_plmn->mcc == p->mcc && req_plmn->mnc == p->mnc && req->tac == msg->tac[tai_size]) { for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { AssertFatal(false, "to be implemented properly\n"); if (NODE_IS_CU(RC.nrrrc[instance]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_PAGING_IND); - F1AP_PAGING_IND(m).plmn.mcc = RC.nrrrc[j]->configuration.plmn[0].mcc; - F1AP_PAGING_IND(m).plmn.mnc = RC.nrrrc[j]->configuration.plmn[0].mnc; - F1AP_PAGING_IND(m).plmn.mnc_digit_length = RC.nrrrc[j]->configuration.plmn[0].mnc_digit_length; + F1AP_PAGING_IND(m).plmn = *req_plmn; F1AP_PAGING_IND (m).nr_cellid = RC.nrrrc[j]->nr_cellid; - F1AP_PAGING_IND (m).ueidentityindexvalue = (uint16_t)(NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi%1024); - F1AP_PAGING_IND (m).fiveg_s_tmsi = NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi; - F1AP_PAGING_IND (m).paging_drx = NGAP_PAGING_IND(msg_p).paging_drx; + F1AP_PAGING_IND(m).ueidentityindexvalue = (uint16_t)(msg->ue_paging_identity.s_tmsi.m_tmsi % 1024); + F1AP_PAGING_IND(m).fiveg_s_tmsi = msg->ue_paging_identity.s_tmsi.m_tmsi; + F1AP_PAGING_IND(m).paging_drx = msg->paging_drx; LOG_E(F1AP, "ueidentityindexvalue %u fiveg_s_tmsi %ld paging_drx %u\n", F1AP_PAGING_IND (m).ueidentityindexvalue, F1AP_PAGING_IND (m).fiveg_s_tmsi, F1AP_PAGING_IND (m).paging_drx); itti_send_msg_to_task(TASK_CU_F1, instance, m); } else { diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index b80902add9..6a92be9b79 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -237,7 +237,6 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str STAILQ_INSERT_TAIL(&amf_desc_p->served_guami, new_guami_p, next); } - ngap_dump_served_guami(amf_desc_p); /* Set the capacity of this AMF */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, @@ -254,7 +253,7 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str memcpy(amf_desc_p->amf_name, ie->value.choice.AMFName.buf, ie->value.choice.AMFName.size); amf_desc_p->amf_name[ie->value.choice.AMFName.size] = '\0'; } - + ngap_dump_served_guami(amf_desc_p); /* mandatory set the plmn supports */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, @@ -1127,7 +1126,14 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N TBCD_TO_MCC_MNC(&(item_p->tAI.pLMNIdentity), msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->plmn_identity[i].mnc_digit_length); OCTET_STRING_TO_INT16(&(item_p->tAI.tAC), msg->tac[i]); msg->tai_size++; - NGAP_DEBUG("[SCTP %u] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->tac[i]); + plmn_id_t *p = &msg->plmn_identity[i]; + LOG_D(NGAP, + "[SCTP %u] PLMN in TAI list for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n", + assoc_id, + p->mcc, + p->mnc_digit_length, + p->mnc, + msg->tac[i]); } //paging parameter values diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index b291f6b96c..b5db821e36 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -74,23 +74,27 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng // Select the AMF corresponding to the GUAMI from the RegisteredAMF IE if (msg->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) { const nr_guami_t *guami = &msg->ue_identity.guami; - NGAP_DEBUG("GUAMI is present: MCC=%03d MNC=%03d RegionID=%d SetID=%d Pointer=%d\n", - guami->mcc, - guami->mnc, - guami->amf_region_id, - guami->amf_set_id, - guami->amf_pointer); + LOG_D(NGAP, + "GUAMI is present: MCC=%03d MNC=%0*d RegionID=%d SetID=%d Pointer=%d\n", + guami->mcc, + guami->mnc_len, + guami->mnc, + guami->amf_region_id, + guami->amf_set_id, + guami->amf_pointer); amf = ngap_gNB_nnsf_select_amf_by_guami(instance_p, msg->establishment_cause, *guami); if (amf) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", - msg->gNB_ue_ngap_id, - amf->amf_name, - amf->assoc_id, - guami->mcc, - guami->mnc, - guami->amf_region_id, - guami->amf_set_id, - guami->amf_pointer); + LOG_I(NGAP, + "UE %d: Selected AMF '%s' (assoc_id %d) through GUAMI MCC=%03d MNC=%0*d AMFRI %d AMFSI %d AMFPT %d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + guami->mcc, + guami->mnc_len, + guami->mnc, + guami->amf_region_id, + guami->amf_set_id, + guami->amf_pointer); return amf; } } @@ -101,13 +105,15 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng const fiveg_s_tmsi_t *fgs_tmsi = &msg->ue_identity.s_tmsi; amf = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, msg->establishment_cause, msg->plmn, fgs_tmsi->amf_set_id); if (amf) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC %d MNC %d\n", - msg->gNB_ue_ngap_id, - amf->amf_name, - amf->assoc_id, - fgs_tmsi->amf_set_id, - msg->plmn.mcc, - msg->plmn.mnc); + LOG_I(NGAP, + "UE %d: Selected AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC=%03d MNC=%0*d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + fgs_tmsi->amf_set_id, + msg->plmn.mcc, + msg->plmn.mnc_digit_length, + msg->plmn.mnc); return amf; } } @@ -117,19 +123,20 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng // Select the AMF based on the selected PLMN identity received through RRCSetupComplete amf = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, msg->establishment_cause, msg->plmn); if (amf) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n", - msg->gNB_ue_ngap_id, - amf->amf_name, - amf->assoc_id, - msg->plmn.mcc, - msg->plmn.mnc_digit_length, - msg->plmn.mnc); + LOG_I(NGAP, + "UE %d: Selected AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + msg->plmn.mcc, + msg->plmn.mnc_digit_length, + msg->plmn.mnc); return amf; } else { // Select the AMF with the highest capacity amf = ngap_gNB_nnsf_select_amf(instance_p, msg->establishment_cause); if (amf) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", + NGAP_INFO("UE %d: Selected AMF '%s' (assoc_id %d) through highest relative capacity\n", msg->gNB_ue_ngap_id, amf->amf_name, amf->assoc_id); 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 58bcdc1d37..2d2a103d43 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 @@ -144,8 +144,8 @@ gNBs = ); - # Dedicated Serving Cell Configuration - servingCellConfigDedicated = ( + # PTRS Configuration + phaseTrackingRS = ( { # DL PTRS related parameters. # 3GPP TS 38.331 PTRS-DownlinkConfig diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml index 605b56be93..725b85a31e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.redcap.yaml @@ -19,6 +19,12 @@ gNBs: # Physical parameters: do_CSIRS: 1 do_SRS: 1 + first_active_bwp: 1; + bwp_list: + - + scs: 1 + bwpStart: 0 + bwpSize: 106 #uess_agg_levels: [0,1,1,1,1] servingCellConfigCommon: #spCellConfigCommon @@ -132,17 +138,6 @@ gNBs: ssPBCH_BlockPower: -25 - servingCellConfigDedicated: - - dl_bwp-Id_1: 1 - dl_bwp1_locationAndBandwidth: 28875 - dl_bwp1_subcarrierSpacing: 1 - firstActiveDownlinkBWP-Id: 1 - defaultDownlinkBWP-Id: 1 - ul_bwp-Id_1: 1 - ul_bwp1_locationAndBandwidth: 28875 - ul_bwp1_subcarrierSpacing: 1 - firstActiveUplinkBWP-Id: 1 - RedCap: cellBarredRedCap1Rx_r17: 1 cellBarredRedCap2Rx_r17: 1