diff --git a/README.md b/README.md index fc5dd23e628bddedbbf74cbe3bedba2d80e5436a..592ff13f66282efd3558a11bf8b3b3ad2b5dbfb1 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,8 @@ <a href="https://releases.ubuntu.com/20.04/"><img src="https://img.shields.io/badge/OS-Ubuntu20-Green" alt="Supported OS Ubuntu 20"></a> <a href="https://releases.ubuntu.com/22.04/"><img src="https://img.shields.io/badge/OS-Ubuntu22-Green" alt="Supported OS Ubuntu 22"></a> <a href="https://releases.ubuntu.com/24.04/"><img src="https://img.shields.io/badge/OS-Ubuntu24-Green" alt="Supported OS Ubuntu 24"></a> - <a href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux"><img src="https://img.shields.io/badge/OS-RHEL8-Green" alt="Supported OS RHEL8"></a> <a href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux"><img src="https://img.shields.io/badge/OS-RHEL9-Green" alt="Supported OS RELH9"></a> - <a href="https://getfedora.org/en/workstation/"><img src="https://img.shields.io/badge/OS-Fedore40-Green" alt="Supported OS Fedora 40"></a> + <a href="https://getfedora.org/en/workstation/"><img src="https://img.shields.io/badge/OS-Fedore41-Green" alt="Supported OS Fedora 41"></a> </p> <p align="center"> diff --git a/charts/physims/charts/nr-pbchsim.scs/Chart.yaml b/charts/physims/charts/nr-pbchsim.scs/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c590bfff3861a49514cd977012ac37114be53ab8 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-pbchsim-scs +description: A Helm subchart for nr-pbchsim network function ("Other SCS" tests) + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-pbchsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl b/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..4734fc898e1a0745caea140d9ef074999a7e208c --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-pbchsim-scs.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-pbchsim-scs.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-pbchsim-scs.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-pbchsim-scs.labels" -}} +helm.sh/chart: {{ include "oai-nr-pbchsim-scs.chart" . }} +{{ include "oai-nr-pbchsim-scs.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-pbchsim-scs.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-pbchsim-scs.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-pbchsim-scs.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-pbchsim-scs.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml b/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a8087a108ae8cfbbdf287cba523442276c04f687 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/templates/job.yaml @@ -0,0 +1,42 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Chart.Name }} +spec: + template: + metadata: + labels: + app: physim + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: OPENAIR_DIR + value: /opt/oai-physim + command: ["/bin/sh", "-c"] + args: + - > + cmake_targets/autotests/run_exec_autotests.bash -g "nr_pbchsim.otherSCS" -d bin/ && + echo "FINISHED" && sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 + {{- if .Values.global.nodeSelector}} + nodeSelector: + {{- toYaml .Values.global.nodeSelector | nindent 12 }} + {{- end }} + {{- if .Values.global.nodeName.nrpbchsim273rb}} + nodeName: {{ .Values.global.nodeName.nrpbchsim273rb }} + {{- end }} diff --git a/charts/physims/charts/nr-pbchsim.scs/values.yaml b/charts/physims/charts/nr-pbchsim.scs/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f7753924f12487791034ffea95788aebafabec3f --- /dev/null +++ b/charts/physims/charts/nr-pbchsim.scs/values.yaml @@ -0,0 +1,48 @@ +# Default values for oai-nr-pbchsim-scs +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-pbchsim-scs" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml index 9a00a561343f88182b3663adf01f029e7147a6c0..a4e0ffecd4b2a738dda6e398c1ac8ec6e35cddb2 100644 --- a/charts/physims/values.yaml +++ b/charts/physims/values.yaml @@ -27,6 +27,7 @@ global: nrpbschsim106rb: dedale nrpbchsim217rb: dedale nrpbchsim273rb: dedale + nrpbchsimscs: dedale nrpsbchsim: dedale nrprachsim: dedale nrpucchsim: dedale diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 5a3408250a5a9c9ab25e84a8f0fe12a6ea6a1dd2..029a970acd800e42dc821fdbb9ec452d3e5b4868 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -52,7 +52,7 @@ import cls_oaicitest # Helper functions used here and in other classes # (e.g., cls_cluster.py) #----------------------------------------------------------- -IMAGES = ['oai-enb', 'oai-lte-ru', 'oai-lte-ue', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue', 'oai-gnb-asan', 'oai-nr-ue-asan', 'oai-nr-cuup-asan', 'oai-gnb-aerial', 'oai-gnb-fhi72'] +IMAGES = ['oai-enb', 'oai-lte-ru', 'oai-lte-ue', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s', 'oai-nr-ue', 'oai-enb-asan', 'oai-gnb-asan', 'oai-lte-ue-asan', 'oai-nr-ue-asan', 'oai-nr-cuup-asan', 'oai-gnb-aerial', 'oai-gnb-fhi72'] def CreateWorkspace(host, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge): if ranCommitID == '': @@ -208,7 +208,9 @@ def WriteEnvFile(ssh, services, wd, tag): ret = ssh.run(f'docker image inspect {checkimg}', reportNonZero=False) if ret.returncode == 0: logging.info(f"detected pulled image {checkimg}") - if "oai-gnb" in image: envs["GNB_IMG"] = "oai-gnb-asan" + if "oai-enb" in image: envs["ENB_IMG"] = "oai-enb-asan" + elif "oai-gnb" in image: envs["GNB_IMG"] = "oai-gnb-asan" + elif "oai-lte-ue" in image: envs["LTEUE_IMG"] = "oai-lte-ue-asan" elif "oai-nr-ue" in image: envs["NRUE_IMG"] = "oai-nr-ue-asan" elif "oai-nr-cuup" in image: envs["NRCUUP_IMG"] = "oai-nr-cuup-asan" else: logging.warning("undetected image format {image}, cannot use asan") @@ -415,7 +417,9 @@ class Containerize(): imageNames.append(('oai-gnb-aerial', 'gNB.aerial', 'oai-gnb-aerial', '')) # Building again the 5G images with Address Sanitizer imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "BUILD_OPTION=--sanitize"')) + imageNames.append(('oai-enb', 'eNB', 'oai-enb-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-gnb', 'gNB', 'oai-gnb-asan', '--build-arg "BUILD_OPTION=--sanitize"')) + imageNames.append(('oai-lte-ue', 'lteUE', 'oai-lte-ue-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-asan', '--build-arg "BUILD_OPTION=--sanitize"')) imageNames.append(('ran-build-fhi72', 'build.fhi72', 'ran-build-fhi72', '')) @@ -783,7 +787,7 @@ class Containerize(): HTML.CreateHtmlTestRowQueue("Build unit tests", 'OK', [dockerfile]) # it worked, build and execute tests, and close connection - ret = cmd.run(f'docker run -a STDOUT --rm ran-unittests:{baseTag} ctest --output-on-failure --no-label-summary -j$(nproc)') + ret = cmd.run(f'docker run -a STDOUT --workdir /oai-ran/build/ --env LD_LIBRARY_PATH=/oai-ran/build/ --rm ran-unittests:{baseTag} ctest --output-on-failure --no-label-summary -j$(nproc)') cmd.run(f'docker rmi ran-unittests:{baseTag}') build_log_name = f'build_log_{self.testCase_id}' CopyLogsToExecutor(cmd, lSourcePath, build_log_name) @@ -846,6 +850,11 @@ class Containerize(): mySSH.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False + # Creating a develop tag on the local private registry + if not self.ranAllowMerge: + mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{image}:develop', '\$', 5) + mySSH.command(f'docker push {imagePrefix}/{image}:develop', '\$', 120) + mySSH.command(f'docker rmi {imagePrefix}/{image}:develop', '\$', 120) mySSH.command(f'docker rmi {imagePrefix}/{imageTag} {image}:{orgTag}', '\$', 30) mySSH.command(f'docker logout {imagePrefix}', '\$', 5) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0fa88aff32eea09b837ffe692d280a1013d9dc80..5e803b27e7800f19eb4049740894ce3bc55d5a1d 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -163,7 +163,7 @@ class PhySim: mySSH.command('oc get pods -o wide -l app=physim | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 30, resync=True) running_count = mySSH.getBefore().count('Running') completed_count = mySSH.getBefore().count('Completed') - if (running_count + completed_count) == 22: + if (running_count + completed_count) == 23: logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m') isRunning = True podNames = re.findall('oai-[\S\d\w]+', mySSH.getBefore()) diff --git a/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf b/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf index 2eb186b5428177143065823dd00e25b56c7b4064..e266e5df6587dfb59c3d01ffd6dc368ae6a11007 100644 --- a/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf +++ b/ci-scripts/conf_files/enb-rcc.band7.25prb.tm1.if4p5.conf @@ -228,7 +228,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 0 - att_rx = 0; + att_rx = 6; eNB_instances = [0]; } ); diff --git a/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf b/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf index 8b2a689705666dd3fed53156f99a36a2cc499dce..f5af22ed0f6ec897b4bcce6b3bab3fd33e504e23 100644 --- a/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf +++ b/ci-scripts/conf_files/enb.band40.100prb.usrpb200.tm1-defaultscheduler.conf @@ -191,7 +191,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 6 - att_rx = 6; + att_rx = 12; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 125; diff --git a/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf b/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf index 4a8218e1b42eb5c0939384ea747a184d8e7000e3..53494afb887ae9c87893e8a94faa5ea8da35ce4d 100644 --- a/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf +++ b/ci-scripts/conf_files/enb.band40.25prb.usrpb200.conf @@ -191,7 +191,7 @@ RUs = ( nb_tx = 1 nb_rx = 1 att_tx = 6 - att_rx = 6; + att_rx = 12; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 125; diff --git a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf index bb733492029635c820100c1c690f2ffb419db9fd..aa110bbf95d5231c1c0bea8beb9795fb9bae2b7b 100644 --- a/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.100prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf b/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf index b45b381a8901a29c26587efc5d02c5d50f6cb217..6bf45bf690fff277463f93a1781afa7079102285 100644 --- a/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf +++ b/ci-scripts/conf_files/enb.band7.100prb.usrpb200.tm1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf index 63b96e024943a2ea882e169f57958e8eea7653d7..cc7c74cd35796f0607d67ed442d0e49f53f8c5ba 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf index 63b96e024943a2ea882e169f57958e8eea7653d7..cc7c74cd35796f0607d67ed442d0e49f53f8c5ba 100644 --- a/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf +++ b/ci-scripts/conf_files/enb.band7.25prb.rfsim.nos1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf index 991b1880922e7098e309886b45020b8e234d5642..f55adad153a20f80c497e732edea0082dbc13940 100644 --- a/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf +++ b/ci-scripts/conf_files/enb.band7.50prb.rfsim.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf b/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf index 10430a3785df46c1f3c614db82e11fa295215266..fb1913498bc5b05ea1f2f9efcc3b487d94ac30aa 100644 --- a/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf +++ b/ci-scripts/conf_files/enb.band7.50prb.usrpb200.tm1.conf @@ -224,7 +224,7 @@ RUs = nb_tx = 1 nb_rx = 1 att_tx = 3 - att_rx = 0; + att_rx = 6; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/nrue.uicc.yaml b/ci-scripts/conf_files/nrue.uicc.yaml index 518315c7ffbc65354eab7e44f56d023095217584..f2af872ba7f9ca47ae4336d5c996180d9296e7c7 100644 --- a/ci-scripts/conf_files/nrue.uicc.yaml +++ b/ci-scripts/conf_files/nrue.uicc.yaml @@ -9,7 +9,7 @@ uicc0: #/* To be included in main config file when */ #/* channel modelisation is used (rfsimulator with chanmod options enabled) */ channelmod: - max_chan: 10; + max_chan: 10 modellist: modellist_rfsimu_1 modellist_rfsimu_1: - model_name: rfsimu_channel_enB0 diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml index 3b0b58d8ba8d9379b331c6c80f3634e2640d012e..9e8bb1e7047bcf33a77986404958623d8cf86963 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml @@ -53,7 +53,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="000011"> diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml index abe07fa1cef21e2a791bd5b384ef544b10dda72b..0081f8eab9854d46b94a52e45a0d4c47d39e3953 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml @@ -44,7 +44,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="800813"> <class>Create_Workspace</class> diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml index 68879cc622ed9f5f576ab6261847d2a4c49616a9..310f886497a5469268fa188c78c220aa4f60c278 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml @@ -48,7 +48,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="800813"> <class>Create_Workspace</class> diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml index 5a58cad5f20a6c7da53a35344a3b94962d240575..357db604a6d8be3876d7682d9efe1b60850dd0b9 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml @@ -48,7 +48,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="800813"> <class>Create_Workspace</class> diff --git a/ci-scripts/xml_files/container_4g_rfsim_fembms.xml b/ci-scripts/xml_files/container_4g_rfsim_fembms.xml index e63c4fac5e85b6c0ea11a69a045ac0a98c2d15fe..e1484004e2cb5cf507e4014f360bc9e045903772 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fembms.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fembms.xml @@ -41,7 +41,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="800813"> <class>Create_Workspace</class> diff --git a/ci-scripts/xml_files/container_4g_rfsim_mbms.xml b/ci-scripts/xml_files/container_4g_rfsim_mbms.xml index c26cb06878d43ff4f55c2207fde8315e48d01d05..cf154b44767f5d2d6c42d4c223800f7bdd367c80 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_mbms.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_mbms.xml @@ -41,7 +41,7 @@ <class>Pull_Local_Registry</class> <desc>Pull Images from Local Registry</desc> <test_svr_id>0</test_svr_id> - <images_to_pull>oai-enb oai-lte-ue</images_to_pull> + <images_to_pull>oai-enb-asan oai-lte-ue-asan</images_to_pull> </testCase> <testCase id="800813"> <class>Create_Workspace</class> diff --git a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml index c02b009eea14116c81cf49e7b8f09462638cc4fa..9f40fb856ddb1e549885e34c430ccc3454e2cb22 100644 --- a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-enb network_mode: "host" @@ -210,7 +210,7 @@ services: retries: 5 oai_ue1: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-lte-ue1 network_mode: "host" @@ -229,7 +229,7 @@ services: retries: 5 oai_ue2: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: l2sim4g-oai-lte-ue2 network_mode: "host" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index 97c4ee82ab6a1e7e131afea2ae6192179002d1eb..4b110abf740886c0ffebeb0893e94e6f32c6c085 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml index 2bc0e97a358847089875ce0391afd09f3ce66f69..9de0f448c3e7a0688e52c181c31f85692462e0ce 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/enb.band7.25prb.rfsim.nos1.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -28,6 +29,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index c77dfdfd27aa3a95024f4acd63a10612a6326f2f..1cb0150465d408294e8ad8bc967b4ff7f7e45590 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.50prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 50 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index 25e3d797bba91fbb6de9dd0de91008d1e6b71437..a0e43a27d21bacb9c8730bd5cc69f7f203f8e4bf 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.100prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 100 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml index da5399d5e6fe7452e6e199f6c050374a2f8a587e..5c7f2670741f440229503f747e8dc7984d185c5c 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fembms/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --eNBs.[0].component_carriers.[0].mbms_dedicated_serving_cell ENABLE --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -26,6 +27,7 @@ services: ipv4_address: 192.168.61.30 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml index d3a2f02ab291ef68ec713fb6ba1f3e128e7578b7..af913ead245d345b278a660de5442e2f95e50c07 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_mbms/docker-compose.yml @@ -1,6 +1,6 @@ services: oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -8,6 +8,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf @@ -18,7 +19,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -31,6 +32,7 @@ services: environment: TZ: Europe/Paris HOSTNAME: oai_ue0 + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsim --noS1 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time --noS1 volumes: - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index a3ce6f4de60727bc6593c429fa4f2581fae85147..7ebbed861f4e8db3b2007c2e8ac92ad660d4e9f7 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -178,7 +178,7 @@ services: retries: 5 oai_enb0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-enb networks: @@ -186,6 +186,7 @@ services: ipv4_address: 192.168.61.20 environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/enb.band38.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf @@ -196,7 +197,7 @@ services: retries: 5 oai_ue0: - image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} + image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop} privileged: true container_name: rfsim4g-oai-lte-ue0 networks: @@ -206,6 +207,7 @@ services: - "10000" environment: TZ: Europe/Paris + ASAN_OPTIONS: detect_leaks=0 USE_ADDITIONAL_OPTIONS: --rfsim -T -C 2605000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --rfsimulator.serveraddr 192.168.61.20 --log_config.global_log_options level,nocolor,time volumes: - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 90ec5c7f245a554ffdb3a6a90faf76a62b6f4f9a..2c6dc73bfa629ce700e4f78fb61e094a2063577c 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -149,6 +149,18 @@ <nruns>3</nruns> </testCase> + <testCase id="nr_pbchsim.otherSCS"> + <desc>nr_pbchsim Test cases. (Test1: PBCH-only, 15Khz, 5Mhz), + (Test2: PBCH-only, 120Khz, 50Mhz)</desc> + <main_exec>nr_pbchsim</main_exec> + <main_exec_args>-s-10 -S-8 -n10 -m0 -R25 + -s-10 -S-8 -n10 -m3 -R32</main_exec_args> + <tags>test1 test2</tags> + <search_expr_true>PBCH test OK</search_expr_true> + <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> + <nruns>3</nruns> + </testCase> + <testCase id="nr_dlsim.basic"> <desc>nr_dlsim Test cases. (Test1: 106 PRB), (Test2: 217 PRB), diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 5568c159d11e422e4be6fe967fafbcddeab05152..e2aa1384d61e317a722ad18a8363a5b05cb1e311 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -99,31 +99,18 @@ Options: Selects the transport protocol type, options: None, Ethernet, benetel4g, benetel5g, oran_fhlib_5g -P | --phy_simulators Makes the unitary tests Layer 1 simulators --S | --core_simulators - Makes the core security features unitary simulators -s | --check runs a set of auto-tests based on simulators and several compilation tests --run-group runs only specified test cases specified here. This flag is only valid with -s -V | --vcd Adds a debgging facility to the binary files: GUI with major internal synchronization events --x | --xforms - Will compile with software oscilloscope features --verbose-compile Shows detailed compilation instructions in makefile --build-doxygen Builds doxygen based documentation. ---build-coverity-scan - Builds Coverity-Scan objects for upload ---disable-deadline - Disables deadline scheduler of Linux kernel (>=3.14.x). --trace-asn1c-enc-dec Output asn1c logging traces via OAI logging system. ---enable-deadline - Enable deadline scheduler of Linux kernel (>=3.14.x). ---disable-cpu-affinity - Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads ---enable-cpu-affinity --enable-LTTNG Enable LTTNG log. While lttng is enabled, T-Tracer will be disabled --disable-T-Tracer @@ -146,8 +133,6 @@ Options: Disable AVX512 intrinsics whatever processor capability is --noavx2 Disable AVX2 intrinsics whatever processor capability is --k | --skip-shared-libraries - Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes --ninja Tell cmake to use the Ninja build system. Without, will generate make files --sanitize @@ -339,9 +324,6 @@ function main() { echo_info "Setting gtk-wave output" CMAKE_CMD="$CMAKE_CMD -DENABLE_VCD_FIFO=True" shift;; - -x | --xforms) - echo_info "Will generate the software oscilloscope features" - shift;; --verbose-compile) VERBOSE_COMPILE=1 echo_info "Will compile with verbose instructions" diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 9c11fced56d196b229ef1e62818f5d2d191fb85d..2fd7a0a6b1fdfcfc4284849fe9a3b346823ac38a 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -107,6 +107,7 @@ check_supported_distribution() { "ubuntu22.04") return 0 ;; "ubuntu20.04") return 0 ;; "debian11") return 0 ;; + "fedora41") return 0 ;; "fedora40") return 0 ;; "rhel8.2") return 0 ;; "rhel8.3") return 0 ;; @@ -612,13 +613,11 @@ check_install_oai_software() { git \ pkgconfig \ libconfig-devel \ - libffi-devel \ lksctp-tools \ lksctp-tools-devel \ libtool \ ninja-build \ make \ - openssl \ openssl-devel \ patch \ readline-devel \ diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 71cab2a33a648ce465f37391b47add00a4dc6552..9bb1b85f7d8f571e010ddee24c433da00548de44 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -302,7 +302,7 @@ configmodule_interface_t *load_configmodule(int argc, } static configmodule_interface_t *cfgptr; if (cfgptr) - printf("ERROR: Call load_configmodule more than one time\n"); + 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); @@ -369,8 +369,7 @@ configmodule_interface_t *load_configmodule(int argc, if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) { i=load_config_sharedlib(cfgptr); - if (i == 0) { - printf("[CONFIG] config module %s loaded\n",cfgmode); + if (i == 0) { int idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_DEBUGFLAGS); Config_Params[idx].uptr = &(cfgptr->rtflags); idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_TMPDIR); @@ -387,7 +386,7 @@ configmodule_interface_t *load_configmodule(int argc, cfgptr->end = (configmodule_endfunc_t)nooptfunc; } - printf("[CONFIG] debug flags: 0x%08x\n", cfgptr->rtflags); + printf_params(cfgptr, "[CONFIG] debug flags: 0x%08x\n", cfgptr->rtflags); if (modeparams != NULL) free(modeparams); @@ -413,7 +412,7 @@ void write_parsedcfg(configmodule_interface_t *cfgptr) cfgptr->status->num_write); } if (cfgptr->write_parsedcfg != NULL) { - printf("[CONFIG] calling config module write_parsedcfg function...\n"); + printf_params(cfgptr, "[CONFIG] calling config module write_parsedcfg function...\n"); cfgptr->write_parsedcfg(cfgptr); } } @@ -425,12 +424,11 @@ void end_configmodule(configmodule_interface_t *cfgptr) if (cfgptr != NULL) { write_parsedcfg(cfgptr); if (cfgptr->end != NULL) { - printf ("[CONFIG] calling config module end function...\n"); + printf_params(cfgptr, "[CONFIG] calling config module end function...\n"); cfgptr->end(cfgptr); } pthread_mutex_lock(&cfgptr->memBlocks_mutex); - printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs); for(int i=0; i<cfgptr->numptrs ; i++) { if (cfgptr->oneBlock[i].ptrs != NULL && cfgptr->oneBlock[i].ptrsAllocated== true && cfgptr->oneBlock[i].toFree) { diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index a41a4dab336d56648cce638e9c0f9a65b40c962a..0934024391d786df27b79d9f90fb2479812f9873 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -461,13 +461,11 @@ int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, } /* switch on param type */ if( notfound == 1) { - printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile ); + fprintf(stderr, "[LIBCONFIG] %s not found in %s ", cfgpath, libconfig_privdata.configfile); if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) { fatalerror=1; - printf(" mandatory parameter missing\n"); - } else { - printf("\n"); + fprintf(stderr, " mandatory parameter missing\n"); } } else { if (defval == 1) { @@ -570,8 +568,8 @@ int config_libconfig_init(configmodule_interface_t *cfg) } const char *incp = config_get_include_dir (&(libconfig_privdata.cfg)) ; - - printf("[LIBCONFIG] Path for include directive set to: %s\n", (incp!=NULL)?incp:"libconfig defaults"); + + printf_params(cfg, "[LIBCONFIG] Path for include directive set to: %s\n", (incp != NULL) ? incp : "libconfig defaults"); /* set convertion option to allow integer to float conversion*/ config_set_auto_convert (&(libconfig_privdata.cfg), CONFIG_TRUE); /* Read the file. If there is an error, report it and exit. */ @@ -582,7 +580,7 @@ int config_libconfig_init(configmodule_interface_t *cfg) config_error_line(&(libconfig_privdata.cfg)), config_error_text(&(libconfig_privdata.cfg))); config_destroy(&(libconfig_privdata.cfg)); - printf( "\n"); + fprintf(stderr, "\n"); free(tmppath); return -1; } @@ -623,11 +621,11 @@ void config_libconfig_write_parsedcfg(configmodule_interface_t *cfg) config_error_line(&(libconfig_privdata.runtcfg)), config_error_text(&(libconfig_privdata.runtcfg))); } else { - printf("[LIBCONFIG] file %s created successfully\n", cfg->status->debug_cfgname); + printf_params(cfg, "[LIBCONFIG] file %s created successfully\n", cfg->status->debug_cfgname); } free(fname); } else { - printf("[LIBCONFIG] Cannot create config file after parsing: CONFIG_SAVERUNCFG flag not specified\n"); + printf_params(cfg, "[LIBCONFIG] Cannot create config file after parsing: CONFIG_SAVERUNCFG flag not specified\n"); } } diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 17ffe91c1dd80205b2d22a7b83f87dd9627d13d3..62230d9ba35b7ee13969bfb6efbef46bebc1e9d1 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -517,7 +517,6 @@ int logInit (void) "Invalid log options: time and wall_clock both set but are mutually exclusive\n"); g_log->flag = g_log->flag | FLAG_INITIALIZED; - printf("log init done\n"); return 0; } @@ -946,7 +945,6 @@ int logInit_log_mem (char * filename) return -1; } pthread_create(&log_mem_thread, NULL, (void *(*)(void *))flush_mem_to_file, (void *)NULL); - printf("log init done\n"); return 0; } diff --git a/common/utils/load_module_shlib.c b/common/utils/load_module_shlib.c index 4fa1b9f357562995b37c273e3eb5eb59425e1fc4..04d3080b5b13bf4a1ad5e536c2ae2aa952e27819 100644 --- a/common/utils/load_module_shlib.c +++ b/common/utils/load_module_shlib.c @@ -49,7 +49,7 @@ void loader_init(void) { loader_data.mainexec_buildversion = OAI_PACKAGE_VERSION; int ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), LOADER_CONFIG_PREFIX); if (ret <0) { - printf("[LOADER] configuration couldn't be performed via config module, parameters set to default values\n"); + fprintf(stderr, "[LOADER] configuration couldn't be performed via config module, parameters set to default values\n"); if (loader_data.shlibpath == NULL) { loader_data.shlibpath=DEFAULT_PATH; } @@ -136,12 +136,9 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t * } shlib_path = loader_format_shlibpath(modname, version); - printf("shlib_path %s\n", shlib_path); for (int i = 0; i < loader_data.numshlibs; i++) { if (strcmp(loader_data.shlibs[i].name, modname) == 0) { - printf("[LOADER] library %s has been loaded previously, reloading function pointers\n", - shlib_path); lib_idx = i; break; } @@ -165,7 +162,6 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t * goto load_module_shlib_exit; } - printf("[LOADER] library %s successfully loaded\n", shlib_path); afname = malloc(strlen(modname)+15); if (!afname) { fprintf(stderr, "[LOADER] unable to allocate memory for library %s\n", shlib_path); diff --git a/doc/system_requirements.md b/doc/system_requirements.md index f231f9c39858777906973c24af264087dc17b511..c9f73bc63d0176dcb2230dec4cd66ad2135295d6 100644 --- a/doc/system_requirements.md +++ b/doc/system_requirements.md @@ -35,7 +35,7 @@ This document describes the minimal and performant system requirements for OpenA |-----------------| |Ubuntu 20/22/24 | |RHEL 9 | -|Fedora 40 | +|Fedora 41 | |Debian 11 | |Rocky 9 | diff --git a/executables/lte-enb.c b/executables/lte-enb.c index 29238aa8828b87a7c300b286bced273f747f6a2d..24d24da9ea75705c88179e93b4f1ccb3c8f1ee9c 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -1095,7 +1095,7 @@ void init_transport(PHY_VARS_eNB *eNB) { exit(-1); } else { eNB->dlsch[i][j]->rnti=0; - LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); + LOG_D(PHY, "dlsch[%d][%d] => %p rnti:%x\n", i, j, eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); } } } diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c index 69abbb4464d4c6800e2f1b472186071dfcbf03e1..9d42adeb733e641b36fd44a61cd2db003f0bfd38 100644 --- a/executables/lte-softmodem.c +++ b/executables/lte-softmodem.c @@ -363,7 +363,6 @@ void wait_RUs(void) { } pthread_mutex_unlock(&RC.ru_mutex); - LOG_I(PHY,"RUs configured\n"); } void wait_eNBs(void) { diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 6b77e75c839efe3d181f3c566a4a0b6de46e49b9..8e05aae489ef7b0f36c5d854b3e9da1461b11988 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -1699,12 +1699,13 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) samplesVoid[i]=(void *)&v; - AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+2*UE->frame_parms.samples_per_tti, - samplesVoid, - 1, - UE->frame_parms.nb_antennas_tx, - 1),""); + int written = UE->rfdevice.trx_write_func(&UE->rfdevice, + timestamp + 2 * UE->frame_parms.samples_per_tti, + samplesVoid, + 1, + UE->frame_parms.nb_antennas_tx, + TX_BURST_START_AND_END); + AssertFatal(1 == written, "write to SDR failed\n"); } void *UE_thread(void *arg) { diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index c1229a07e3bf7179ed652666ae0985e926ab09b2..0954a13287971fa3c885e843819c3de03002ebd6 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -400,12 +400,12 @@ void term_gNB_Tpool(int inst) { void init_eNB_afterRU(void) { int inst,ru_id,i,aa; PHY_VARS_gNB *gNB; - LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); + LOG_D(PHY, "%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); if(NFAPI_MODE == NFAPI_MODE_PNF) RC.nb_nr_inst = 1; for (inst=0; inst<RC.nb_nr_inst; inst++) { - LOG_I(PHY,"RC.nb_nr_CC[inst:%d]:%p\n", inst, RC.gNB[inst]); + LOG_D(PHY, "RC.nb_nr_CC[inst:%d]:%p\n", inst, RC.gNB[inst]); gNB = RC.gNB[inst]; gNB->ldpc_offload_flag = get_softmodem_params()->ldpc_offload_flag; @@ -415,8 +415,7 @@ void init_eNB_afterRU(void) { // map antennas and PRACH signals to gNB RX if (0) AssertFatal(gNB->num_RU>0,"Number of RU attached to gNB %d is zero\n",gNB->Mod_id); - LOG_I(PHY,"Mapping RX ports from %d RUs to gNB %d\n",gNB->num_RU,gNB->Mod_id); - LOG_I(PHY,"gNB->num_RU:%d\n", gNB->num_RU); + LOG_D(PHY, "Mapping RX ports from %d RUs to gNB %d\n", gNB->num_RU, gNB->Mod_id); for (ru_id=0,aa=0; ru_id<gNB->num_RU; ru_id++) { AssertFatal(gNB->RU_list[ru_id]->common.rxdataF != NULL, "RU %d : common.rxdataF is NULL\n", gNB->RU_list[ru_id]->idx); @@ -447,30 +446,25 @@ void init_gNB(int wait_for_sync) { if (RC.gNB == NULL) { RC.gNB = (PHY_VARS_gNB **) calloc(1+RC.nb_nr_L1_inst, sizeof(PHY_VARS_gNB *)); - LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB); + LOG_D(PHY, "gNB L1 structure RC.gNB allocated @ %p\n", RC.gNB); } for (inst=0; inst<RC.nb_nr_L1_inst; inst++) { if (RC.gNB[inst] == NULL) { RC.gNB[inst] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB)); - LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",inst,RC.gNB[inst]); + LOG_D(PHY, "[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n", inst, RC.gNB[inst]); } gNB = RC.gNB[inst]; /*nr_polar_init(&gNB->nrPolar_params, NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);*/ - LOG_I(PHY,"Initializing gNB %d\n",inst); - LOG_I(PHY,"Initializing gNB %d\n",inst); - LOG_I(PHY,"Registering with MAC interface module (before %p)\n",gNB->if_inst); - AssertFatal((gNB->if_inst = NR_IF_Module_init(inst))!=NULL,"Cannot register interface"); - LOG_I(PHY,"Registering with MAC interface module (after %p)\n",gNB->if_inst); + AssertFatal((gNB->if_inst = NR_IF_Module_init(inst)) != NULL, "Cannot register interface"); gNB->if_inst->NR_Schedule_response = nr_schedule_response; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); - LOG_I(PHY,"Setting indication lists\n"); + memset(&gNB->UL_INFO, 0, sizeof(gNB->UL_INFO)); gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list; gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list; @@ -482,11 +476,7 @@ void init_gNB(int wait_for_sync) { gNB->prach_energy_counter = 0; gNB->chest_time = get_softmodem_params()->chest_time; gNB->chest_freq = get_softmodem_params()->chest_freq; - } - - - LOG_I(PHY,"[nr-gnb.c] gNB structure allocated\n"); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 0a7e28431f56f64a07312b95d3585081ccc21ff3..e3f13cd014f07b670b814aa9aabdb4dc700b4b81 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -88,7 +88,7 @@ int attach_rru(RU_t *ru) { memset((void *)&rru_config_msg,0,sizeof(rru_config_msg)); rru_config_msg.type = RAU_tick; rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE; - LOG_I(PHY,"Sending RAU tick to RRU %d\n",ru->idx); + LOG_D(PHY, "Sending RAU tick to RRU %d\n", ru->idx); AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1), "RU %d cannot access remote radio\n",ru->idx); msg_len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_capabilities_t); @@ -97,7 +97,7 @@ int attach_rru(RU_t *ru) { if ((len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice, &rru_config_msg, msg_len))<0) { - LOG_I(PHY,"Waiting for RRU %d\n",ru->idx); + LOG_D(PHY, "Waiting for RRU %d\n", ru->idx); } else if (rru_config_msg.type == RRU_capabilities) { AssertFatal(rru_config_msg.len==msg_len,"Received capabilities with incorrect length (%d!=%d)\n",(int)rru_config_msg.len,(int)msg_len); LOG_I(PHY,"Received capabilities from RRU %d (len %d/%d, num_bands %d,max_pdschReferenceSignalPower %d, max_rxgain %d, nb_tx %d, nb_rx %d)\n",ru->idx, @@ -467,8 +467,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *slot) { RU_proc_t *proc = &ru->proc; int tti_tx,frame_tx; openair0_timestamp timestamp_tx = 0; - AssertFatal(1==0,"Shouldn't get here\n"); - // printf("Received subframe %d (TS %llu) from RCC\n",tti_tx,timestamp_tx); + AssertFatal(1 == 0, "Shouldn't get here\n"); frame_tx = (timestamp_tx / (fp->samples_per_subframe*10))&1023; uint32_t idx_sf = timestamp_tx / fp->samples_per_subframe; tti_tx = (idx_sf * fp->slots_per_subframe + (int)round((float)(timestamp_tx % fp->samples_per_subframe) / fp->samples_per_slot0))%(fp->slots_per_frame); @@ -693,7 +692,6 @@ static void rx_rf(RU_t *ru, int *frame, int *slot) *slot = proc->tti_rx; } - //printf("timestamp_rx %lu, frame %d(%d), subframe %d(%d)\n",ru->timestamp_rx,proc->frame_rx,frame,proc->tti_rx,subframe); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, (proc->timestamp_rx+ru->ts_offset)&0xffffffff ); if (rxs != samples_per_slot) { @@ -954,9 +952,7 @@ int setup_RU_buffers(RU_t *ru) { if (ru) { fp = ru->nr_frame_parms; - printf("setup_RU_buffers: frame_parms = %p\n",fp); } else { - printf("ru pointer is NULL\n"); return(-1); } @@ -973,13 +969,11 @@ int setup_RU_buffers(RU_t *ru) { for (i=0; i<ru->nb_rx; i++) { card = i/4; ant = i%4; - printf("Mapping RU id %u, rx_ant %d, on card %d, chain %d\n",ru->idx,i,ru->rf_map.card+card, ru->rf_map.chain+ant); + LOG_D(PHY, "Mapping RU id %u, rx_ant %d, on card %d, chain %d\n", ru->idx, i, ru->rf_map.card + card, ru->rf_map.chain + ant); free(ru->common.rxdata[i]); - ru->common.rxdata[i] = ru->openair0_cfg.rxbase[ru->rf_map.chain+ant]; - printf("rxdata[%d] @ %p\n",i,ru->common.rxdata[i]); + ru->common.rxdata[i] = ru->openair0_cfg.rxbase[ru->rf_map.chain + ant]; - for (j=0; j<16; j++) { - printf("rxbuffer %d: %x\n",j,ru->common.rxdata[i][j]); + for (j = 0; j < 16; j++) { ru->common.rxdata[i][j] = 16-j; } } @@ -987,13 +981,11 @@ int setup_RU_buffers(RU_t *ru) { for (i=0; i<ru->nb_tx; i++) { card = i/4; ant = i%4; - printf("Mapping RU id %u, tx_ant %d, on card %d, chain %d\n",ru->idx,i,ru->rf_map.card+card, ru->rf_map.chain+ant); + LOG_D(PHY, "Mapping RU id %u, tx_ant %d, on card %d, chain %d\n", ru->idx, i, ru->rf_map.card + card, ru->rf_map.chain + ant); free(ru->common.txdata[i]); - ru->common.txdata[i] = ru->openair0_cfg.txbase[ru->rf_map.chain+ant]; - printf("txdata[%d] @ %p\n",i,ru->common.txdata[i]); + ru->common.txdata[i] = ru->openair0_cfg.txbase[ru->rf_map.chain + ant]; - for (j=0; j<16; j++) { - printf("txbuffer %d: %x\n",j,ru->common.txdata[i][j]); + for (j = 0; j < 16; j++) { ru->common.txdata[i][j] = 16-j; } } @@ -1186,7 +1178,7 @@ void *ru_thread(void *param) } if (setup_RU_buffers(ru)!=0) { - printf("Exiting, cannot initialize RU Buffers\n"); + LOG_E(PHY, "Exiting, cannot initialize RU Buffers\n"); exit(-1); } @@ -1382,8 +1374,6 @@ void *ru_thread(void *param) pushNotifiedFIFO(&gNB->L1_tx_out, resTx); } - printf( "Exiting ru_thread \n"); - ru_thread_status = 0; return &ru_thread_status; } @@ -1662,18 +1652,15 @@ void set_function_spec_param(RU_t *ru) ru->start_rf = start_rf; // need to start the local RF interface ru->stop_rf = stop_rf; ru->start_write_thread = start_write_thread; // starting RF TX in different thread - printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf); } /* - printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf); fill_rf_config(ru,rf_config_file); init_frame_parms(&ru->frame_parms,1); nr_phy_init_RU(ru); ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); if (setup_RU_buffers(ru)!=0) { - printf("Exiting, cannot initialize RU Buffers\n"); exit(-1); } */ @@ -1736,7 +1723,6 @@ void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file) pthread_mutex_init(&RC.ru_mutex,NULL); pthread_cond_init(&RC.ru_cond,NULL); // read in configuration file) - printf("configuring RU from file\n"); NRRCconfig_RU(cfg); LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs()); LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU); @@ -1770,7 +1756,7 @@ void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file) AssertFatal(gNB0, "gNB0 is null!\n"); if (gNB0 && gNB_RC) { - LOG_I(PHY,"Copying frame parms from gNB in RC to gNB %d in ru %d and frame_parms in ru\n", gNB0->Mod_id, ru->idx); + LOG_D(PHY, "Copying frame parms from gNB in RC to gNB %d in ru %d and frame_parms in ru\n", gNB0->Mod_id, ru->idx); memcpy((void *)fp, &gNB_RC->frame_parms, sizeof(NR_DL_FRAME_PARMS)); memcpy((void *)&gNB0->frame_parms, (void *)&gNB_RC->frame_parms, sizeof(NR_DL_FRAME_PARMS)); // attach all RU to all gNBs in its list/ @@ -1786,14 +1772,14 @@ void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file) init_RU_proc(ru); if (ru->if_south != REMOTE_IF4p5) { int threadCnt = ru->num_tpcores; - if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt); - else LOG_I(PHY,"RU Thread pool size %d\n",threadCnt); + if (threadCnt < 2) + LOG_E(PHY, "Number of threads for gNB should be more than 1. Allocated only %d\n", threadCnt); char pool[80]; int s_offset = sprintf(pool,"%d",ru->tpcores[0]); for (int icpu=1; icpu<threadCnt; icpu++) { s_offset+=sprintf(pool+s_offset,",%d",ru->tpcores[icpu]); } - LOG_I(PHY,"RU thread-pool core string %s\n",pool); + LOG_I(PHY, "RU thread-pool core string %s (size %d)\n", pool, threadCnt); ru->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); initTpool(pool, ru->threadPool, cpumeas(CPUMEAS_GETSTATE)); // FEP RX result FIFO @@ -1834,14 +1820,12 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) if (RUParamList.numelt > 0) { RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *)); RC.ru_mask = (1 << NB_RU) - 1; - printf("Set RU mask to %lx\n",RC.ru_mask); for (int j = 0; j < RC.nb_RU; j++) { RC.ru[j] = calloc(1, sizeof(*RC.ru[j])); RC.ru[j]->idx = j; RC.ru[j]->nr_frame_parms = calloc(1, sizeof(*RC.ru[j]->nr_frame_parms)); RC.ru[j]->frame_parms = calloc(1, sizeof(*RC.ru[j]->frame_parms)); - printf("Creating RC.ru[%d]:%p\n", j, RC.ru[j]); RC.ru[j]->if_timing = synch_to_ext_device; if (RC.nb_nr_L1_inst > 0) @@ -1895,7 +1879,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - LOG_I(PHY,"Setting clock source to internal\n"); + LOG_D(PHY, "Setting clock source to internal\n"); RC.ru[j]->openair0_cfg.clock_source = internal; } @@ -1913,7 +1897,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - LOG_I(PHY,"Setting time source to internal\n"); + LOG_D(PHY, "Setting time source to internal\n"); RC.ru[j]->openair0_cfg.time_source = internal; } @@ -1923,7 +1907,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) if (!(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX))) { RC.ru[j]->if_south = LOCAL_RF; RC.ru[j]->function = gNodeB_3GPP; - printf("Setting function for RU %d to gNodeB_3GPP\n",j); + LOG_D(PHY, "Setting function for RU %d to gNodeB_3GPP\n", j); } else { RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); @@ -1937,22 +1921,22 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) RC.ru[j]->if_south = LOCAL_RF; RC.ru[j]->function = NGFI_RRU_IF5; RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; - printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j); + LOG_D(PHY, "Setting function for RU %d to NGFI_RRU_IF5 (udp)\n", j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { RC.ru[j]->if_south = LOCAL_RF; RC.ru[j]->function = NGFI_RRU_IF5; RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE; - printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j); + LOG_D(PHY, "Setting function for RU %d to NGFI_RRU_IF5 (raw)\n", j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { RC.ru[j]->if_south = LOCAL_RF; RC.ru[j]->function = NGFI_RRU_IF4p5; RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; - printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j); + LOG_D(PHY, "Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n", j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { RC.ru[j]->if_south = LOCAL_RF; RC.ru[j]->function = NGFI_RRU_IF4p5; RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; - printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j); + LOG_D(PHY, "Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n", j); } } @@ -1961,7 +1945,7 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); } //strcmp(local_rf, "yes") == 0 else { - printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); + LOG_D(PHY, "RU %d: Transport %s\n", j, *(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); @@ -2006,13 +1990,18 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) RC.ru[j]->openair0_cfg.nr_flag = *(RUParamList.paramarray[j][RU_NR_FLAG].iptr); RC.ru[j]->openair0_cfg.nr_band = RC.ru[j]->band[0]; RC.ru[j]->openair0_cfg.nr_scs_for_raster = *(RUParamList.paramarray[j][RU_NR_SCS_FOR_RASTER].iptr); - printf("[RU %d] Setting nr_flag %d, nr_band %d, nr_scs_for_raster %d\n",j,RC.ru[j]->openair0_cfg.nr_flag,RC.ru[j]->openair0_cfg.nr_band,RC.ru[j]->openair0_cfg.nr_scs_for_raster); + LOG_D(PHY, + "[RU %d] Setting nr_flag %d, nr_band %d, nr_scs_for_raster %d\n", + j, + RC.ru[j]->openair0_cfg.nr_flag, + RC.ru[j]->openair0_cfg.nr_band, + RC.ru[j]->openair0_cfg.nr_scs_for_raster); RC.ru[j]->openair0_cfg.rxfh_cores[0] = *(RUParamList.paramarray[j][RU_RXFH_CORE_ID].iptr); RC.ru[j]->openair0_cfg.txfh_cores[0] = *(RUParamList.paramarray[j][RU_TXFH_CORE_ID].iptr); RC.ru[j]->num_tpcores = *(RUParamList.paramarray[j][RU_NUM_TP_CORES].iptr); RC.ru[j]->half_slot_parallelization = *(RUParamList.paramarray[j][RU_HALF_SLOT_PARALLELIZATION].iptr); RC.ru[j]->ru_thread_core = *(RUParamList.paramarray[j][RU_RU_THREAD_CORE].iptr); - printf("[RU %d] Setting half-slot parallelization to %d\n",j,RC.ru[j]->half_slot_parallelization); + LOG_D(PHY, "[RU %d] Setting half-slot parallelization to %d\n", j, RC.ru[j]->half_slot_parallelization); AssertFatal(RC.ru[j]->num_tpcores <= RUParamList.paramarray[j][RU_TP_CORES].numelt, "Number of TP cores should be <=16\n"); for (int i = 0; i < RC.ru[j]->num_tpcores; i++) RC.ru[j]->tpcores[i] = RUParamList.paramarray[j][RU_TP_CORES].iptr[i]; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 1e13886a246719e26a36c5ec9fd74c842ea4b99d..47548239b97cf338029f180cf3857afd5913189a 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -182,12 +182,9 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) { return temp; } -void print_difftimes(void) { -#ifdef DEBUG - printf("difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); -#else - LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); -#endif +void print_difftimes(void) +{ + LOG_I(HW, "difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); } void update_difftimes(struct timespec start, struct timespec end) { @@ -268,7 +265,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf uint32_t gnb_id_end = gnb_id_start + gnb_nb; LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb); itti_wait_ready(1); - LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); + LOG_D(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); #ifdef ENABLE_AERIAL AssertFatal(NFAPI_MODE == NFAPI_MODE_AERIAL,"Can only be run with '--nfapi AERIAL' when compiled with AERIAL support, if you want to run other (n)FAPI modes, please run ./build_oai without -w AERIAL"); @@ -283,7 +280,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf if (RC.nb_nr_macrlc_inst > 0) RCconfig_nr_macrlc(cfg); - LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); + LOG_D(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); @@ -291,7 +288,7 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf "Number of gNB is greater than gNB defined in configuration file (%d/%d)!", gnb_nb, RC.nb_nr_inst); - LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); + LOG_D(GNB_APP, "Allocating gNB_RRC_INST for %d instances\n", RC.nb_nr_inst); if (RC.nb_nr_inst > 0) { AssertFatal(RC.nb_nr_inst == 1, "multiple RRC instances are not supported\n"); @@ -411,7 +408,6 @@ static void get_options(configmodule_interface_t *cfg) NRRCConfig(); NB_gNB_INST = RC.nb_nr_inst; NB_RU = RC.nb_RU; - printf("Configuration: nb_rrc_inst %d, nb_nr_L1_inst %d, nb_ru %hhu\n",NB_gNB_INST,RC.nb_nr_L1_inst,NB_RU); } } @@ -461,24 +457,22 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], // downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0]; // downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0]; // downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0]; - //printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]); frame_parms[CC_id]->dl_CarrierFreq=downlink_frequency[CC_id][0]; */ } } void wait_RUs(void) { - LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); + LOG_D(PHY, "Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); // wait for all RUs to be configured over fronthaul pthread_mutex_lock(&RC.ru_mutex); while (RC.ru_mask>0) { pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex); - printf("RC.ru_mask:%02lx\n", RC.ru_mask); } pthread_mutex_unlock(&RC.ru_mutex); - LOG_I(PHY,"RUs configured\n"); + LOG_D(PHY, "RUs configured\n"); } void wait_gNBs(void) { @@ -486,7 +480,7 @@ void wait_gNBs(void) { int waiting=1; while (waiting==1) { - printf("Waiting for gNB L1 instances to all get configured ... sleeping 50ms (nb_nr_sL1_inst %d)\n",RC.nb_nr_L1_inst); + LOG_D(GNB_APP, "Waiting for gNB L1 instances to all get configured ... sleeping 50ms (nb_nr_sL1_inst %d)\n", RC.nb_nr_L1_inst); usleep(50*1000); waiting=0; @@ -498,7 +492,7 @@ void wait_gNBs(void) { } } - printf("gNB L1 are configured\n"); + LOG_D(GNB_APP, "gNB L1 are configured\n"); } /* @@ -514,15 +508,14 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) { //extern void free_transport(PHY_VARS_gNB *); extern void nr_phy_free_RU(RU_t *); -static void wait_nfapi_init(char *thread_name) { - printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); +static void wait_nfapi_init(char *thread_name) +{ pthread_mutex_lock( &nfapi_sync_mutex ); while (nfapi_sync_var<0) pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex ); pthread_mutex_unlock(&nfapi_sync_mutex); - printf( "NFAPI: got sync (%s)\n", thread_name); } void init_pdcp(void) { @@ -601,7 +594,6 @@ int main( int argc, char **argv ) { memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); logInit(); lock_memory_to_ram(); - printf("Reading in command-line options\n"); get_options(uniqCfg); EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1; @@ -626,7 +618,6 @@ int main( int argc, char **argv ) { #endif //randominit (0); set_taus_seed (0); - printf("configuring for RAU/RRU\n"); cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, tasks_info); @@ -653,27 +644,20 @@ int main( int argc, char **argv ) { usleep(1000); if (NFAPI_MODE && NFAPI_MODE != NFAPI_MODE_AERIAL) { - printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); } - printf("START MAIN THREADS\n"); // start the main threads number_of_cards = 1; - printf("RC.nb_nr_L1_inst:%d\n", RC.nb_nr_L1_inst); if (RC.nb_nr_L1_inst > 0) { - printf("Initializing gNB threads wait_for_sync:%d\n", wait_for_sync); init_gNB(wait_for_sync); } - printf("wait_gNBs()\n"); wait_gNBs(); - printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU); int sl_ahead = NFAPI_MODE == NFAPI_MODE_AERIAL ? 0 : 6; if (RC.nb_RU >0) { - printf("Initializing RU threads\n"); init_NR_RU(uniqCfg, get_softmodem_params()->rf_config_file); for (ru_id=0; ru_id<RC.nb_RU; ru_id++) { @@ -719,12 +703,8 @@ int main( int argc, char **argv ) { nvIPC_Init(nrmac->nvipc_params_s); #endif if (RC.nb_nr_L1_inst > 0) { - printf("wait RUs\n"); wait_RUs(); - printf("ALL RUs READY!\n"); - printf("RC.nb_RU:%d\n", RC.nb_RU); // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) - printf("ALL RUs ready - init gNBs\n"); for (int idx=0;idx<RC.nb_nr_L1_inst;idx++) RC.gNB[idx]->if_inst->sl_ahead = sl_ahead; if (IS_SOFTMODEM_DOSCOPE || IS_SOFTMODEM_IMSCOPE_ENABLED) { @@ -743,15 +723,10 @@ int main( int argc, char **argv ) { } if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF && NFAPI_MODE != NFAPI_MODE_AERIAL) { - printf("Not NFAPI mode - call init_eNB_afterRU()\n"); init_eNB_afterRU(); - } else { - printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n"); } - printf("ALL RUs ready - ALL gNBs ready\n"); // connect the TX/RX buffers - printf("Sending sync to all threads\n"); pthread_mutex_lock(&sync_mutex); sync_var=0; pthread_cond_broadcast(&sync_cond); @@ -759,12 +734,10 @@ int main( int argc, char **argv ) { } // wait for end of program - printf("Entering ITTI signals handler\n"); printf("TYPE <CTRL-C> TO TERMINATE\n"); itti_wait_tasks_end(NULL); printf("Returned from ITTI signal handler\n"); oai_exit=1; - printf("oai_exit=%d\n",oai_exit); // cleanup if (RC.nb_nr_L1_inst > 0) diff --git a/nfapi/oai_integration/nfapi.c b/nfapi/oai_integration/nfapi.c index 7b4d1b6239aee8b1754539aaf8ade1fe03c3a3d9..3d363d25eecad30b39f77cc5b9250abc7d97e46d 100644 --- a/nfapi/oai_integration/nfapi.c +++ b/nfapi/oai_integration/nfapi.c @@ -47,15 +47,10 @@ const char *nfapi_get_strmode(void) { return nfapi_str_mode[nfapi_params.nfapi_mode]; } -void nfapi_logmode() { - LOG_I(ENB_APP,"nfapi (%d) running mode: %s\n",nfapi_params.nfapi_mode,nfapi_get_strmode()); -} - nfapi_mode_t nfapi_getmode(void) { return nfapi_params.nfapi_mode; } void nfapi_setmode(nfapi_mode_t nfapi_mode) { nfapi_params.nfapi_mode = nfapi_mode; - nfapi_logmode(); } diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c index 62e8c1d5d30fb624712905d57d26d6367d6ffe5a..967d352769a9cf703c0fa0912f3c078233830d81 100644 --- a/openair1/PHY/INIT/lte_init_ru.c +++ b/openair1/PHY/INIT/lte_init_ru.c @@ -39,7 +39,7 @@ int phy_init_RU(RU_t *ru) { RU_CALIBRATION *calibration = &ru->calibration; int i,j,p,re; //load_dftslib(); - LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d\n",ru_if_types[ru->if_south],ru->nb_tx); + LOG_D(PHY, "Initializing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx); if (ru->is_slave == 1) { generate_ul_ref_sigs_rx(); @@ -54,8 +54,11 @@ int phy_init_RU(RU_t *ru) { for (i=0; i<ru->nb_tx; i++) { // Allocate 10 subframes of I/Q TX signal data (time) if not ru->common.txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); - LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes)\n",i,ru->common.txdata[i], - fp->samples_per_tti*10*sizeof(int32_t)); + LOG_D(PHY, + "[INIT] common.txdata[%d] = %p (%lu bytes)\n", + i, + ru->common.txdata[i], + fp->samples_per_tti * 10 * sizeof(int32_t)); } if (ru->is_slave == 1) { @@ -71,7 +74,6 @@ int phy_init_RU(RU_t *ru) { } } // IF5 or local RF else { - // LOG_I(PHY,"No rxdata/txdata for RU\n"); ru->common.txdata = (int32_t **)NULL; ru->common.rxdata = (int32_t **)NULL; } @@ -79,22 +81,21 @@ int phy_init_RU(RU_t *ru) { if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing load_dftslib(); init_7_5KHz(); - LOG_I(PHY,"nb_tx %d\n",ru->nb_tx); + LOG_D(PHY, "nb_tx %d\n", ru->nb_tx); ru->common.rxdata_7_5kHz = (int32_t **)malloc16(ru->nb_rx*sizeof(int32_t *) ); for (i=0; i<ru->nb_rx; i++) { ru->common.rxdata_7_5kHz[i] = (int32_t *)malloc16_clear( 2*fp->samples_per_tti*2*sizeof(int32_t) ); - LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx); + LOG_D(PHY, "rxdata_7_5kHz[%d] %p for RU %d\n", i, ru->common.rxdata_7_5kHz[i], ru->idx); } // allocate IFFT input buffers (TX) ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t *)); - LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF, - ru->nb_tx*sizeof(int32_t *)); + LOG_D(PHY, "[INIT] common.txdata_BF= %p (%lu bytes)\n", ru->common.txdataF_BF, ru->nb_tx * sizeof(int32_t *)); for (i=0; i<ru->nb_tx; i++) { ru->common.txdataF_BF[i] = (int32_t *)malloc16_clear(fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t) ); - LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx); + LOG_D(PHY, "txdataF_BF[%d] %p for RU %d\n", i, ru->common.txdataF_BF[i], ru->idx); } // allocate FFT output buffers (RX) @@ -103,7 +104,7 @@ int phy_init_RU(RU_t *ru) { for (i=0; i<ru->nb_rx; i++) { // allocate 2 subframes of I/Q signal data (frequency) ru->common.rxdataF[i] = (int32_t *)malloc16_clear(sizeof(int32_t)*(2*fp->ofdm_symbol_size*fp->symbols_per_tti) ); - LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx); + LOG_D(PHY, "rxdataF[%d] %p for RU %d\n", i, ru->common.rxdataF[i], ru->idx); } if (ru->is_slave == 1) { @@ -114,7 +115,7 @@ int phy_init_RU(RU_t *ru) { for (i=0; i<ru->nb_rx; i++) { // allocate 2 subframes of I/Q signal data (frequency) calibration->rxdataF_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); - LOG_I(PHY,"rxdataF_ext[%d] %p for RU %d\n",i,calibration->rxdataF_ext[i],ru->idx); + LOG_D(PHY, "rxdataF_ext[%d] %p for RU %d\n", i, calibration->rxdataF_ext[i], ru->idx); calibration->drs_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti); } } @@ -186,7 +187,7 @@ int phy_init_RU(RU_t *ru) { void phy_free_RU(RU_t *ru) { int i,j,p; RU_CALIBRATION *calibration = &ru->calibration; - LOG_I(PHY, "Freeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx); + LOG_D(PHY, "Freeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx); if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 57d9bbc8ebf7e0bd963f7fa2ca689daecbf5f302..708f23e01a56dea00d77ad0e17dda833133e5a90 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -47,19 +47,19 @@ int l1_north_init_gNB() { AssertFatal(RC.nb_nr_L1_inst>0,"nb_nr_L1_inst=%d\n",RC.nb_nr_L1_inst); AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n"); - LOG_I(PHY,"%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); + LOG_D(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); for (int i=0; i<RC.nb_nr_L1_inst; i++) { AssertFatal(RC.gNB[i]!=NULL,"RC.gNB[%d] is null\n",i); if ((RC.gNB[i]->if_inst = NR_IF_Module_init(i))<0) return(-1); - - LOG_I(PHY,"%s() RC.gNB[%d] installing callbacks\n", __FUNCTION__, i); + + LOG_D(PHY, "%s() RC.gNB[%d] installing callbacks\n", __FUNCTION__, i); RC.gNB[i]->if_inst->NR_PHY_config_req = nr_phy_config_request; RC.gNB[i]->if_inst->NR_Schedule_response = nr_schedule_response; } } else { - LOG_I(PHY,"%s() Not installing PHY callbacks - RC.nb_nr_L1_inst:%d RC.gNB:%p\n", __FUNCTION__, RC.nb_nr_L1_inst, RC.gNB); + LOG_D(PHY, "%s() Not installing PHY callbacks - RC.nb_nr_L1_inst:%d RC.gNB:%p\n", __FUNCTION__, RC.nb_nr_L1_inst, RC.gNB); } return(0); @@ -125,7 +125,7 @@ void phy_init_nr_gNB(PHY_VARS_gNB *gNB) AssertFatal(Ptx > 0 && Ptx < 9,"Ptx %d is not supported\n", Ptx); AssertFatal(Prx > 0 && Prx < 9,"Prx %d is not supported\n", Prx); - LOG_I(PHY, "[gNB %d]About to wait for gNB to be configured\n", gNB->Mod_id); + LOG_D(PHY, "[gNB %d]About to wait for gNB to be configured\n", gNB->Mod_id); while(gNB->configured == 0) usleep(10000); @@ -381,8 +381,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, init_symbol_rotation(fp); init_timeshift_rotation(fp); - gNB->configured = 1; - LOG_I(PHY,"gNB configured\n"); + gNB->configured = 1; } void nr_phy_config_request(NR_PHY_Config_t *phy_config) @@ -406,7 +405,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset); fp->threequarter_fs = get_softmodem_params()->threequarter_fs; - LOG_A(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n", + LOG_D(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n", Mod_id, gNB_config->cell_config.phy_cell_id.value, (unsigned long long)fp->dl_CarrierFreq, @@ -434,8 +433,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) fp->ofdm_offset_divisor = RC.gNB[Mod_id]->ofdm_offset_divisor; init_symbol_rotation(fp); init_timeshift_rotation(fp); - - LOG_I(PHY,"gNB %d configured\n",Mod_id); } void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) @@ -476,7 +473,6 @@ void init_nr_transport(PHY_VARS_gNB *gNB) NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; - LOG_I(PHY, "Initialise nr transport\n"); int nb_slots_per_period = cfg->cell_config.frame_duplex_type.value ? fp->slots_per_frame / get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value) : diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 93b95b96eb20c1b75d8e9d2177c4b463fcbd04f9..bf447645d61fa23c7cb321d454e573760591fe2a 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -33,7 +33,7 @@ int nr_phy_init_RU(RU_t *ru) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d, nb_rx %d\n",ru_if_types[ru->if_south],ru->nb_tx, ru->nb_rx); + LOG_D(PHY, "Initializing RU signal buffers (if_south %s) nb_tx %d, nb_rx %d\n", ru_if_types[ru->if_south], ru->nb_tx, ru->nb_rx); nfapi_nr_config_request_scf_t *cfg = &ru->config; ru->nb_log_antennas = 0; @@ -60,29 +60,30 @@ int nr_phy_init_RU(RU_t *ru) for (int i = 0; i < ru->nb_tx; i++) { // Allocate 10 subframes of I/Q TX signal data (time) if not ru->common.txdata[i] = (int32_t*)malloc16_clear((ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t)); - LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i], - (ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t),ru->sf_extension); + LOG_D(PHY, + "[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n", + i, + ru->common.txdata[i], + (ru->sf_extension + fp->samples_per_frame) * sizeof(int32_t), + ru->sf_extension); ru->common.txdata[i] = &ru->common.txdata[i][ru->sf_extension]; - LOG_I(PHY,"[INIT] common.txdata[%d] = %p \n",i,ru->common.txdata[i]); - + LOG_D(PHY, "[INIT] common.txdata[%d] = %p \n", i, ru->common.txdata[i]); } for (int i = 0; i < ru->nb_rx; i++) { ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_frame*sizeof(int32_t) ); } } // IF5 or local RF else { - // LOG_I(PHY,"No rxdata/txdata for RU\n"); ru->common.txdata = (int32_t**)NULL; ru->common.rxdata = (int32_t**)NULL; - } if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing - LOG_I(PHY,"nb_tx %d\n",ru->nb_tx); + LOG_D(PHY, "nb_tx %d\n", ru->nb_tx); ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); for (int i = 0; i < ru->nb_rx; i++) { ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_subframe*2*sizeof(int32_t) ); - LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx); + LOG_D(PHY, "rxdata_7_5kHz[%d] %p for RU %d\n", i, ru->common.rxdata_7_5kHz[i], ru->idx); } @@ -94,10 +95,10 @@ int nr_phy_init_RU(RU_t *ru) // allocate IFFT input buffers (TX) ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*)); - LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n", ru->common.txdataF_BF, ru->nb_tx*sizeof(int32_t*)); + LOG_D(PHY, "[INIT] common.txdata_BF= %p (%lu bytes)\n", ru->common.txdataF_BF, ru->nb_tx * sizeof(int32_t *)); for (int i = 0; i < ru->nb_tx; i++) { ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->samples_per_subframe_wCP*sizeof(int32_t) ); - LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx); + LOG_D(PHY, "txdataF_BF[%d] %p for RU %d\n", i, ru->common.txdataF_BF[i], ru->idx); } // allocate FFT output buffers (RX) ru->common.rxdataF = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); @@ -105,7 +106,7 @@ int nr_phy_init_RU(RU_t *ru) // allocate 4 slots of I/Q signal data (frequency) int size = RU_RX_SLOT_DEPTH * fp->symbols_per_slot * fp->ofdm_symbol_size; ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF) * size); - LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx); + LOG_D(PHY, "rxdataF[%d] %p for RU %d\n", i, ru->common.rxdataF[i], ru->idx); } /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */ @@ -124,7 +125,7 @@ int nr_phy_init_RU(RU_t *ru) AssertFatal(ru->num_gNB <= NUMBER_OF_gNB_MAX,"gNB instances %d > %d\n", ru->num_gNB,NUMBER_OF_gNB_MAX); - LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB); + LOG_D(PHY, "[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB); } // !=IF5 @@ -135,7 +136,7 @@ int nr_phy_init_RU(RU_t *ru) void nr_phy_free_RU(RU_t *ru) { - LOG_I(PHY, "Freeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx); + LOG_D(PHY, "Freeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx); if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals // Hack: undo what is done at allocation diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c index aac8e71828d4499de5e686adfd70292e303fd48a..137035d0d71b850cf7ca5aaa4196dabd78247bb2 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c @@ -53,28 +53,23 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { // do ifft of channel estimate + int len=0; switch(frame_parms->N_RB_DL) { case 6: - dft(DFT_128,(int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; + len = 128; + break; case 25: - dft(DFT_512,(int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; + len = 512; + break; case 50: - dft(DFT_1024,(int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; + len = 1024; + break; case 100: - dft(DFT_2048,(int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; + len = 2048; + break; } + if (len) + dft(get_dft(len), (int16_t *)lte_eNB_srs->srs_ch_estimates[aa], (int16_t *)lte_eNB_srs->srs_ch_estimates_time[aa], 1); #ifdef DEBUG_PHY sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa); sprintf(vname,"srs_time_%d%d",ind,aa); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index 1e27e99166c1b64731b8ee49380b2c84a8ac0cd6..fe995885cb42e35d54a581ade0910068d9302862 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -47,9 +47,10 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue, uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1]; uint8_t nushift,pilot0,pilot1,pilot2,pilot3; uint8_t previous_thread_id = ue->current_thread_id[Ns>>1]==0 ? (RX_NB_TH-1):(ue->current_thread_id[Ns>>1]-1); - int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset]; + LTE_UE_COMMON_PER_THREAD * vars=&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]]; + int **dl_ch_estimates =vars->dl_ch_estimates[eNB_offset]; int **dl_ch_estimates_previous=ue->common_vars.common_vars_rx_data_per_thread[previous_thread_id].dl_ch_estimates[eNB_offset]; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF; + int **rxdataF=vars->rxdataF; pilot0 = 0; if (ue->frame_parms.Ncp == 0) { // normal prefix @@ -657,53 +658,27 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue, } } - idft_size_idx_t idftsizeidx; - - switch (ue->frame_parms.ofdm_symbol_size) { - case 128: - idftsizeidx = IDFT_128; - break; - - case 256: - idftsizeidx = IDFT_256; - break; - - case 512: - idftsizeidx = IDFT_512; - break; - - case 1024: - idftsizeidx = IDFT_1024; - break; - - case 1536: - idftsizeidx = IDFT_1536; - break; - - case 2048: - idftsizeidx = IDFT_2048; - break; - - default: - idftsizeidx = IDFT_512; - break; - } + int s = ue->frame_parms.ofdm_symbol_size; + if (s != 128 && s != 256 && s != 512 && s != 1024 && s != 1536 && s != 2048) + s = 512; if( ((Ns%2) == 0) && (l == pilot0)) { // do ifft of channel estimate for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) for (p=0; p<ue->frame_parms.nb_antenna_ports_eNB; p++) { - if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx]) { + if (dl_ch_estimates[(p<<1)+aarx]) { //LOG_I(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d \n", Ns, ue->current_thread_id[Ns>>1], l); - idft(idftsizeidx,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[eNB_offset][(p<<1)+aarx][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1); + idft(get_idft(s), + (int16_t *)&dl_ch_estimates[(p << 1) + aarx][8], + (int16_t *)vars->dl_ch_estimates_time[eNB_offset][(p << 1) + aarx], + 1); } } } T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(eNB_id), T_INT(0), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].frame_rx%1024), T_INT(ue->proc.proc_rxtx[ue->current_thread_id[Ns>>1]].subframe_rx), - T_INT(0), T_BUFFER(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates_time[eNB_offset][0][0], 512 * 4)); + T_INT(0), T_BUFFER(&vars->dl_ch_estimates_time[eNB_offset][0][0], 512 * 4)); return(0); } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c index 05e27de1a668239eac4f07450d128337dea5aa02..90606c63c4659f88bab3b9482bce31390667a9ad 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c @@ -721,44 +721,37 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue, // do ifft of channel estimate for (aa=0; aa<ue->frame_parms.nb_antennas_rx*ue->frame_parms.nb_antennas_tx; aa++) { - if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa]) { + int32_t *tmp = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa]; + if (tmp) { + int len; switch (ue->frame_parms.N_RB_DL) { case 6: - idft(IDFT_128,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_offset][aa], - 1); + len = 128; break; - case 25: - idft(IDFT_512,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_offset][aa], - 1); + len = 512; break; - case 50: - idft(IDFT_1024,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_offset][aa], - 1); + len = 1024; break; - case 75: - idft(IDFT_1536,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_offset][aa], - 1); + len=1536; break; - case 100: - idft(IDFT_2048,(int16_t *) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_offset][aa][8], - (int16_t *) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_offset][aa], - 1); + len = 2048; break; - default: - break; + LOG_E(PHY, "Unknown N_RB_DL %d\n", ue->frame_parms.N_RB_DL); + return -1; } + + idft(get_idft(len), + (int16_t *)&tmp[8], + (int16_t *)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]] + .dl_ch_estimates_time[eNB_offset][aa], + 1); } } - return(0); } @@ -907,30 +900,27 @@ int lte_dl_mbsfn_khz_1dot25_channel_estimation(PHY_VARS_UE *ue, // do ifft of channel estimate for (aa=0; aa<ue->frame_parms.nb_antennas_rx*ue->frame_parms.nb_antennas_tx; aa++) { - if (ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa]) { + int32_t *tmp = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa]; + if (tmp) { + int len = 0; switch (ue->frame_parms.N_RB_DL) { - case 25: - idft(IDFT_6144,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8], - (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa], - 1); - break; - case 50: - idft(IDFT_12288,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8], - (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa], - 1); - break; - case 100: - idft(IDFT_24576,(int16_t*) &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[0][aa][8], - (int16_t*) ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa], - 1); - break; - default: - break; + case 25: + len = 6144; + break; + case 50: + len = 12288; + break; + case 100: + len = 24576; + break; } + if (len) + idft(get_idft(len), + (int16_t *)&tmp[8], + (int16_t *)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[0][aa], + 1); } } - - return(0); } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index e80de0798d42adad2aea6bb081c7fe97e8bfda45..4a1980af8c3cf3d06296458d369bbe1f8f58037c 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -37,33 +37,29 @@ static c16_t *primary_synch_time[3] __attribute__((aligned(32))); static void doIdft(int size, short *in, short *out) { + int len; switch (size) { - case 6: - idft(IDFT_128,in,out,1); - break; - - case 25: - idft(IDFT_512,in,out,1); - break; - - case 50: - idft(IDFT_1024,in,out,1); - break; - - case 75: - idft(IDFT_1536,in,out,1); - break; - - case 100: - idft(IDFT_2048,in,out,1); - break; - - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",size); - abort(); - break; - } + case 6: + len = 128; + break; + case 25: + len = 512; + break; + case 50: + len = 1024; + break; + case 75: + len=1536; + break; + case 100: + len = 2048; + break; + default: + LOG_E(PHY, "Unknown N_RB_DL %d\n", size); + return; } + idft(get_idft(len), in, out, 1); +} static void copyPrimary( c16_t *out, struct complex16 *in, int ofdmSize) { int k=ofdmSize-36; @@ -187,43 +183,29 @@ int ru_sync_time_init(RU_t *ru) { // LTE_UE_COMMON *common_vars 0, ru->frame_parms->N_RB_DL, 0); - + int len; switch (ru->frame_parms->N_RB_DL) { case 6: - idft(IDFT_128,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); + len = 128; break; - case 25: - idft(IDFT_512,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); + len = 512; break; - case 50: - idft(IDFT_1024,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); + len = 1024; break; - case 75: - idft(IDFT_1536,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, - 1); /// complex output + len = 1536; break; - case 100: - idft(IDFT_2048,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); + len = 2048; break; - default: - AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); - break; + LOG_E(PHY, "Unknown N_RB_DL %d\n", ru->frame_parms->N_RB_DL); + return -1; } - + idft(get_idft(len), (int16_t *)&dmrsp[0][3 * ru->frame_parms->ofdm_symbol_size], ru->dmrssync, + 1); /// complex output return(0); } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index e081a9d8692d3ba0ea076e2f109669185d7b6cbe..a2c64945344f7e6e30cc23e84ff4e3c6cbd1fa5e 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -222,33 +222,25 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, for(i=0; i<Msc_RS; i++) ((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i]; - + int len; switch(frame_parms->N_RB_DL) { case 6: - idft(IDFT_128,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 128; break; - case 25: - idft(IDFT_512,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 512; break; - case 50: - idft(IDFT_1024,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 1024; break; - case 100: - idft(IDFT_2048,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 2048; break; + default: + LOG_E(PHY, "Unknown N_RB_DL %d\n", frame_parms->N_RB_DL); + return -1; } - + idft(get_idft(len), (int16_t *)temp_in_ifft_0, (int16_t *)ul_ch_estimates_time[aa], 1); #if T_TRACER if (aa == 0) @@ -501,33 +493,25 @@ int32_t lte_ul_channel_estimation_RRU(LTE_DL_FRAME_PARMS *frame_parms, for(i=0; i<Msc_RS; i++) ((int32_t *)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i]; - + int len; switch(frame_parms->N_RB_DL) { case 6: - idft(IDFT_128,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 128; break; - case 25: - idft(IDFT_512,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 512; break; - case 50: - idft(IDFT_1024,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 1024; break; - case 100: - idft(IDFT_2048,(int16_t *) temp_in_ifft_0, - (int16_t *) ul_ch_estimates_time[aa], - 1); + len = 2048; break; + default: + LOG_E(PHY, "Unknown N_RB_DL %d\n", frame_parms->N_RB_DL); + return -1; } - + idft(get_idft(len), (int16_t *)temp_in_ifft_0, (int16_t *)ul_ch_estimates_time[aa], 1); #if T_TRACER if (aa == 0) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index b971e5ce67a102f12e6c58709ab4170daf38dae9..9c925031861e5803494dd9c353d1ad3d10e8cd80 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -86,14 +86,17 @@ int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { AssertFatal(eNB!=NULL,"eNB is null\n"); for (int i=0; i<NUMBER_OF_ULSCH_MAX; i++) { - if (eNB->ulsch[i]==NULL) continue; + if (eNB->ulsch[i] == NULL) + continue; if (type == SEARCH_EXIST_RA) { - if (eNB->ulsch[i]->rnti == rnti) return i; + if (eNB->ulsch[i]->rnti == rnti) + return i; } else { - if ((eNB->ulsch[i]->harq_mask >0) && - (eNB->ulsch[i]->rnti==rnti)) return i; - else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; + if (eNB->ulsch[i]->harq_mask > 0 && eNB->ulsch[i]->rnti == rnti) + return i; + else if (eNB->ulsch[i]->harq_mask == 0 && first_free_index == -1) + first_free_index = i; } } @@ -1963,7 +1966,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, if(frame_parms->frame_type == TDD) { UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE); - if(UE_id >=0 || UE_id < NUMBER_OF_ULSCH_MAX) { + if (UE_id >= 0) { eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1; } } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 5099a634396d7c731bd7af813a78cdf0923122f9..8541d117712bee8ee8d2534a6116cd92d826392e 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -160,8 +160,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, for (i=0; i<Mdlharq; i++) { dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); - LOG_I(PHY, "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", - MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]); + LOG_D(PHY, + "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", + MAX_DLSCH_PAYLOAD_BYTES / bw_scaling, + bw_scaling, + i, + dlsch->harq_processes[i]); if (dlsch->harq_processes[i]) { bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index ec5fa88d94f2b2a39a01f78307972ef80f8f877e..92350194ca6512e2227f377a419677bcf0288d69 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -292,104 +292,38 @@ void rx_prach0(PHY_VARS_eNB *eNB, // do DFT switch (fp->N_RB_UL) { case 6: - if (prach_fmt == 4) { - dft(DFT_256,prach2,rxsigF[aa],1); - fft_size=256; - } else { - dft(DFT_1536,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); - fft_size=1536; - } - + fft_size = prach_fmt == 4 ? 256 : 1536; break; case 15: - if (prach_fmt == 4) { - dft(DFT_256,prach2,rxsigF[aa],1); - fft_size=256; - } else { - dft(DFT_3072,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); - } - fft_size=3072; + fft_size = prach_fmt == 4 ? 256 : 3072; break; case 25: default: - if (prach_fmt == 4) { - dft(DFT_1024,prach2,rxsigF[aa],1); - fft_size = 1024; - } else { - dft(DFT_6144,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_6144,prach2+12288,rxsigF[aa]+12288,1); - - fft_size = 6144; - } - + fft_size = prach_fmt == 4 ? 1024 : 6144; break; case 50: - if (prach_fmt == 4) { - dft(DFT_2048,prach2,rxsigF[aa],1); - fft_size=2048; - } else { - dft(DFT_12288,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1); - fft_size=12288; - } - + fft_size = prach_fmt == 4 ? 2048 : 12288; break; case 75: - if (prach_fmt == 4) { - dft(DFT_3072,prach2,rxsigF[aa],1); - fft_size=3072; - } else { - dft(DFT_18432,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1); - fft_size=18432; - } - + fft_size = prach_fmt == 4 ? 3072 : 18432; break; case 100: - if (fp->threequarter_fs==0) { - if (prach_fmt == 4) { - dft(DFT_4096,prach2,rxsigF[aa],1); - fft_size=2048; - } else { - dft(DFT_24576,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1); - fft_size=24576; - } - } else { - if (prach_fmt == 4) { - dft(DFT_3072,prach2,rxsigF[aa],1); - fft_size=3072; - } else { - dft(DFT_18432,prach2,rxsigF[aa],1); - - if (prach_fmt>1) - dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1); - fft_size=18432; - } - } - + if (fp->threequarter_fs == 0) + fft_size = prach_fmt == 4 ? 4096 : 24576; + else + fft_size = prach_fmt == 4 ? 3072 : 18432; break; } + dft(get_dft(fft_size), prach2, rxsigF[aa], 1); + if (prach_fmt > 1 && prach_fmt != 4) + dft(get_dft(fft_size), prach2 + 2 * fft_size, rxsigF[aa] + 2 * fft_size, 1); + k = (12*n_ra_prb) - 6*fp->N_RB_UL; if (k<0) { diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index b9331a283e7694d46b0c171c5068fd95142ff717..31aff198dd3753d265ae8174392ae7724a02459e 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -1121,8 +1121,6 @@ void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { } void clear_ulsch_stats(PHY_VARS_eNB *eNB) { - - for (int i=0;i<NUMBER_OF_ULSCH_MAX;i++) - memset((void*)&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i])); + memset(eNB->ulsch_stats, 0, sizeof(eNB->ulsch_stats)); } diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 897f4b1371c59075d62940c188061ed543f0cc43..4052e5ce8980604a49c4fc5ce6444f9e7919ae64 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -127,12 +127,12 @@ void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) { ((uint32_t *)idft_in2)[ip+3] = z11[i]; } } - + dft_size_idx_t dftsize = get_dft(Msc_PUSCH); switch (Msc_PUSCH) { case 12: - dft(DFT_12,(int16_t *)idft_in0,(int16_t *)idft_out0,0); - dft(DFT_12,(int16_t *)idft_in1,(int16_t *)idft_out1,0); - dft(DFT_12,(int16_t *)idft_in2,(int16_t *)idft_out2,0); + dft(dftsize, (int16_t *)idft_in0, (int16_t *)idft_out0, 0); + dft(dftsize, (int16_t *)idft_in1, (int16_t *)idft_out1, 0); + dft(dftsize, (int16_t *)idft_in2, (int16_t *)idft_out2, 0); norm128 = simde_mm_set1_epi16(9459); for (i=0; i<12; i++) { @@ -143,208 +143,10 @@ void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) { break; - case 24: - dft(DFT_24,idft_in0,idft_out0,1); - dft(DFT_24,idft_in1,idft_out1,1); - dft(DFT_24,idft_in2,idft_out2,1); - break; - - case 36: - dft(DFT_36,idft_in0,idft_out0,1); - dft(DFT_36,idft_in1,idft_out1,1); - dft(DFT_36,idft_in2,idft_out2,1); - break; - - case 48: - dft(DFT_48,idft_in0,idft_out0,1); - dft(DFT_48,idft_in1,idft_out1,1); - dft(DFT_48,idft_in2,idft_out2,1); - break; - - case 60: - dft(DFT_60,idft_in0,idft_out0,1); - dft(DFT_60,idft_in1,idft_out1,1); - dft(DFT_60,idft_in2,idft_out2,1); - break; - - case 72: - dft(DFT_72,idft_in0,idft_out0,1); - dft(DFT_72,idft_in1,idft_out1,1); - dft(DFT_72,idft_in2,idft_out2,1); - break; - - case 96: - dft(DFT_96,idft_in0,idft_out0,1); - dft(DFT_96,idft_in1,idft_out1,1); - dft(DFT_96,idft_in2,idft_out2,1); - break; - - case 108: - dft(DFT_108,idft_in0,idft_out0,1); - dft(DFT_108,idft_in1,idft_out1,1); - dft(DFT_108,idft_in2,idft_out2,1); - break; - - case 120: - dft(DFT_120,idft_in0,idft_out0,1); - dft(DFT_120,idft_in1,idft_out1,1); - dft(DFT_120,idft_in2,idft_out2,1); - break; - - case 144: - dft(DFT_144,idft_in0,idft_out0,1); - dft(DFT_144,idft_in1,idft_out1,1); - dft(DFT_144,idft_in2,idft_out2,1); - break; - - case 180: - dft(DFT_180,idft_in0,idft_out0,1); - dft(DFT_180,idft_in1,idft_out1,1); - dft(DFT_180,idft_in2,idft_out2,1); - break; - - case 192: - dft(DFT_192,idft_in0,idft_out0,1); - dft(DFT_192,idft_in1,idft_out1,1); - dft(DFT_192,idft_in2,idft_out2,1); - break; - - case 216: - dft(DFT_216,idft_in0,idft_out0,1); - dft(DFT_216,idft_in1,idft_out1,1); - dft(DFT_216,idft_in2,idft_out2,1); - break; - - case 240: - dft(DFT_240,idft_in0,idft_out0,1); - dft(DFT_240,idft_in1,idft_out1,1); - dft(DFT_240,idft_in2,idft_out2,1); - break; - - case 288: - dft(DFT_288,idft_in0,idft_out0,1); - dft(DFT_288,idft_in1,idft_out1,1); - dft(DFT_288,idft_in2,idft_out2,1); - break; - - case 300: - dft(DFT_300,idft_in0,idft_out0,1); - dft(DFT_300,idft_in1,idft_out1,1); - dft(DFT_300,idft_in2,idft_out2,1); - break; - - case 324: - dft(DFT_324,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_324,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_324,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 360: - dft(DFT_360,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_360,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_360,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 384: - dft(DFT_384,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_384,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_384,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 432: - dft(DFT_432,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_432,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_432,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 480: - dft(DFT_480,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_480,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_480,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 540: - dft(DFT_540,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_540,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_540,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 576: - dft(DFT_576,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_576,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_576,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 600: - dft(DFT_600,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_600,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_600,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 648: - dft(DFT_648,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_648,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_648,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 720: - dft(DFT_720,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_720,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_720,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 768: - dft(DFT_768,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_768,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_768,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 864: - dft(DFT_864,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_864,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_864,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 900: - dft(DFT_900,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_900,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_900,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 960: - dft(DFT_960,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_960,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_960,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 972: - dft(DFT_972,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_972,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_972,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 1080: - dft(DFT_1080,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_1080,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_1080,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 1152: - dft(DFT_1152,(int16_t *)idft_in0,(int16_t *)idft_out0,1); - dft(DFT_1152,(int16_t *)idft_in1,(int16_t *)idft_out1,1); - dft(DFT_1152,(int16_t *)idft_in2,(int16_t *)idft_out2,1); - break; - - case 1200: - dft(DFT_1200,idft_in0,idft_out0,1); - dft(DFT_1200,idft_in1,idft_out1,1); - dft(DFT_1200,idft_in2,idft_out2,1); - break; - default: - // should not be reached - LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH ); - return; + dft(dftsize, idft_in0, idft_out0, 1); + dft(dftsize, idft_in1, idft_out1, 1); + dft(dftsize, idft_in2, idft_out2, 1); } for (i=0,ip=0; i<Msc_PUSCH; i++,ip+=4) { @@ -391,9 +193,6 @@ void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) { ((simde__m128i *)z11)[i]=simde_mm_sign_epi16(((simde__m128i *)z11)[i],*(simde__m128i *)&conjugate2[0]); } } - - simde_mm_empty(); - simde_m_empty(); } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index defca1457016b3c4f862c29d22801ab0e793319f..9fe33c189d3c71fa305a36f4b53622082cadeb3c 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -325,139 +325,50 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 prach2 = prach+(Ncp<<1); // do IDFT + idft_size_idx_t len = 0; switch (ue->frame_parms.N_RB_UL) { case 6: - if (prach_fmt == 4) { - idft(IDFT_256,prachF,prach2,1); - memmove( prach, prach+512, Ncp<<2 ); - prach_len = 256+Ncp; - } else { - idft(IDFT_1536,prachF,prach2,1); - memmove( prach, prach+3072, Ncp<<2 ); - prach_len = 1536+Ncp; - - if (prach_fmt>1) { - memmove( prach2+3072, prach2, 6144 ); - prach_len = 2*1536+Ncp; - } - } - + len = prach_fmt == 4 ? 256 : 1536; break; case 15: - if (prach_fmt == 4) { - idft(IDFT_512,prachF,prach2,1); - //TODO: account for repeated format in dft output - memmove( prach, prach+1024, Ncp<<2 ); - prach_len = 512+Ncp; - } else { - idft(IDFT_3072,prachF,prach2,1); - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - - if (prach_fmt>1) { - memmove( prach2+6144, prach2, 12288 ); - prach_len = 2*3072+Ncp; - } - } - + len = prach_fmt == 4 ? 512 : 3072; break; case 25: default: - if (prach_fmt == 4) { - idft(IDFT_1024,prachF,prach2,1); - memmove( prach, prach+2048, Ncp<<2 ); - prach_len = 1024+Ncp; - } else { - idft(IDFT_6144,prachF,prach2,1); - /*for (i=0;i<6144*2;i++) - prach2[i]<<=1;*/ - memmove( prach, prach+12288, Ncp<<2 ); - prach_len = 6144+Ncp; - - if (prach_fmt>1) { - memmove( prach2+12288, prach2, 24576 ); - prach_len = 2*6144+Ncp; - } - } - + len = prach_fmt == 4 ? 1024 : 6144; break; case 50: - if (prach_fmt == 4) { - idft(IDFT_2048,prachF,prach2,1); - memmove( prach, prach+4096, Ncp<<2 ); - prach_len = 2048+Ncp; - } else { - idft(IDFT_12288,prachF,prach2,1); - memmove( prach, prach+24576, Ncp<<2 ); - prach_len = 12288+Ncp; - - if (prach_fmt>1) { - memmove( prach2+24576, prach2, 49152 ); - prach_len = 2*12288+Ncp; - } - } - + len = prach_fmt == 4 ? 2048 : 12288; break; case 75: - if (prach_fmt == 4) { - idft(IDFT_3072,prachF,prach2,1); - //TODO: account for repeated format in dft output - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - } else { - idft(IDFT_18432,prachF,prach2,1); - memmove( prach, prach+36864, Ncp<<2 ); - prach_len = 18432+Ncp; - - if (prach_fmt>1) { - memmove( prach2+36834, prach2, 73728 ); - prach_len = 2*18432+Ncp; - } - } - + len = prach_fmt == 4 ? 3072 : 18432; break; case 100: - if (ue->frame_parms.threequarter_fs == 0) { - if (prach_fmt == 4) { - idft(IDFT_4096,prachF,prach2,1); - memmove( prach, prach+8192, Ncp<<2 ); - prach_len = 4096+Ncp; - } else { - idft(IDFT_24576,prachF,prach2,1); - memmove( prach, prach+49152, Ncp<<2 ); - prach_len = 24576+Ncp; - - if (prach_fmt>1) { - memmove( prach2+49152, prach2, 98304 ); - prach_len = 2* 24576+Ncp; - } - } - } else { - if (prach_fmt == 4) { - idft(IDFT_3072,prachF,prach2,1); - //TODO: account for repeated format in dft output - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - } else { - idft(IDFT_18432,prachF,prach2,1); - memmove( prach, prach+36864, Ncp<<2 ); - prach_len = 18432+Ncp; - printf("Generated prach for 100 PRB, 3/4 sampling\n"); - - if (prach_fmt>1) { - memmove( prach2+36834, prach2, 73728 ); - prach_len = 2*18432+Ncp; - } - } - } - + if (ue->frame_parms.threequarter_fs == 0) + len = prach_fmt == 4 ? 4096 : 24576; + else + len = prach_fmt == 4 ? 3072 : 18432; break; } + if (prach_fmt == 4) { + idft(get_idft(len), prachF, prach2, 1); + // TODO: account for repeated format in dft output + memmove(prach, prach + 2 * len, Ncp << 2); + prach_len = len + Ncp; + } else { + idft(get_idft(len), prachF, prach2, 1); + memmove(prach, prach + 2 * len, Ncp << 2); + prach_len = len + Ncp; + if (prach_fmt > 1) { + memmove(prach2 + 2 * len, prach2, 73728); + prach_len = 2 * len + Ncp; + } + } //LOG_I(PHY,"prach_len=%d\n",prach_len); AssertFatal(prach_fmt<4, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c index fb70eb6196b963c609baf6f3af68ad412822ea03..9d555c62fe6147207ec121b2826b5c4ed4d5acba 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c @@ -92,41 +92,12 @@ void dft_lte(int32_t *z,struct complex16 *input, int32_t Msc_PUSCH, uint8_t Nsym } // printf("\n"); - + dft_size_idx_t dftsize = get_dft(Msc_PUSCH); switch (Msc_PUSCH) { case 12: - dft(DFT_12,(int16_t *)dft_in0,(int16_t *)dft_out0,0); - dft(DFT_12,(int16_t *)dft_in1,(int16_t *)dft_out1,0); - dft(DFT_12,(int16_t *)dft_in2,(int16_t *)dft_out2,0); - - /* - dft12f(&((simde__m128i *)dft_in0)[0],&((simde__m128i *)dft_in0)[1],&((simde__m128i *)dft_in0)[2],&((simde__m128i - *)dft_in0)[3],&((simde__m128i *)dft_in0)[4],&((simde__m128i *)dft_in0)[5],&((simde__m128i *)dft_in0)[6],&((simde__m128i - *)dft_in0)[7],&((simde__m128i *)dft_in0)[8],&((simde__m128i *)dft_in0)[9],&((simde__m128i *)dft_in0)[10],&((simde__m128i - *)dft_in0)[11], - &((simde__m128i *)dft_out0)[0],&((simde__m128i *)dft_out0)[1],&((simde__m128i *)dft_out0)[2],&((simde__m128i - *)dft_out0)[3],&((simde__m128i *)dft_out0)[4],&((simde__m128i *)dft_out0)[5],&((simde__m128i *)dft_out0)[6],&((simde__m128i - *)dft_out0)[7],&((simde__m128i *)dft_out0)[8],&((simde__m128i *)dft_out0)[9],&((simde__m128i *)dft_out0)[10],&((simde__m128i - *)dft_out0)[11]); - - dft12f(&((simde__m128i *)dft_in1)[0],&((simde__m128i *)dft_in1)[1],&((simde__m128i *)dft_in1)[2],&((simde__m128i - *)dft_in1)[3],&((simde__m128i *)dft_in1)[4],&((simde__m128i *)dft_in1)[5],&((simde__m128i *)dft_in1)[6],&((simde__m128i - *)dft_in1)[7],&((simde__m128i *)dft_in1)[8],&((simde__m128i *)dft_in1)[9],&((simde__m128i *)dft_in1)[10],&((simde__m128i - *)dft_in1)[11], - &((simde__m128i *)dft_out1)[0],&((simde__m128i *)dft_out1)[1],&((simde__m128i *)dft_out1)[2],&((simde__m128i - *)dft_out1)[3],&((simde__m128i *)dft_out1)[4],&((simde__m128i *)dft_out1)[5],&((simde__m128i *)dft_out1)[6],&((simde__m128i - *)dft_out1)[7],&((simde__m128i *)dft_out1)[8],&((simde__m128i *)dft_out1)[9],&((simde__m128i *)dft_out1)[10],&((simde__m128i - *)dft_out1)[11]); - - dft12f(&((simde__m128i *)dft_in2)[0],&((simde__m128i *)dft_in2)[1],&((simde__m128i *)dft_in2)[2],&((simde__m128i - *)dft_in2)[3],&((simde__m128i *)dft_in2)[4],&((simde__m128i *)dft_in2)[5],&((simde__m128i *)dft_in2)[6],&((simde__m128i - *)dft_in2)[7],&((simde__m128i *)dft_in2)[8],&((simde__m128i *)dft_in2)[9],&((simde__m128i *)dft_in2)[10],&((simde__m128i - *)dft_in2)[11], - &((simde__m128i *)dft_out2)[0],&((simde__m128i *)dft_out2)[1],&((simde__m128i *)dft_out2)[2],&((simde__m128i - *)dft_out2)[3],&((simde__m128i *)dft_out2)[4],&((simde__m128i *)dft_out2)[5],&((simde__m128i *)dft_out2)[6],&((simde__m128i - *)dft_out2)[7],&((simde__m128i *)dft_out2)[8],&((simde__m128i *)dft_out2)[9],&((simde__m128i *)dft_out2)[10],&((simde__m128i - *)dft_out2)[11]); - */ + dft(dftsize, (int16_t *)dft_in0, (int16_t *)dft_out0, 0); + dft(dftsize, (int16_t *)dft_in1, (int16_t *)dft_out1, 0); + dft(dftsize, (int16_t *)dft_in2, (int16_t *)dft_out2, 0); norm128 = simde_mm_set1_epi16(9459); for (i = 0; i < 12; i++) { ((simde__m128i *)dft_out0)[i] = simde_mm_slli_epi16(simde_mm_mulhi_epi16(((simde__m128i *)dft_out0)[i], norm128), 1); @@ -136,202 +107,10 @@ void dft_lte(int32_t *z,struct complex16 *input, int32_t Msc_PUSCH, uint8_t Nsym break; - case 24: - dft(DFT_24,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_24,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_24,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 36: - dft(DFT_36,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_36,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_36,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 48: - dft(DFT_48,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_48,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_48,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 60: - dft(DFT_60,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_60,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_60,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 72: - dft(DFT_72,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_72,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_72,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 96: - dft(DFT_96,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_96,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_96,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 108: - dft(DFT_108,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_108,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_108,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 120: - dft(DFT_120,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_120,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_120,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 144: - dft(DFT_144,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_144,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_144,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 180: - dft(DFT_180,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_180,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_180,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 192: - dft(DFT_192,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_192,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_192,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 216: - dft(DFT_216,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_216,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_216,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 240: - dft(DFT_240,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_240,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_240,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 288: - dft(DFT_288,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_288,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_288,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 300: - dft(DFT_300,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_300,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_300,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 324: - dft(DFT_324,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_324,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_324,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 360: - dft(DFT_360,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_360,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_360,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 384: - dft(DFT_384,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_384,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_384,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 432: - dft(DFT_432,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_432,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_432,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 480: - dft(DFT_480,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_480,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_480,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 540: - dft(DFT_540,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_540,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_540,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 576: - dft(DFT_576,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_576,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_576,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 600: - dft(DFT_600,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_600,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_600,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 648: - dft(DFT_648,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_648,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_648,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 720: - dft(DFT_720,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_720,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_720,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 768: - dft(DFT_768,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_768,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_768,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 864: - dft(DFT_864,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_864,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_864,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 900: - dft(DFT_900,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_900,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_900,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 960: - dft(DFT_960,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_960,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_960,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 972: - dft(DFT_972,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_972,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_972,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 1080: - dft(DFT_1080,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_1080,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_1080,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 1152: - dft(DFT_1152,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_1152,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_1152,(int16_t*)dft_in2,(int16_t*)dft_out2,1); - break; - - case 1200: - dft(DFT_1200,(int16_t*)dft_in0,(int16_t*)dft_out0,1); - dft(DFT_1200,(int16_t*)dft_in1,(int16_t*)dft_out1,1); - dft(DFT_1200,(int16_t*)dft_in2,(int16_t*)dft_out2,1); + default: + dft(dftsize, (int16_t *)dft_in0, (int16_t *)dft_out0, 1); + dft(dftsize, (int16_t *)dft_in1, (int16_t *)dft_out1, 1); + dft(dftsize, (int16_t *)dft_in2, (int16_t *)dft_out2, 1); break; } diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 3285dab1498ac2b2f8e63dda1d5f59fe5dff77fc..e8b215acccaa9dd1333fdc700c83af1e4e71fb23 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -341,236 +341,21 @@ void nr_dft(c16_t *z, c16_t *d, uint32_t Msc_PUSCH) dft_in0[ip] = d[i]; } } - + dft_size_idx_t dftsize = get_dft(Msc_PUSCH); switch (Msc_PUSCH) { case 12: - dft(DFT_12,(int16_t *)dft_in0, (int16_t *)dft_out0,0); - + dft(dftsize, (int16_t *)dft_in0, (int16_t *)dft_out0, 0); norm128 = simde_mm_set1_epi16(9459); - for (i=0; i<12; i++) { - ((simde__m128i*)dft_out0)[i] = simde_mm_slli_epi16(simde_mm_mulhi_epi16(((simde__m128i*)dft_out0)[i], norm128), 1); + for (i = 0; i < 12; i++) { + ((simde__m128i *)dft_out0)[i] = simde_mm_slli_epi16(simde_mm_mulhi_epi16(((simde__m128i *)dft_out0)[i], norm128), 1); } break; - - case 24: - dft(DFT_24,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 36: - dft(DFT_36,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 48: - dft(DFT_48,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 60: - dft(DFT_60,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 72: - dft(DFT_72,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 96: - dft(DFT_96,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 108: - dft(DFT_108,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 120: - dft(DFT_120,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 144: - dft(DFT_144,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 180: - dft(DFT_180,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 192: - dft(DFT_192,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 216: - dft(DFT_216,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 240: - dft(DFT_240,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 288: - dft(DFT_288,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 300: - dft(DFT_300,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 324: - dft(DFT_324,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 360: - dft(DFT_360,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 384: - dft(DFT_384,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 432: - dft(DFT_432,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 480: - dft(DFT_480,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 540: - dft(DFT_540,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 576: - dft(DFT_576,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 600: - dft(DFT_600,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 648: - dft(DFT_648,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 720: - dft(DFT_720,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 768: - dft(DFT_768,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 864: - dft(DFT_864,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 900: - dft(DFT_900,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 960: - dft(DFT_960,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 972: - dft(DFT_972,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1080: - dft(DFT_1080,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1152: - dft(DFT_1152,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1200: - dft(DFT_1200,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1296: - dft(DFT_1296,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1440: - dft(DFT_1440,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1500: - dft(DFT_1500,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1536: - //dft(DFT_1536,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - dft(DFT_1536,(int16_t*)d, (int16_t*)z, 1); - break; - - case 1620: - dft(DFT_1620,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1728: - dft(DFT_1728,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1800: - dft(DFT_1800,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1920: - dft(DFT_1920,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 1944: - dft(DFT_1944,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2160: - dft(DFT_2160,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2304: - dft(DFT_2304,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2400: - dft(DFT_2400,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2592: - dft(DFT_2592,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2700: - dft(DFT_2700,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2880: - dft(DFT_2880,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 2916: - dft(DFT_2916,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 3000: - dft(DFT_3000,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - - case 3072: - //dft(DFT_3072,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - dft(DFT_3072,(int16_t*)d, (int16_t*)z, 1); - break; - - case 3240: - dft(DFT_3240,(int16_t*)dft_in0, (int16_t*)dft_out0, 1); - break; - default: - // should not be reached - LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH ); - return; - + dft(dftsize, (int16_t *)dft_in0, (int16_t *)dft_out0, 1); + break; } - if ((Msc_PUSCH % 1536) > 0) { for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) z[i] = dft_out0[ip]; @@ -586,7 +371,7 @@ void perform_symbol_rotation(NR_DL_FRAME_PARMS *fp, double f0, c16_t *symbol_rot const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index))); const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index))); - LOG_I(PHY, "Doing symbol rotation calculation for TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); + LOG_D(PHY, "Doing symbol rotation calculation for TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); double tl = 0.0; double poff = 0.0; diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index e32816f76a2821ac361044876d4d54a431d61622..8488545355228e53b36690b5f045ea03c6321608 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -49,39 +49,11 @@ int slot_fep(PHY_VARS_UE *ue, unsigned char harq_pid = dlsch_ue[0]->current_harq_pid; LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; int uespec_pilot[9][1200];*/ - dft_size_idx_t dftsizeidx; int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsizeidx = DFT_128; - break; - - case 256: - dftsizeidx = DFT_256; - break; - - case 512: - dftsizeidx = DFT_512; - break; - - case 1024: - dftsizeidx = DFT_1024; - break; - - case 1536: - dftsizeidx = DFT_1536; - break; - - case 2048: - dftsizeidx = DFT_2048; - break; - - default: - dftsizeidx = DFT_512; - break; - } - + int s = frame_parms->ofdm_symbol_size; + if (s != 128 && s != 256 && s != 512 && s != 1024 && s != 1536 && s != 2048) + s = 512; + const dft_size_idx_t dftsizeidx = get_dft(s); if (no_prefix) { subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1); slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2); @@ -231,38 +203,11 @@ int front_end_fft(PHY_VARS_UE *ue, unsigned char harq_pid = dlsch_ue[0]->current_harq_pid; LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; int uespec_pilot[9][1200];*/ - dft_size_idx_t dftsizeidx; int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsizeidx = DFT_128; - break; - - case 256: - dftsizeidx = DFT_256; - break; - - case 512: - dftsizeidx = DFT_512; - break; - - case 1024: - dftsizeidx = DFT_1024; - break; - - case 1536: - dftsizeidx = DFT_1536; - break; - - case 2048: - dftsizeidx = DFT_2048; - break; - - default: - dftsizeidx = DFT_512; - break; - } + int s = frame_parms->ofdm_symbol_size; + if (s != 128 && s != 256 && s != 512 && s != 1024 && s != 1536 && s != 2048) + s = 512; + dft_size_idx_t dftsizeidx = get_dft(s); if (no_prefix) { subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1); diff --git a/openair1/PHY/MODULATION/slot_fep_mbsfn.c b/openair1/PHY/MODULATION/slot_fep_mbsfn.c index ae62cc8e9bdb963860309441854e9bd5cec53800..fa3421959387a2ba9b8db8527450a38ad31dffa5 100644 --- a/openair1/PHY/MODULATION/slot_fep_mbsfn.c +++ b/openair1/PHY/MODULATION/slot_fep_mbsfn.c @@ -42,38 +42,10 @@ int slot_fep_mbsfn(PHY_VARS_UE *ue, unsigned int subframe_offset; // int i; unsigned int frame_length_samples = frame_parms->samples_per_tti * 10; - dft_size_idx_t dftsizeidx; - - switch (frame_parms->ofdm_symbol_size) { - case 128: - dftsizeidx = DFT_128; - break; - - case 256: - dftsizeidx = DFT_256; - break; - - case 512: - dftsizeidx = DFT_512; - break; - - case 1024: - dftsizeidx = DFT_1024; - break; - - case 1536: - dftsizeidx = DFT_1536; - break; - - case 2048: - dftsizeidx = DFT_2048; - break; - - default: - dftsizeidx = DFT_512; - break; - } - + int s = frame_parms->ofdm_symbol_size; + if (s != 128 && s != 256 && s != 512 && s != 1024 && s != 1536 && s != 2048) + s = 512; + dft_size_idx_t dftsizeidx = get_dft(s); if (no_prefix) { subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * subframe; } else { @@ -200,52 +172,44 @@ int slot_fep_mbsfn_khz_1dot25(PHY_VARS_UE *ue, int ofdm_symbol_size; unsigned int subframe_offset; unsigned int frame_length_samples = frame_parms->samples_per_tti * 10; - dft_size_idx_t dftsizeidx; AssertFatal(frame_parms->frame_type == FDD, "Frame is TDD!\n"); switch (frame_parms->ofdm_symbol_size) { case 128: - dftsizeidx = DFT_1536; ofdm_symbol_size=1536; nb_prefix_samples=384; break; case 256: - AssertFatal(1==0,"FeMBMS dft3072 not implemented\n"); - dftsizeidx = DFT_3072; + AssertFatal(1 == 0, "FeMBMS dft3072 not implemented\n"); ofdm_symbol_size=3072; nb_prefix_samples=768; break; case 512: - dftsizeidx = DFT_6144; - nb_prefix_samples=1536; ofdm_symbol_size=6144; + nb_prefix_samples = 1536; break; case 1024: - dftsizeidx = DFT_12288; - nb_prefix_samples=3072; ofdm_symbol_size=12288; + nb_prefix_samples = 3072; break; case 1536: - dftsizeidx = DFT_18432; - nb_prefix_samples=4608; ofdm_symbol_size=18432; + nb_prefix_samples = 4608; break; case 2048: - dftsizeidx = DFT_24576; - nb_prefix_samples=6144; ofdm_symbol_size=24576; + nb_prefix_samples = 6144; break; default: AssertFatal(1==0,"Illegal ofdm symbol size %d\n",frame_parms->ofdm_symbol_size); break; } - subframe_offset = frame_parms->samples_per_tti * subframe; #ifdef DEBUG_FEP LOG_D(PHY,"slot_fep_mbsfn125: subframe %d, nb_prefix_samples %d, subframe_offset %d, sample_offset %d\n", subframe, nb_prefix_samples,subframe_offset, @@ -255,7 +219,7 @@ int slot_fep_mbsfn_khz_1dot25(PHY_VARS_UE *ue, for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][0],0,ofdm_symbol_size*sizeof(int)); start_UE_TIMING(ue->rx_dft_stats); - dft(dftsizeidx,(int16_t *)&common_vars->rxdata[aa][(sample_offset + + dft(get_dft(ofdm_symbol_size),(int16_t *)&common_vars->rxdata[aa][(sample_offset + nb_prefix_samples + subframe_offset - SOFFSET) % frame_length_samples], diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c index ccb7ee5f3e405ede1709e7ecfcac9b532f7ed533..51c215fe4656266a8b47239b5c7ebcf395f54fb3 100644 --- a/openair1/PHY/MODULATION/slot_fep_ul.c +++ b/openair1/PHY/MODULATION/slot_fep_ul.c @@ -43,42 +43,13 @@ int slot_fep_ul(RU_t *ru, // unsigned int subframe_offset; unsigned int slot_offset; - - dft_size_idx_t dftsize; - int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs unsigned int frame_length_samples = fp->samples_per_tti * 10; unsigned int rx_offset; - - switch (fp->ofdm_symbol_size) { - case 128: - dftsize = DFT_128; - break; - - case 256: - dftsize = DFT_256; - break; - - case 512: - dftsize = DFT_512; - break; - - case 1024: - dftsize = DFT_1024; - break; - - case 1536: - dftsize = DFT_1536; - break; - - case 2048: - dftsize = DFT_2048; - break; - - default: - dftsize = DFT_512; - break; - } + int s = fp->ofdm_symbol_size; + if (s != 128 && s != 256 && s != 512 && s != 1024 && s != 1536 && s != 2048) + s = 512; + const dft_size_idx_t dftsize = get_dft(s); if (no_prefix) { // subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index e29e3e7b51415fb24f7e71456eee957282e6cda5..82407980feb113f38f5a4fdf0420969cca400fd6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -32,233 +32,21 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH) for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) ((uint32_t*)idft_in0)[ip+0] = z[i]; } - + dft_size_idx_t dftsize = get_dft(Msc_PUSCH); switch (Msc_PUSCH) { case 12: - dft(DFT_12,(int16_t *)idft_in0, (int16_t *)idft_out0,0); + dft(dftsize, (int16_t *)idft_in0, (int16_t *)idft_out0, 0); norm128 = simde_mm_set1_epi16(9459); for (i = 0; i < 12; i++) { - ((simde__m128i*)idft_out0)[i] = simde_mm_slli_epi16(simde_mm_mulhi_epi16(((simde__m128i*)idft_out0)[i], norm128), 1); + ((simde__m128i *)idft_out0)[i] = simde_mm_slli_epi16(simde_mm_mulhi_epi16(((simde__m128i *)idft_out0)[i], norm128), 1); } break; - - case 24: - dft(DFT_24,idft_in0, idft_out0, 1); - break; - - case 36: - dft(DFT_36,idft_in0, idft_out0, 1); - break; - - case 48: - dft(DFT_48,idft_in0, idft_out0, 1); - break; - - case 60: - dft(DFT_60,idft_in0, idft_out0, 1); - break; - - case 72: - dft(DFT_72,idft_in0, idft_out0, 1); - break; - - case 96: - dft(DFT_96,idft_in0, idft_out0, 1); - break; - - case 108: - dft(DFT_108,idft_in0, idft_out0, 1); - break; - - case 120: - dft(DFT_120,idft_in0, idft_out0, 1); - break; - - case 144: - dft(DFT_144,idft_in0, idft_out0, 1); - break; - - case 180: - dft(DFT_180,idft_in0, idft_out0, 1); - break; - - case 192: - dft(DFT_192,idft_in0, idft_out0, 1); - break; - - case 216: - dft(DFT_216,idft_in0, idft_out0, 1); - break; - - case 240: - dft(DFT_240,idft_in0, idft_out0, 1); - break; - - case 288: - dft(DFT_288,idft_in0, idft_out0, 1); - break; - - case 300: - dft(DFT_300,idft_in0, idft_out0, 1); - break; - - case 324: - dft(DFT_324,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 360: - dft(DFT_360,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 384: - dft(DFT_384,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 432: - dft(DFT_432,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 480: - dft(DFT_480,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 540: - dft(DFT_540,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 576: - dft(DFT_576,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 600: - dft(DFT_600,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 648: - dft(DFT_648,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 720: - dft(DFT_720,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 768: - dft(DFT_768,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 864: - dft(DFT_864,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 900: - dft(DFT_900,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 960: - dft(DFT_960,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 972: - dft(DFT_972,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1080: - dft(DFT_1080,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1152: - dft(DFT_1152,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1200: - dft(DFT_1200,idft_in0, idft_out0, 1); - break; - - case 1296: - dft(DFT_1296,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1440: - dft(DFT_1440,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1500: - dft(DFT_1500,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1536: - //dft(DFT_1536,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - idft(IDFT_1536,(int16_t*)z, (int16_t*)z, 1); - break; - - case 1620: - dft(DFT_1620,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1728: - dft(DFT_1728,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1800: - dft(DFT_1800,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1920: - dft(DFT_1920,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 1944: - dft(DFT_1944,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2160: - dft(DFT_2160,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2304: - dft(DFT_2304,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2400: - dft(DFT_2400,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2592: - dft(DFT_2592,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2700: - dft(DFT_2700,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2880: - dft(DFT_2880,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 2916: - dft(DFT_2916,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 3000: - dft(DFT_3000,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - - case 3072: - //dft(DFT_3072,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - idft(IDFT_3072,(int16_t*)z, (int16_t*)z, 1); - break; - - case 3240: - dft(DFT_3240,(int16_t*)idft_in0, (int16_t*)idft_out0, 1); - break; - default: - // should not be reached - LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH ); - return; + dft(dftsize, idft_in0, idft_out0, 1); + break; } if ((Msc_PUSCH % 1536) > 0) { @@ -270,10 +58,6 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH) ((simde__m128i*)z)[i] = simde_mm_sign_epi16(((simde__m128i*)z)[i], *(simde__m128i*)&conjugate2[0]); } } - - simde_mm_empty(); - simde_m_empty(); - } static void nr_ulsch_extract_rbs(c16_t* const rxdataF, diff --git a/openair1/PHY/TOOLS/dfts_load.c b/openair1/PHY/TOOLS/dfts_load.c index ec8869b54fdd89e798c82eef5ba4e0497bd8048c..2e4ddb595fe5796f8d484d3baec978ea5089f9d9 100644 --- a/openair1/PHY/TOOLS/dfts_load.c +++ b/openair1/PHY/TOOLS/dfts_load.c @@ -44,6 +44,8 @@ /* function description array, to be used when loading the dfts/idfts lib */ static loader_shlibfunc_t shlib_fdesc[2]; static char *arg[64] = {"phytest", "-O", "cmdlineonly::dbgl0"}; +dftfunc_t dft; +idftfunc_t idft; int load_dftslib(void) { char *ptr = (char *)config_get_if(); @@ -51,8 +53,8 @@ int load_dftslib(void) uniqCfg = load_configmodule(3, (char **)arg, CONFIG_ENABLECMDLINEONLY); logInit(); } - shlib_fdesc[0].fname = "dft"; - shlib_fdesc[1].fname = "idft"; + shlib_fdesc[0].fname = "dft_implementation"; + shlib_fdesc[1].fname = "idft_implementation"; int ret = load_module_shlib("dfts", shlib_fdesc, sizeof(shlib_fdesc) / sizeof(loader_shlibfunc_t), NULL); AssertFatal((ret >= 0), "Error loading dftsc decoder"); dft = (dftfunc_t)shlib_fdesc[0].fptr; diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index e97913633f3a37c3fc768859119165458582d2ce..dcb206b5a40e3f2adb0f8fbcfa5d4611c1c19882 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -1268,17 +1268,16 @@ __attribute__((always_inline)) static inline void dft16_simd256(int16_t *x, int1 x02t = simde_mm256_adds_epi16(xtmp0,xtmp2); x13t = simde_mm256_adds_epi16(xtmp1,xtmp3); - ytmp0 = simde_mm256_adds_epi16(x02t,x13t); - ytmp2 = simde_mm256_subs_epi16(x02t,x13t); + ytmp0 = simde_mm256_srai_epi16(simde_mm256_adds_epi16(x02t, x13t), 2); + ytmp2 = simde_mm256_srai_epi16(simde_mm256_subs_epi16(x02t, x13t), 2); x1_flip = simde_mm256_sign_epi16(xtmp1, *(simde__m256i *)conjugatedft); x1_flip = simde_mm256_shuffle_epi8(x1_flip,complex_shuffle); x3_flip = simde_mm256_sign_epi16(xtmp3, *(simde__m256i *)conjugatedft); x3_flip = simde_mm256_shuffle_epi8(x3_flip,complex_shuffle); x02t = simde_mm256_subs_epi16(xtmp0,xtmp2); x13t = simde_mm256_subs_epi16(x1_flip,x3_flip); - ytmp1 = simde_mm256_adds_epi16(x02t,x13t); // x0 + x1f - x2 - x3f - ytmp3 = simde_mm256_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f - + ytmp1 = simde_mm256_srai_epi16(simde_mm256_adds_epi16(x02t, x13t), 2); // x0 + x1f - x2 - x3f + ytmp3 = simde_mm256_srai_epi16(simde_mm256_subs_epi16(x02t, x13t), 2); // x0 - x1f - x2 + x3f // [y0 y1 y2 y3 y16 y17 y18 y19] // [y4 y5 y6 y7 y20 y21 y22 y23] @@ -1652,14 +1651,14 @@ void dft64(int16_t *x,int16_t *y,unsigned char scale) if (scale>0) { - y256[0] = shiftright_int16_simd256(y256[0],3); - y256[1] = shiftright_int16_simd256(y256[1],3); - y256[2] = shiftright_int16_simd256(y256[2],3); - y256[3] = shiftright_int16_simd256(y256[3],3); - y256[4] = shiftright_int16_simd256(y256[4],3); - y256[5] = shiftright_int16_simd256(y256[5],3); - y256[6] = shiftright_int16_simd256(y256[6],3); - y256[7] = shiftright_int16_simd256(y256[7],3); + y256[0] = shiftright_int16_simd256(y256[0], 1); + y256[1] = shiftright_int16_simd256(y256[1], 1); + y256[2] = shiftright_int16_simd256(y256[2], 1); + y256[3] = shiftright_int16_simd256(y256[3], 1); + y256[4] = shiftright_int16_simd256(y256[4], 1); + y256[5] = shiftright_int16_simd256(y256[5], 1); + y256[6] = shiftright_int16_simd256(y256[6], 1); + y256[7] = shiftright_int16_simd256(y256[7], 1); } simde_mm_empty(); @@ -3595,19 +3594,6 @@ void dft6144(int16_t *input, int16_t *output,unsigned char scale) simde_m_empty(); } -int16_t twa9216[6144] __attribute__((aligned(32))); -int16_t twb9216[6144] __attribute__((aligned(32))); -// 3072 x 3 -void dft9216(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - -void idft9216(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - int16_t twa12288[8192] __attribute__((aligned(32))); int16_t twb12288[8192] __attribute__((aligned(32))); // 4096 x 3 @@ -4234,20 +4220,6 @@ void idft65536(int16_t *x,int16_t *y,unsigned char scale) simde_m_empty(); } -int16_t twa73728[49152] __attribute__((aligned(32))); -int16_t twb73728[49152] __attribute__((aligned(32))); -// 24576 x 3 -void dft73728(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - -void idft73728(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - - int16_t twa98304[65536] __attribute__((aligned(32))); int16_t twb98304[65536] __attribute__((aligned(32))); // 32768 x 3 @@ -4562,43 +4534,41 @@ __attribute__((always_inline)) static inline void dft12f_simd256(simd256_q15_t * simd256_q15_t tmp_dft12[12]; - simd256_q15_t *tmp_dft12_ptr = &tmp_dft12[0]; - // msg("dft12\n"); bfly4_tw1_256(x0, x3, x6, x9, - tmp_dft12_ptr, - tmp_dft12_ptr+3, - tmp_dft12_ptr+6, - tmp_dft12_ptr+9); + tmp_dft12, + tmp_dft12+3, + tmp_dft12+6, + tmp_dft12+9); bfly4_tw1_256(x1, x4, x7, x10, - tmp_dft12_ptr+1, - tmp_dft12_ptr+4, - tmp_dft12_ptr+7, - tmp_dft12_ptr+10); + tmp_dft12+1, + tmp_dft12+4, + tmp_dft12+7, + tmp_dft12+10); bfly4_tw1_256(x2, x5, x8, x11, - tmp_dft12_ptr+2, - tmp_dft12_ptr+5, - tmp_dft12_ptr+8, - tmp_dft12_ptr+11); + tmp_dft12+2, + tmp_dft12+5, + tmp_dft12+8, + tmp_dft12+11); // k2=0; - bfly3_tw1_256(tmp_dft12_ptr, - tmp_dft12_ptr+1, - tmp_dft12_ptr+2, + bfly3_tw1_256(tmp_dft12, + tmp_dft12+1, + tmp_dft12+2, y0, y4, y8); @@ -4606,9 +4576,9 @@ __attribute__((always_inline)) static inline void dft12f_simd256(simd256_q15_t * // k2=1; - bfly3_256(tmp_dft12_ptr+3, - tmp_dft12_ptr+4, - tmp_dft12_ptr+5, + bfly3_256(tmp_dft12+3, + tmp_dft12+4, + tmp_dft12+5, y1, y5, y9, @@ -4618,9 +4588,9 @@ __attribute__((always_inline)) static inline void dft12f_simd256(simd256_q15_t * // k2=2; - bfly3_256(tmp_dft12_ptr+6, - tmp_dft12_ptr+7, - tmp_dft12_ptr+8, + bfly3_256(tmp_dft12+6, + tmp_dft12+7, + tmp_dft12+8, y2, y6, y10, @@ -4628,9 +4598,9 @@ __attribute__((always_inline)) static inline void dft12f_simd256(simd256_q15_t * W4_12_256); // k2=3; - bfly3_256(tmp_dft12_ptr+9, - tmp_dft12_ptr+10, - tmp_dft12_ptr+11, + bfly3_256(tmp_dft12+9, + tmp_dft12+10, + tmp_dft12+11, y3, y7, y11, @@ -7908,8 +7878,9 @@ int dfts_autoinit(void) #ifndef MR_MAIN -void dft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_flag){ - AssertFatal((sizeidx >= 0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx); +void dft_implementation(uint8_t sizeidx, int16_t *input, int16_t *output, unsigned char scale_flag) +{ + AssertFatal((sizeidx >= 0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx); int algn=0xF; if ( (dft_ftab[sizeidx].size%3) != 0 ) // there is no AVX2 implementation for multiples of 3 DFTs algn=0x1F; @@ -7926,8 +7897,9 @@ void dft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_fla dft_ftab[sizeidx].func(input,output,scale_flag); }; -void idft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_flag){ - AssertFatal((sizeidx>=0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid idft size index %i\n",sizeidx); +void idft_implementation(uint8_t sizeidx, int16_t *input, int16_t *output, unsigned char scale_flag) +{ + AssertFatal((sizeidx>=0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid idft size index %i\n",sizeidx); int algn=0xF; algn=0x1F; AssertFatal( ((intptr_t)output&algn)==0,"Buffers should be 16 bytes aligned %p",output); diff --git a/openair1/PHY/TOOLS/oai_dfts_neon.c b/openair1/PHY/TOOLS/oai_dfts_neon.c index b920f6aae43574da8b607312e0e853ddb499500c..f3a2e5cb46a0bb264a7b6ee0410dfe00cb2ced45 100644 --- a/openair1/PHY/TOOLS/oai_dfts_neon.c +++ b/openair1/PHY/TOOLS/oai_dfts_neon.c @@ -3029,19 +3029,6 @@ void dft6144(int16_t *input, int16_t *output,unsigned char scale) } } -int16_t twa9216[6144] __attribute__((aligned(32))); -int16_t twb9216[6144] __attribute__((aligned(32))); -// 3072 x 3 -void dft9216(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - -void idft9216(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - int16_t twa12288[8192] __attribute__((aligned(32))); int16_t twb12288[8192] __attribute__((aligned(32))); // 4096 x 3 @@ -3649,19 +3636,6 @@ void idft65536(int16_t *x,int16_t *y,unsigned char scale) simde_mm_empty(); simde_m_empty(); } -int16_t twa73728[49152] __attribute__((aligned(32))); -int16_t twb73728[49152] __attribute__((aligned(32))); -// 24576 x 3 -void dft73728(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - -void idft73728(int16_t *input, int16_t *output,uint8_t scale) { - - AssertFatal(1==0,"Need to do this ..\n"); -} - int16_t twa98304[65536] __attribute__((aligned(32))); int16_t twb98304[65536] __attribute__((aligned(32))); @@ -7125,8 +7099,9 @@ int dfts_autoinit(void) #ifndef MR_MAIN -void dft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_flag){ - AssertFatal((sizeidx >= 0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx); +void dft_implementation(uint8_t sizeidx, int16_t *input, int16_t *output, unsigned char scale_flag) +{ + AssertFatal((sizeidx >= 0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx); int algn=0xF; AssertFatal(((intptr_t)output&algn)==0,"Buffers should be aligned %p",output); if (((intptr_t)input)&algn) { @@ -7141,8 +7116,9 @@ void dft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_fla dft_ftab[sizeidx].func(input,output,scale_flag); }; -void idft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_flag){ - AssertFatal((sizeidx>=0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid idft size index %i\n",sizeidx); +void idft_implementation(uint8_t sizeidx, int16_t *input, int16_t *output, unsigned char scale_flag) +{ + AssertFatal((sizeidx>=0 && sizeidx<DFT_SIZE_IDXTABLESIZE),"Invalid idft size index %i\n",sizeidx); int algn=0xF; AssertFatal( ((intptr_t)output&algn)==0,"Buffers should be 16 bytes aligned %p",output); if (((intptr_t)input)&algn ) { diff --git a/openair1/PHY/TOOLS/tests/CMakeLists.txt b/openair1/PHY/TOOLS/tests/CMakeLists.txt index 2b846a8cd3bd0a53a7e43ec7c299491c885f9008..9480af781f36199f936cbd118cb5d88eb2ab6ce2 100644 --- a/openair1/PHY/TOOLS/tests/CMakeLists.txt +++ b/openair1/PHY/TOOLS/tests/CMakeLists.txt @@ -15,3 +15,9 @@ target_link_libraries(test_log2_approx PRIVATE GTest::gtest LOG minimal_lib) add_dependencies(tests test_log2_approx) add_test(NAME test_log2_approx COMMAND ./test_log2_approx --gtest_filter=-log2_approx.complete) + +add_executable(dft_test test_dft.c ../dfts_load.c) +target_link_libraries(dft_test minimal_lib shlib_loader SIMU m) +add_dependencies(tests dft_test) +add_dependencies(dft_test dfts) # trigger build of dfts (shared lib for DFT) +add_test(NAME dft_test COMMAND ./dft_test) diff --git a/openair1/PHY/TOOLS/tests/test_dft.c b/openair1/PHY/TOOLS/tests/test_dft.c new file mode 100644 index 0000000000000000000000000000000000000000..8b4c344c6c153e9ea2f2edc6ddb223d8aafc701d --- /dev/null +++ b/openair1/PHY/TOOLS/tests/test_dft.c @@ -0,0 +1,138 @@ +#include <stdio.h> +#include <math.h> +#include "openair1/PHY/TOOLS/tools_defs.h" +#include "openair1/SIMULATION/TOOLS/sim.h" +#include "common/utils/utils.h" + +// should be FOREACH_DFTSZ but we restrict to tested DFT sizes +#define FOREACH_DFTSZ_working(SZ_DEF) \ + SZ_DEF(12) \ + SZ_DEF(64) \ + SZ_DEF(128) \ + SZ_DEF(256) \ + SZ_DEF(512) \ + SZ_DEF(768) \ + SZ_DEF(1024) \ + SZ_DEF(1536) \ + SZ_DEF(2048) \ + SZ_DEF(4096) \ + SZ_DEF(6144) \ + SZ_DEF(8192) \ + SZ_DEF(12288) + +#define SZ_PTR(Sz) {Sz}, +struct { + int size; +} const dftFtab[] = {FOREACH_DFTSZ_working(SZ_PTR)}; + +#define SZ_iPTR(Sz) {Sz}, +struct { + int size; +} const idftFtab[] = {FOREACH_IDFTSZ(SZ_iPTR)}; + +bool error(c16_t v16, cd_t vd, double percent) +{ + cd_t err = {abs(v16.r - vd.r), abs(v16.i - vd.i)}; + if (err.r < 10 && err.i < 10) + return false; // ignore quantization noise + int denomr = min(abs(v16.r), abs(vd.r)); + if (denomr && err.r / denomr > percent / 100) + return true; + int denomi = min(abs(v16.i), abs(vd.i)); + if (denomi && err.i / denomi > percent / 100) + return true; + return false; +} + +void math_dft(cd_t *in, cd_t *out, int len) +{ + for (int k = 0; k < len; k++) { + cd_t tmp = {0}; + // wrote this way to help gcc to generate SIMD + double phi[len], sint[len], cost[len]; + for (int n = 0; n < len; n++) + phi[n] = -2 * M_PI * ((double)k / len) * n; + for (int n = 0; n < len; n++) + sint[n] = sin(phi[n]); + for (int n = 0; n < len; n++) + cost[n] = cos(phi[n]); + for (int n = 0; n < len; n++) { + cd_t coeff = {.r = cost[n], .i = sint[n]}; + cd_t component = cdMul(coeff, in[n]); + tmp.r += component.r; + tmp.i += component.i; + } + out[k].r = tmp.r / sqrt(len); + out[k].i = tmp.i / sqrt(len); + } +} + +int main(void) +{ + int ret = 0; + load_dftslib(); + c16_t *d16 = malloc16(12 * dftFtab[sizeofArray(dftFtab) - 1].size * sizeof(*d16)); + c16_t *o16 = malloc16(12 * dftFtab[sizeofArray(dftFtab) - 1].size * sizeof(*d16)); + for (int sz = 0; sz < sizeofArray(dftFtab); sz++) { + const int n = dftFtab[sz].size; + cd_t data[n]; + double coeffs[] = {0.25, 0.5, 1, 1.5, 2, 2.5, 3}; + cd_t out[n]; + for (int i = 0; i < n; i++) { + data[i].r = gaussZiggurat(0, 1.0); // gaussZiggurat not used paramters, to fix + data[i].i = gaussZiggurat(0, 1.0); + } + math_dft(data, out, n); + double evm[sizeofArray(coeffs)] = {0}; + double samples[sizeofArray(coeffs)] = {0}; + for (int coeff = 0; coeff < sizeofArray(coeffs); coeff++) { + double expand = coeffs[coeff] * SHRT_MAX / sqrt(n); + if (n == 12) { + for (int i = 0; i < n; i++) + for (int j = 0; j < 4; j++) { + d16[i * 4 + j].r = expand * data[i].r; + d16[i * 4 + j].i = expand * data[i].i; + } + } else { + for (int i = 0; i < n; i++) { + d16[i].r = expand * data[i].r; + d16[i].i = expand * data[i].i; + } + } + dft(get_dft(n), (int16_t *)d16, (int16_t *)o16, 1); + if (n == 12) { + for (int i = 0; i < n; i++) { + cd_t error = {.r = o16[i * 4].r / (expand * sqrt(n)) - out[i].r, .i = o16[i * 4].i / (expand * sqrt(n)) - out[i].i}; + evm[coeff] += sqrt(squaredMod(error)) / sqrt(squaredMod(out[i])); + samples[coeff] += sqrt(squaredMod(d16[i])); + } + } else { + for (int i = 0; i < n; i++) { + cd_t error = {.r = o16[i].r / expand - out[i].r, .i = o16[i].i / expand - out[i].i}; + evm[coeff] += sqrt(squaredMod(error)) / sqrt(squaredMod(out[i])); + samples[coeff] += sqrt(squaredMod(d16[i])); + /* + if (error(o16[i], out[i], 5)) + printf("Error in dft %d at %d, (%d, %d) != %f, %f)\n", n, i, o16[i].r, o16[i].i, gslout[i].r, gslout[i].i); + */ + } + } + } + printf("done DFT size %d (evm (%%), avg samples amplitude) = ", n); + for (int coeff = 0; coeff < sizeofArray(coeffs); coeff++) + printf("(%.2f, %.0f) ", (evm[coeff] / n) * 100, samples[coeff] / n); + printf("\n"); + int i; + for (i = 0; i < sizeofArray(coeffs); i++) + if (evm[i] / n < 0.01) + break; + if (i == sizeofArray(coeffs)) { + printf("DFT size: %d, minimum error is more than 1%%, setting the test as failed\n", n); + ret = 1; + } + fflush(stdout); + } + free(d16); + free(o16); + return ret; +} diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index d1ed050f6fedbb9814acdf9ab041ccc238d64147..58af33020aa2d58f385372abaf8c2c24996da8b7 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -431,136 +431,110 @@ void init_fft(uint16_t size, uint16_t *rev); #define FOREACH_DFTSZ(SZ_DEF) \ - SZ_DEF(12) \ - SZ_DEF(24) \ - SZ_DEF(36) \ - SZ_DEF(48) \ - SZ_DEF(60) \ - SZ_DEF(64) \ - SZ_DEF(72) \ - SZ_DEF(96) \ - SZ_DEF(108) \ - SZ_DEF(120) \ - SZ_DEF(128) \ - SZ_DEF(144) \ - SZ_DEF(180) \ - SZ_DEF(192) \ - SZ_DEF(216) \ - SZ_DEF(240) \ - SZ_DEF(256) \ - SZ_DEF(288) \ - SZ_DEF(300) \ - SZ_DEF(324) \ - SZ_DEF(360) \ - SZ_DEF(384) \ - SZ_DEF(432) \ - SZ_DEF(480) \ - SZ_DEF(512) \ - SZ_DEF(540) \ - SZ_DEF(576) \ - SZ_DEF(600) \ - SZ_DEF(648) \ - SZ_DEF(720) \ - SZ_DEF(768) \ - SZ_DEF(864) \ - SZ_DEF(900) \ - SZ_DEF(960) \ - SZ_DEF(972) \ - SZ_DEF(1024) \ - SZ_DEF(1080) \ - SZ_DEF(1152) \ - SZ_DEF(1200) \ - SZ_DEF(1296) \ - SZ_DEF(1440) \ - SZ_DEF(1500) \ - SZ_DEF(1536) \ - SZ_DEF(1620) \ - SZ_DEF(1728) \ - SZ_DEF(1800) \ - SZ_DEF(1920) \ - SZ_DEF(1944) \ - SZ_DEF(2048) \ - SZ_DEF(2160) \ - SZ_DEF(2304) \ - SZ_DEF(2400) \ - SZ_DEF(2592) \ - SZ_DEF(2700) \ - SZ_DEF(2880) \ - SZ_DEF(2916) \ - SZ_DEF(3000) \ - SZ_DEF(3072) \ - SZ_DEF(3240) \ - SZ_DEF(4096) \ - SZ_DEF(6144) \ - SZ_DEF(8192) \ - SZ_DEF(9216) \ - SZ_DEF(12288) \ - SZ_DEF(18432) \ - SZ_DEF(24576) \ - SZ_DEF(36864) \ - SZ_DEF(49152) \ - SZ_DEF(73728) \ + SZ_DEF(12) \ + SZ_DEF(24) \ + SZ_DEF(36) \ + SZ_DEF(48) \ + SZ_DEF(60) \ + SZ_DEF(64) \ + SZ_DEF(72) \ + SZ_DEF(96) \ + SZ_DEF(108) \ + SZ_DEF(120) \ + SZ_DEF(128) \ + SZ_DEF(144) \ + SZ_DEF(180) \ + SZ_DEF(192) \ + SZ_DEF(216) \ + SZ_DEF(240) \ + SZ_DEF(256) \ + SZ_DEF(288) \ + SZ_DEF(300) \ + SZ_DEF(324) \ + SZ_DEF(360) \ + SZ_DEF(384) \ + SZ_DEF(432) \ + SZ_DEF(480) \ + SZ_DEF(512) \ + SZ_DEF(540) \ + SZ_DEF(576) \ + SZ_DEF(600) \ + SZ_DEF(648) \ + SZ_DEF(720) \ + SZ_DEF(768) \ + SZ_DEF(864) \ + SZ_DEF(900) \ + SZ_DEF(960) \ + SZ_DEF(972) \ + SZ_DEF(1024) \ + SZ_DEF(1080) \ + SZ_DEF(1152) \ + SZ_DEF(1200) \ + SZ_DEF(1296) \ + SZ_DEF(1440) \ + SZ_DEF(1500) \ + SZ_DEF(1536) \ + SZ_DEF(1620) \ + SZ_DEF(1728) \ + SZ_DEF(1800) \ + SZ_DEF(1920) \ + SZ_DEF(1944) \ + SZ_DEF(2048) \ + SZ_DEF(2160) \ + SZ_DEF(2304) \ + SZ_DEF(2400) \ + SZ_DEF(2592) \ + SZ_DEF(2700) \ + SZ_DEF(2880) \ + SZ_DEF(2916) \ + SZ_DEF(3000) \ + SZ_DEF(3072) \ + SZ_DEF(3240) \ + SZ_DEF(4096) \ + SZ_DEF(6144) \ + SZ_DEF(8192) \ + SZ_DEF(12288) \ + SZ_DEF(18432) \ + SZ_DEF(24576) \ + SZ_DEF(36864) \ + SZ_DEF(49152) \ SZ_DEF(98304) -#define FOREACH_IDFTSZ(SZ_DEF)\ - SZ_DEF(64) \ - SZ_DEF(128) \ - SZ_DEF(256) \ - SZ_DEF(512) \ - SZ_DEF(768) \ - SZ_DEF(1024) \ - SZ_DEF(1536) \ - SZ_DEF(2048) \ - SZ_DEF(3072) \ - SZ_DEF(4096) \ - SZ_DEF(6144) \ - SZ_DEF(8192) \ - SZ_DEF(9216) \ - SZ_DEF(12288) \ - SZ_DEF(16384) \ - SZ_DEF(18432) \ - SZ_DEF(24576) \ - SZ_DEF(32768) \ - SZ_DEF(36864) \ - SZ_DEF(49152) \ - SZ_DEF(65536) \ - SZ_DEF(73728) \ +#define FOREACH_IDFTSZ(SZ_DEF) \ + SZ_DEF(64) \ + SZ_DEF(128) \ + SZ_DEF(256) \ + SZ_DEF(512) \ + SZ_DEF(768) \ + SZ_DEF(1024) \ + SZ_DEF(1536) \ + SZ_DEF(2048) \ + SZ_DEF(3072) \ + SZ_DEF(4096) \ + SZ_DEF(6144) \ + SZ_DEF(8192) \ + SZ_DEF(12288) \ + SZ_DEF(16384) \ + SZ_DEF(18432) \ + SZ_DEF(24576) \ + SZ_DEF(32768) \ + SZ_DEF(36864) \ + SZ_DEF(49152) \ + SZ_DEF(65536) \ SZ_DEF(98304) -#ifdef OAIDFTS_MAIN -typedef void(*adftfunc_t)(int16_t *sigF,int16_t *sig,unsigned char scale_flag); -typedef void(*aidftfunc_t)(int16_t *sigF,int16_t *sig,unsigned char scale_flag); - -#define SZ_FUNC(Sz) void dft ## Sz(int16_t *x,int16_t *y,uint8_t scale_flag); - -FOREACH_DFTSZ(SZ_FUNC) - -#define SZ_iFUNC(Sz) void idft ## Sz(int16_t *x,int16_t *y,uint8_t scale_flag); - -FOREACH_IDFTSZ(SZ_iFUNC) - -#else typedef void(*dftfunc_t)(uint8_t sizeidx,int16_t *sigF,int16_t *sig,unsigned char scale_flag); -typedef void(*idftfunc_t)(uint8_t sizeidx,int16_t *sigF,int16_t *sig,unsigned char scale_flag); -# ifdef OAIDFTS_LOADER -dftfunc_t dft; -idftfunc_t idft; -# else +typedef void (*idftfunc_t)(uint8_t sizeidx, int16_t *sigF, int16_t *sig, unsigned char scale_flag); extern dftfunc_t dft; extern idftfunc_t idft; -extern int load_dftslib(void); -# endif -#endif - -#define SZ_ENUM(Sz) DFT_ ## Sz, +int load_dftslib(void); +#define SZ_ENUM(Sz) DFT_##Sz, typedef enum dft_size_idx { FOREACH_DFTSZ(SZ_ENUM) DFT_SIZE_IDXTABLESIZE } dft_size_idx_t; -#define SZ_iENUM(Sz) IDFT_ ## Sz, - /******************************************************************* * * NAME : get_dft @@ -572,48 +546,15 @@ typedef enum dft_size_idx { * DESCRIPTION : get dft function depending of ofdm size * *********************************************************************/ +#define FIND_ENUM(Sz) \ + case Sz: \ + return DFT_##Sz; \ + break; static inline dft_size_idx_t get_dft(int ofdm_symbol_size) { switch (ofdm_symbol_size) { - case 128: - return DFT_128; - case 256: - return DFT_256; - case 512: - return DFT_512; - case 768: - return DFT_768; - case 1024: - return DFT_1024; - case 1536: - return DFT_1536; - case 2048: - return DFT_2048; - case 3072: - return DFT_3072; - case 4096: - return DFT_4096; - case 6144: - return DFT_6144; - case 8192: - return DFT_8192; - case 9216: - return DFT_9216; - case 12288: - return DFT_12288; - case 18432: - return DFT_18432; - case 24576: - return DFT_24576; - case 36864: - return DFT_36864; - case 49152: - return DFT_49152; - case 73728: - return DFT_73728; - case 98304: - return DFT_98304; + FOREACH_DFTSZ(FIND_ENUM) default: printf("function get_dft : unsupported ofdm symbol size \n"); assert(0); @@ -622,13 +563,23 @@ dft_size_idx_t get_dft(int ofdm_symbol_size) return DFT_SIZE_IDXTABLESIZE; // never reached and will trigger assertion in idft function; } +#define SZ_iENUM(Sz) IDFT_##Sz, typedef enum idft_size_idx { FOREACH_IDFTSZ(SZ_iENUM) IDFT_SIZE_IDXTABLESIZE } idft_size_idx_t; #ifdef OAIDFTS_MAIN +typedef void (*adftfunc_t)(int16_t *sigF, int16_t *sig, unsigned char scale_flag); +typedef void (*aidftfunc_t)(int16_t *sigF, int16_t *sig, unsigned char scale_flag); + +#define SZ_FUNC(Sz) void dft##Sz(int16_t *x, int16_t *y, uint8_t scale_flag); + +FOREACH_DFTSZ(SZ_FUNC) + +#define SZ_iFUNC(Sz) void idft##Sz(int16_t *x, int16_t *y, uint8_t scale_flag); +FOREACH_IDFTSZ(SZ_iFUNC) #define SZ_PTR(Sz) {dft ## Sz,Sz}, struct { adftfunc_t func; @@ -654,54 +605,16 @@ struct { * DESCRIPTION : get idft function depending of ofdm size * *********************************************************************/ +#define FIND_iENUM(iSz) \ + case iSz: \ + return IDFT_##iSz; \ + break; + static inline idft_size_idx_t get_idft(int ofdm_symbol_size) { switch (ofdm_symbol_size) { - case 128: - return IDFT_128; - case 256: - return IDFT_256; - case 512: - return IDFT_512; - case 768: - return IDFT_768; - case 1024: - return IDFT_1024; - case 1536: - return IDFT_1536; - case 2048: - return IDFT_2048; - case 3072: - return IDFT_3072; - case 4096: - return IDFT_4096; - case 6144: - return IDFT_6144; - case 8192: - return IDFT_8192; - case 9216: - return IDFT_9216; - case 12288: - return IDFT_12288; - case 16384: - return IDFT_16384; - case 18432: - return IDFT_18432; - case 24576: - return IDFT_24576; - case 32768: - return IDFT_32768; - case 36864: - return IDFT_36864; - case 49152: - return IDFT_49152; - case 65536: - return IDFT_65536; - case 73728: - return IDFT_73728; - case 98304: - return IDFT_98304; + FOREACH_IDFTSZ(FIND_iENUM) default: printf("function get_idft : unsupported ofdm symbol size \n"); assert(0); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index ff774d7789cec71c0c00d5fd3ef4bf76a4fde81e..cd3202eeb91b5e8a5615b6dcbf4d2b96ed959a9f 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -1050,16 +1050,17 @@ typedef uint8_t(encoder_if_t)(uint8_t *input, extern int oai_exit; -static inline void wait_sync(char *thread_name) { +static inline void wait_sync(char *thread_name) +{ int rc; - printf( "waiting for sync (%s,%d/%p,%p,%p)\n",thread_name,sync_var,&sync_var,&sync_cond,&sync_mutex); + LOG_D(PHY, "waiting for sync (%s,%d/%p,%p,%p)\n", thread_name, sync_var, &sync_var, &sync_cond, &sync_mutex); AssertFatal((rc = pthread_mutex_lock( &sync_mutex ))==0,"sync mutex lock error"); while (sync_var<0 && !oai_exit) pthread_cond_wait( &sync_cond, &sync_mutex ); AssertFatal((rc = pthread_mutex_unlock( &sync_mutex ))==0,"sync mutex unlock error"); - printf( "got sync (%s)\n", thread_name); + LOG_I(PHY, "got sync (%s)\n", thread_name); /* * Raphael Defosseux: added for CI to get faster the got sync message. */ diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 0e9d72d99d2b32250508213c5fe1f0359976f741..15208998ae53f8c553d4d4e58d719592d01b382f 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1339,9 +1339,20 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { ulsch_harq = ulsch->harq_processes[harq_pid]; - if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n", - i, harq_pid, frame,subframe,i,ulsch->rnti, - ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled); + if (ulsch->rnti > 0) + LOG_D(PHY, + "eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d " + "SFN/SF:%04d%d handled:%d]\n", + i, + harq_pid, + frame, + subframe, + i, + ulsch->rnti, + ulsch_harq->status, + ulsch_harq->frame, + ulsch_harq->subframe, + ulsch_harq->handled); if ((ulsch->rnti>0) && (ulsch_harq->status == ACTIVE) && diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 426b25638d984c4eeb72973f626ebe5073876925..280a39c371e7f0d34b47da5bfd560cab649717d0 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -153,7 +153,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres) && (pdu_index < MAX_NUM_NR_RX_RACH_PDUS)) { - LOG_I(NR_PHY, + LOG_A(NR_PHY, "[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol " "%u freq index %u\n", frame, diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 1b9bdefed610f37a266a0ce19d900225b4ec53a1..1f165380d4a7edcc2ddde19654df44fee548c2e9 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -2980,7 +2980,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; } else { ue->dlsch_mch_received[0]+=1; - ue->dlsch_mch_received_sf[subframe_rx][0]=1; + ue->dlsch_mch_received_sf[subframe_rx % 5][0] = 1; } } // decoding sucessful } // pmch_mcs>=0 diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 9f3f1760bd450ec84c2937bce2aea68281b4d74e..c0b1cbf5bb72676a3035867f2762b168bc728655 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -125,55 +125,6 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, return 0; } -void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, - int N_RB_DL, - int N_RB_UL, - int mu, - int Nid_cell, - uint64_t position_in_burst) -{ - NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - nfapi_nr_config_request_scf_t *gNB_config = &gNB->gNB_config; - //overwrite for new NR parameters - - uint64_t rev_burst=0; - for (int i=0; i<64; i++) - rev_burst |= (((position_in_burst>>(63-i))&0x01)<<i); - - gNB_config->cell_config.phy_cell_id.value = Nid_cell; - gNB_config->ssb_config.scs_common.value = mu; - gNB_config->ssb_table.ssb_subcarrier_offset.value = 0; - gNB_config->ssb_table.ssb_offset_point_a.value = (N_RB_DL-20)>>1; - gNB_config->ssb_table.ssb_mask_list[1].ssb_mask.value = (rev_burst)&(0xFFFFFFFF); - gNB_config->ssb_table.ssb_mask_list[0].ssb_mask.value = (rev_burst>>32)&(0xFFFFFFFF); - gNB_config->cell_config.frame_duplex_type.value = TDD; - gNB_config->ssb_table.ssb_period.value = 1; //10ms - gNB_config->carrier_config.dl_grid_size[mu].value = N_RB_DL; - gNB_config->carrier_config.ul_grid_size[mu].value = N_RB_UL; - gNB_config->carrier_config.num_tx_ant.value = fp->nb_antennas_tx; - gNB_config->carrier_config.num_rx_ant.value = fp->nb_antennas_rx; - - gNB_config->tdd_table.tdd_period.value = 0; - //gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED; - - fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); - fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); - if (mu>2) fp->nr_band = 257; - else fp->nr_band = 78; - fp->threequarter_fs= 0; - frequency_range_t frequency_range = fp->nr_band > 256 ? FR2 : FR1; - int bw_index = get_supported_band_index(mu, frequency_range, N_RB_DL); - gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); - - fp->ofdm_offset_divisor = UINT_MAX; - nr_init_frame_parms(gNB_config, fp); - init_timeshift_rotation(fp); - - init_symbol_rotation(fp); - - gNB->configured = 1; - LOG_I(PHY,"gNB configured\n"); -} configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv) { @@ -499,9 +450,14 @@ int main(int argc, char **argv) frame_parms->ssb_type = nr_ssb_type_C; frame_parms->freq_range = mu<2 ? FR1 : FR2; - nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions); + nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell, SSB_positions); gNB->gNB_config.tdd_table.tdd_period.value = 6; - set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); + if (mu == 0) + set_tdd_config_nr(&gNB->gNB_config, mu, 3, 6, 1, 4); + else if (mu == 1) + set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); + else if (mu == 3) + set_tdd_config_nr(&gNB->gNB_config, mu, 27, 6, 12, 4); phy_init_nr_gNB(gNB); frame_parms->ssb_start_subcarrier = 12 * gNB->gNB_config.ssb_table.ssb_offset_point_a.value + ssb_subcarrier_offset; initFloatingCoresTpool(ssb_scan_threads, &nrUE_params.Tpool, false, "UE-tpool"); @@ -511,40 +467,10 @@ int main(int argc, char **argv) double fs=0, eps; double scs = 30000; - double bw = 100e6; - - switch (mu) { - case 1: - scs = 30000; - frame_parms->Lmax = 8; - if (N_RB_DL == 217) { - fs = 122.88e6; - bw = 80e6; - } - else if (N_RB_DL == 245) { - fs = 122.88e6; - bw = 90e6; - } - else if (N_RB_DL == 273) { - fs = 122.88e6; - bw = 100e6; - } - else if (N_RB_DL == 106) { - fs = 61.44e6; - bw = 40e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - case 3: - frame_parms->Lmax = 64; - scs = 120000; - if (N_RB_DL == 66) { - fs = 122.88e6; - bw = 100e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - } + double txbw, rxbw; + uint32_t samples; + + get_samplerate_and_bw(mu, N_RB_DL, frame_parms->threequarter_fs, &fs, &samples, &txbw, &rxbw); // cfo with respect to sub-carrier spacing eps = cfo/scs; @@ -560,19 +486,7 @@ int main(int argc, char **argv) printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO); } - gNB2UE = new_channel_desc_scm(n_tx, - n_rx, - channel_model, - fs, - 0, - bw, - 300e-9, - 0.0, - CORR_LEVEL_LOW, - 0, - 0, - 0, - 0); + gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, 0, txbw, 300e-9, 0.0, CORR_LEVEL_LOW, 0, 0, 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 180b580916875087e6f2c5dddcfc52b2c996a91a..e4061f5c3dab623056110a88b5aee5d30f31eb1f 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -167,7 +167,7 @@ typedef struct as_stmsi_s { /* Dedicated NAS information */ typedef struct as_nas_info_s { uint32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ + Byte_t* nas_data; /* Dedicated NAS information data container */ } as_nas_info_t; /* Radio Access Bearer identity */ diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index 355b8b3e90840b44ecfe02a668bbb5b08132ff63..ef09d982842c84db2b56dc3c08c3f62215ad5633 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -57,26 +57,26 @@ MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigura MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req) // UE: NAS -> RRC messages -MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) -MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req) -MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req) -MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req) -MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, NasDetachReq, nas_detach_req) -MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, NasDeregistrationReq, nas_deregistration_req) +MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, kenb_refresh_req_t, nas_kenb_refresh_req) +MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, cell_info_req_t, nas_cell_selection_req) +MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, nas_establish_req_t, nas_conn_establi_req) +MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, ul_info_transfer_req_t, nas_ul_data_req) +MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, nas_detach_req_t, nas_detach_req) +MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, nas_deregistration_req_t, nas_deregistration_req) -MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp) +MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, rab_establish_rsp_t, nas_rab_est_rsp) -MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, NasOaiTunNsa, nas_oai_tun_nsa) +MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, nas_oai_tun_nsa_t, nas_oai_tun_nsa) // UE: RRC -> NAS messages -MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf) -MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelectionInd, nas_cell_selection_ind) -MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, NasPagingInd, nas_paging_ind) -MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, NasConnEstabCnf, nas_conn_establi_cnf) -MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NasConnReleaseInd, nas_conn_release_ind) +MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, cell_info_cnf_t, nas_cell_selection_cnf) +MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, cell_info_ind_t, nas_cell_selection_ind) +MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, paging_ind_t, nas_paging_ind) +MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, nas_establish_cnf_t, nas_conn_establi_cnf) +MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, nas_release_ind_t, nas_conn_release_ind) MESSAGE_DEF(NR_NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NRNasConnReleaseInd, nr_nas_conn_release_ind) -MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, NasUlDataCnf, nas_ul_data_cnf) -MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd, nas_dl_data_ind) +MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, ul_info_transfer_cnf_t, nas_ul_data_cnf) +MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t, nas_dl_data_ind) // xNB: realtime -> RRC messages MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ccc2d9f03081fbe976576bf689052c43b1710c32..15509b1807e8aee2d66ad171060dfa2d2087ed2b 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -422,28 +422,7 @@ typedef struct NRDuDlReq_s { rnti_t rnti; uint8_t *buf; uint64_t srb_id; -} NRDuDlReq_t; - -// UE: NAS -> RRC messages -typedef kenb_refresh_req_t NasKenbRefreshReq; -typedef cell_info_req_t NasCellSelectionReq; -typedef nas_establish_req_t NasConnEstabliReq; -typedef ul_info_transfer_req_t NasUlDataReq; -typedef nas_deregistration_req_t NasDeregistrationReq; -typedef nas_detach_req_t NasDetachReq; - -typedef rab_establish_rsp_t NasRabEstRsp; - -typedef nas_oai_tun_nsa_t NasOaiTunNsa; - -// UE: RRC -> NAS messages -typedef cell_info_cnf_t NasCellSelectionCnf; -typedef cell_info_ind_t NasCellSelectionInd; -typedef paging_ind_t NasPagingInd; -typedef nas_establish_cnf_t NasConnEstabCnf; -typedef nas_release_ind_t NasConnReleaseInd; -typedef ul_info_transfer_cnf_t NasUlDataCnf; -typedef dl_info_transfer_ind_t NasDlDataInd; +} NRDuDlReq_t; // eNB: realtime -> RRC messages typedef struct rrc_subframe_process_s { diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 0e7e25e2c0013fe8acce02b669f1d08f09535e77..49b53aa572962152729df04b4cf29b4d9c46daaa 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -72,23 +72,15 @@ uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const E for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { if(get_softmodem_params()->sa){ - ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse - // note: there is an implicit relationship between the data structure and the message name msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse RCconfig_NR_NG(msg_p, gnb_id); - ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse - - LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx); - itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); } } - LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); - register_gnb_pending++; } @@ -105,7 +97,6 @@ uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end) { for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, X2AP_REGISTER_ENB_REQ); - LOG_I(X2AP, "GNB_ID: %d \n", gnb_id); RCconfig_NR_X2(msg_p, gnb_id); itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); register_gnb_x2_pending++; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 73e0481a4bb97169994b458247ba4aace8edd454..08e4d97a31f45f85005f7fd37955a58ae51a1340 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -863,7 +863,7 @@ void RCconfig_NR_L1(void) int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; if (ulprbbl) - LOG_I(NR_PHY, "PRB blacklist %s\n", ulprbbl); + LOG_D(NR_PHY, "PRB blacklist %s\n", ulprbbl); char *save = NULL; char *pt = strtok_r(ulprbbl, ",", &save); int prbbl[275]; @@ -874,13 +874,13 @@ void RCconfig_NR_L1(void) const int rb = atoi(pt); AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb); prbbl[rb] = 0x3FFF; // all symbols taken - LOG_I(NR_PHY, "Blacklisting prb %d\n", atoi(pt)); + LOG_D(NR_PHY, "Blacklisting prb %d\n", atoi(pt)); pt = strtok_r(NULL, ",", &save); num_prbbl++; } RC.gNB[j]->num_ulprbbl = num_prbbl; - LOG_I(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", num_prbbl); + LOG_D(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", num_prbbl); memcpy(RC.gNB[j]->ulprbbl, prbbl, 275 * sizeof(int)); RC.gNB[j]->ap_N1 = N1; @@ -897,7 +897,6 @@ void RCconfig_NR_L1(void) for (j = 0; j < RC.nb_nr_L1_inst; j++) { if (RC.gNB[j] == NULL) { RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); - LOG_I(NR_PHY, "RC.gNB[%d] = %p\n", j, RC.gNB[j]); memset(RC.gNB[j], 0, sizeof(PHY_VARS_gNB)); RC.gNB[j]->Mod_id = j; } @@ -934,9 +933,15 @@ void RCconfig_NR_L1(void) RC.nb_nr_CC = (int *)malloc((1 + RC.nb_nr_inst) * sizeof(int)); RC.nb_nr_CC[0] = 1; - LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the 2 similar variables?\n", __FUNCTION__); - LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]); - LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", __FUNCTION__, RC.nb_nr_macrlc_inst); + LOG_D(PHY, + "%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the " + "2 similar variables?\n", + __FUNCTION__); + LOG_D(PHY, "%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]); + LOG_D(PHY, + "%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", + __FUNCTION__, + RC.nb_nr_macrlc_inst); configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, RC.gNB[j]->eth_params_n.remote_portc, @@ -946,10 +951,9 @@ void RCconfig_NR_L1(void) } else { // other midhaul } } // for (j = 0; j < RC.nb_nr_L1_inst; j++) - printf("Initializing northbound interface for L1\n"); l1_north_init_gNB(); } else { - LOG_I(PHY, "No " CONFIG_STRING_L1_LIST " configuration found"); + LOG_E(PHY, "No " CONFIG_STRING_L1_LIST " configuration found"); // need to create some structures for VNF @@ -958,7 +962,6 @@ void RCconfig_NR_L1(void) if (RC.gNB[j] == NULL) { RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); memset((void *)RC.gNB[j], 0, sizeof(PHY_VARS_gNB)); - LOG_I(PHY, "RC.gNB[%d] = %p\n", j, RC.gNB[j]); RC.gNB[j]->Mod_id = j; } } @@ -1422,7 +1425,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0 || strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) { - printf("Configuring F1 interfaces for MACRLC\n"); char **f1caddr = MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr; RC.nrmac[j]->eth_params_n.my_addr = strdup(*f1caddr); char **f1uaddr = MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_F1U_IDX].strptr; @@ -1447,16 +1449,14 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) RC.nrmac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); RC.nrmac[j]->eth_params_s.transp_preference = ETH_UDP_MODE; - printf("**************** vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc); configure_nr_nfapi_vnf( RC.nrmac[j]->eth_params_s.my_addr, RC.nrmac[j]->eth_params_s.my_portc, RC.nrmac[j]->eth_params_s.remote_addr, RC.nrmac[j]->eth_params_s.remote_portd, RC.nrmac[j]->eth_params_s.my_portd); - printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc); } else if(strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "aerial") == 0){ #ifdef ENABLE_AERIAL RC.nrmac[j]->nvipc_params_s.nvipc_shm_prefix = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_SHM_PREFIX].strptr)); RC.nrmac[j]->nvipc_params_s.nvipc_poll_core = *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_POLL_CORE].i8ptr); - printf("Configuring VNF for Aerial connection with prefix %s\n", RC.nrmac[j]->eth_params_s.local_if_name); + LOG_I(GNB_APP, "Configuring VNF for Aerial connection with prefix %s\n", RC.nrmac[j]->eth_params_s.local_if_name); aerial_configure_nr_fapi_vnf(); #endif } else { // other midhaul @@ -1839,7 +1839,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - printf("NRRRC %d: Southbound Transport %s\n", i, *(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + LOG_D(GNB_APP, "NRRRC %d: Southbound Transport %s\n", i, *(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); rrc->node_type = get_node_type(); rrc->node_id = gnb_id; @@ -2158,8 +2158,6 @@ void NRRCConfig(void) { /* get global parameters, defined outside any section in the config file */ - LOG_I(GNB_APP, "Getting GNBSParams\n"); - config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 868928e0455271593f67c59e86bc3c7fdbe437eb..1df8f590ef6329bcaf0da3d9297493865e4dcf62 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -888,30 +888,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, pdcp_remove_UE(&ctxt); } - /* Note: This should not be done in the MAC! */ - /* - for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) { - LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; - - if((ulsch != NULL) && (ulsch->rnti == rnti)) { - void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); - LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); - clean_eNb_ulsch(ulsch); - } - } - - for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) { - LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0]; - - if((dlsch != NULL) && (dlsch->rnti == rnti)) { - void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); - clean_eNb_dlsch(dlsch); - } - } - */ - - int id; + int id; // clean ULSCH entries for rnti id = find_ulsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 5ac5a23c4d19ee296a979962ca48f0e2cf1827fd..375059f315f734855d3b348f05e3b774d7ba0e1d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -449,7 +449,7 @@ void generate_Msg2(module_id_t module_idP, add_msg3 (module_idP, CC_idP, ra, frameP, subframeP); ra->eRA_state = WAITMSG3; /* DL request */ - LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n", + LOG_I(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n", module_idP, frameP, subframeP); @@ -465,12 +465,13 @@ void generate_Msg2(module_id_t module_idP, } } else { if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { - LOG_D(MAC, - "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %s\n", + LOG_I(MAC, + "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI for rnti %x, state %s\n", module_idP, CC_idP, frameP, subframeP, + ra->RA_rnti, era_text[ra->eRA_state]); // Allocate 4 PRBS starting in RB 0 first_rb = 0; @@ -1227,7 +1228,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, } // Msg4 frame/subframe } // regular LTE case } else { - LOG_D(MAC, + LOG_I(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n", module_idP, CC_idP, frameP, subframeP); ra->eRA_state = IDLE; @@ -1284,7 +1285,7 @@ initiate_ra_proc(module_id_t module_idP, ) { uint8_t i; COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; - RA_t *ra = &cc->ra[0]; + RA_t *ra = cc->ra; struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL; LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL; @@ -1451,7 +1452,7 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rnti) { unsigned char i; RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; - LOG_D(MAC, + LOG_I(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti); @@ -1472,7 +1473,7 @@ void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP) { RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; for (i = 0; i < NB_RA_PROC_MAX; i++) { - LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti); + LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti); ra[i].eRA_state = IDLE; ra[i].timing_offset = 0; ra[i].RRC_timer = 20; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 50c46b16e13979f0ae046c530f234d8dc10ff0b2..60b55280961347b72d563a3bbefc9e1d097d7ced 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -3471,7 +3471,7 @@ CCE_allocation_infeasible(int module_idP, if (format_flag != 2) { // DL DCI if (DL_req->number_pdu == MAX_NUM_DL_PDU) { - LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %x\n", subframe, rnti); } else { dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; @@ -3489,7 +3489,7 @@ CCE_allocation_infeasible(int module_idP, } } else { // ue-specific UL DCI if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi == MAX_NUM_HI_DCI0_PDU) { - LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %x\n", subframe, rnti); } else { hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG; @@ -3516,7 +3516,7 @@ int CCE_try_allocate_dlsch(int module_id, nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_id]->DL_req[CC_id].dl_config_request_body; if (DL_req->number_pdu >= MAX_NUM_DL_PDU) { - LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI DL structure is full, skip scheduling UE %x\n", subframe, rnti); return -1; } @@ -3577,7 +3577,7 @@ int CCE_try_allocate_ulsch(int module_id, nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_id]->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body; if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi >= MAX_NUM_HI_DCI0_PDU) { - LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %d\n", subframe, rnti); + LOG_W(MAC, "Subframe %d: FAPI UL structure is full, skip scheduling UE %x\n", subframe, rnti); return -1; } diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 635155b5a253ebadb74b4673b728fe7aaea0f44c..f10941c3abfd6347cb34025e78f369fc434f6a6e 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -506,7 +506,7 @@ typedef struct { /*!\brief RA process state*/ typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } eRA_state; -static const char *const era_text[] = {"IDLE", "Ms2", "WAITMSG3", "WAITMSG4ACK", "MSGCRNTI", "MSGCRNTIACK"}; +static const char *const era_text[] = {"IDLE", "Msg2", "WAITMSG3", "WAITMSG4ACK", "MSGCRNTI", "MSGCRNTIACK"}; /*!\brief UE DLSCH scheduling states*/ typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ea4fbed192489ccc10b19eda24fff7f507e82a64..7baca618d1ef557745028a8941ff46395a68a086 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -288,7 +288,6 @@ static void config_common(gNB_MAC_INST *nrmac, cfg->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; // temporary cfg->num_tlv++; - LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.dl_bandwidth.value); cfg->carrier_config.dl_frequency.value = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, @@ -318,7 +317,6 @@ static void config_common(gNB_MAC_INST *nrmac, cfg->carrier_config.uplink_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; // temporary cfg->num_tlv++; - LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.uplink_bandwidth.value); int UL_pointA; if (frequencyInfoUL->absoluteFrequencyPointA == NULL) @@ -496,7 +494,7 @@ static void config_common(gNB_MAC_INST *nrmac, nrmac->ssb_SubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; nrmac->ssb_OffsetPointA = cfg->ssb_table.ssb_offset_point_a.value; - LOG_I(NR_MAC, + LOG_D(NR_MAC, "ssb_OffsetPointA %d, ssb_SubcarrierOffset %d\n", cfg->ssb_table.ssb_offset_point_a.value, cfg->ssb_table.ssb_subcarrier_offset.value); @@ -582,7 +580,7 @@ static void config_common(gNB_MAC_INST *nrmac, __FUNCTION__); cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530; } - LOG_I(NR_MAC, "Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period.value); + LOG_D(NR_MAC, "Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period.value); int periods_per_frame = set_tdd_config_nr(cfg, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, @@ -675,7 +673,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c initialize_beam_information(&nrmac->beam_info, *scc->ssbSubcarrierSpacing, n); - LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); + LOG_D(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); config_common(nrmac, config, scc); fapi_beam_index_allocation(scc, nrmac); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 3e738db42a4b8006e55c56be87594c0a6b9a90bf..9dd76099d97c0bb5671741f0b74f1f27af3396b0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -728,7 +728,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, } int index = ra - cc->ra; - LOG_I(NR_MAC, "%d.%d UE RA-RNTI %04x TC-RNTI %04x: Activating RA process index %d\n", frameP, slotP, ra->RA_rnti, ra->rnti, index); + LOG_A(NR_MAC, "%d.%d UE RA-RNTI %04x TC-RNTI %04x: Activating RA process index %d\n", frameP, slotP, ra->RA_rnti, ra->rnti, index); // Configure RA BWP configure_UE_BWP(nr_mac, scc, NULL, ra, NULL, -1, -1); @@ -1692,6 +1692,8 @@ static void nr_generate_Msg2(module_id_t module_idP, ra->Msg3_frame, ra->Msg3_slot); + LOG_A(NR_MAC, "%d.%d Send RAR to RA-RNTI %04x\n", frameP, slotP, ra->RA_rnti); + T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), 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 63e7ff9d992d42ba4260ae75132b82ae65e27bb7..1faee06a39d94f2df7baba88d4d5d0a52cb6d3bc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -823,7 +823,7 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) pthread_mutex_unlock(&mac->sched_lock); if (!du_exists_f1_ue_data(dl_rrc->gNB_DU_ue_id)) { - LOG_I(NR_MAC, "No CU UE ID stored for UE RNTI %04x, adding CU UE ID %d\n", dl_rrc->gNB_DU_ue_id, dl_rrc->gNB_CU_ue_id); + LOG_D(NR_MAC, "No CU UE ID stored for UE RNTI %04x, adding CU UE ID %d\n", dl_rrc->gNB_DU_ue_id, dl_rrc->gNB_CU_ue_id); f1_ue_data_t new_ue_data = {.secondary_ue = dl_rrc->gNB_CU_ue_id}; du_add_f1_ue_data(dl_rrc->gNB_DU_ue_id, &new_ue_data); } diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 1407a2cbb3be9cf2bf68d2ab4aa709a9941802cb..a663ed522ca9c0683a59abe66d8d11b607d6c0e4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -217,8 +217,6 @@ void mac_top_init_gNB(ngran_node_t node_type, AssertFatal(RC.nb_nr_macrlc_inst == 1, "what is the point of calling %s() if you don't need exactly one MAC?\n", __func__); - LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst); - if (RC.nb_nr_macrlc_inst > 0) { RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *)); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index c63487e1ced60be036c738e0eb2cb58215ab60d6..218e01fe282625608eb789943a2fb722dce5d382 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -557,6 +557,9 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, break; } + if (pdcp_uid == MAX_MOBILES_PER_ENB) + return ret; + LOG_D(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, (int)(rb_idP+rb_offset), current_sn); Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; @@ -1104,16 +1107,17 @@ bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, break; } } - - Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; - Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; - Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); - Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); - - Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number; - Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); - Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; + if( pdcp_uid < MAX_MOBILES_PER_ENB ) { + Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; + Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; + Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); + Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset); + + Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number; + Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); + Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); + Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; + } free(sdu_buffer_pP); if (ctxt_pP->enb_flag) { @@ -2298,8 +2302,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) { if (UE_NAS_USE_TUN) { int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? MAX_MOBILES_PER_ENB : 1; tun_init("oaitun_ue", num_if, id); - if (IS_SOFTMODEM_NOS1) - tun_config(1, "10.0.1.2", NULL, "oaitun_ue"); tun_init_mbms("oaitun_uem", id + 1); tun_config(1, "10.0.2.2", NULL, "oaitun_uem"); LOG_I(PDCP, "UE pdcp will use tun interface\n"); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 8c85075598a79d1941a9aeb89ad1840552b3f46a..4d288b48cb8b5f12dfd03b7093aac89e9f9360db 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -55,7 +55,7 @@ static int modulus_rx(nr_rlc_entity_am_t *entity, int a) return r; } -static int modulus_tx(nr_rlc_entity_am_t *entity, int a) +static inline int modulus_tx(nr_rlc_entity_am_t *entity, int a) { int r = a - entity->tx_next_ack; if (r < 0) r += entity->sn_modulus; @@ -76,12 +76,38 @@ static int sn_compare_rx(void *_entity, int a, int b) return modulus_rx(entity, a) - modulus_rx(entity, b); } -static int sn_compare_tx(void *_entity, int a, int b) +static inline int sn_compare_tx(void *_entity, int a, int b) { nr_rlc_entity_am_t *entity = _entity; return modulus_tx(entity, a) - modulus_tx(entity, b); } +nr_rlc_sdu_segment_t *nr_rlc_tx_sdu_segment_list_add(nr_rlc_entity_am_t *entity, + nr_rlc_sdu_segment_t *list, nr_rlc_sdu_segment_t *sdu_segment) +{ + nr_rlc_sdu_segment_t head; + nr_rlc_sdu_segment_t *cur; + nr_rlc_sdu_segment_t *prev; + + head.next = list; + cur = list; + prev = &head; + + /* order is by 'sn', if 'sn' is the same then order is by 'so' */ + while (cur != NULL) { + /* check if 'sdu_segment' is before 'cur' in the list */ + if (sn_compare_tx(entity, cur->sdu->sn, sdu_segment->sdu->sn) > 0 || + (cur->sdu->sn == sdu_segment->sdu->sn && cur->so > sdu_segment->so)) { + break; + } + prev = cur; + cur = cur->next; + } + prev->next = sdu_segment; + sdu_segment->next = cur; + return head.next; +} + static int segment_already_received(nr_rlc_entity_am_t *entity, int sn, int so, int size) { @@ -1580,7 +1606,7 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, && sdu->so > entity->wait_end->so)) nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); else { - entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list = nr_rlc_tx_sdu_segment_list_add(entity, entity->wait_list, sdu); if (entity->wait_list->next == NULL) entity->wait_end = entity->wait_list; @@ -1672,7 +1698,7 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) && sdu->so > entity->wait_end->so)) nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); else { - entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list = nr_rlc_tx_sdu_segment_list_add(entity, entity->wait_list, sdu); if (entity->wait_list->next == NULL) entity->wait_end = entity->wait_list; @@ -1881,7 +1907,7 @@ static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) cur->sdu->sn, cur->so, cur->size, cur->sdu->retx_count); /* put in retransmit list */ - entity->retransmit_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->retransmit_list = nr_rlc_tx_sdu_segment_list_add(entity, entity->retransmit_list, cur); cur = entity->wait_list; @@ -2064,3 +2090,4 @@ int nr_rlc_entity_am_available_tx_space(nr_rlc_entity_t *_entity) nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity; return entity->tx_maxsize - entity->tx_size; } + diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c index ef64389ac559c8554fcc21a0c6c042b9c7067a86..a5c722a0363b45f3f20e5a30f84b39333620144e 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c @@ -30,7 +30,11 @@ nr_rlc_sdu_segment_t *nr_rlc_new_sdu( char *buffer, int size, int upper_layer_id) { - nr_rlc_sdu_t *sdu = calloc(1, sizeof(nr_rlc_sdu_t)); + /* allocate sdu header and data together */ + nr_rlc_sdu_t *sdu = malloc(sizeof(nr_rlc_sdu_t) + size); + /* only memset the header */ + memset(sdu, 0 , sizeof(*sdu)); + nr_rlc_sdu_segment_t *ret = calloc(1, sizeof(nr_rlc_sdu_segment_t)); if (sdu == NULL || ret == NULL) goto oom; @@ -38,9 +42,7 @@ nr_rlc_sdu_segment_t *nr_rlc_new_sdu( sdu->ref_count = 1; sdu->sn = -1; /* set later */ sdu->upper_layer_id = upper_layer_id; - sdu->data = malloc(size); - if (sdu->data == NULL) - goto oom; + sdu->data = (char*)(sdu + 1); memcpy(sdu->data, buffer, size); sdu->size = size; sdu->retx_count = -1; @@ -64,7 +66,6 @@ int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) sdu->sdu->free_count++; if (sdu->sdu->free_count == sdu->sdu->ref_count) { - free(sdu->sdu->data); free(sdu->sdu); ret = 1; } @@ -87,33 +88,6 @@ void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, *end = sdu; } -nr_rlc_sdu_segment_t *nr_rlc_sdu_segment_list_add( - int (*sn_compare)(void *, int, int), void *sn_compare_data, - nr_rlc_sdu_segment_t *list, nr_rlc_sdu_segment_t *sdu_segment) -{ - nr_rlc_sdu_segment_t head; - nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - - head.next = list; - cur = list; - prev = &head; - - /* order is by 'sn', if 'sn' is the same then order is by 'so' */ - while (cur != NULL) { - /* check if 'sdu_segment' is before 'cur' in the list */ - if (sn_compare(sn_compare_data, cur->sdu->sn, sdu_segment->sdu->sn) > 0 || - (cur->sdu->sn == sdu_segment->sdu->sn && cur->so > sdu_segment->so)) { - break; - } - prev = cur; - cur = cur->next; - } - prev->next = sdu_segment; - sdu_segment->next = cur; - return head.next; -} - void nr_rlc_free_sdu_segment_list(nr_rlc_sdu_segment_t *l) { nr_rlc_sdu_segment_t *cur; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h index 333b8742c3c7b0d6a9b7e4c85504ad1a7ebd94c7..9d1fa9ea8a900714335b7e2e997285bd2207e835 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h @@ -61,9 +61,6 @@ int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu); void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, nr_rlc_sdu_segment_t **end, nr_rlc_sdu_segment_t *sdu); -nr_rlc_sdu_segment_t *nr_rlc_sdu_segment_list_add( - int (*sn_compare)(void *, int, int), void *sn_compare_data, - nr_rlc_sdu_segment_t *list, nr_rlc_sdu_segment_t *sdu_segment); void nr_rlc_free_sdu_segment_list(nr_rlc_sdu_segment_t *l); #endif /* _NR_RLC_SDU_H_ */ diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index e8e70aec4145b6a0b9cbdc87edb68fc29789dc1b..88e4761f230ae27aeadc0bbd347f0109b191b613 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -97,8 +97,7 @@ void mac_rlc_data_ind ( rb->set_time(rb, rlc_current_time); rb->recv_pdu(rb, buffer_pP, tb_sizeP); } else { - LOG_E(RLC, "%s:%d:%s: fatal: no RB found (rnti %d channel ID %d)\n", - __FILE__, __LINE__, __FUNCTION__, rnti, channel_id); + LOG_E(RLC, "fatal: no RB found (rnti %x channel ID %d)\n", rnti, channel_id); exit(1); } @@ -388,9 +387,7 @@ static void deliver_sdu(void *_ue, rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", - __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); - + LOG_D(RLC, "delivering SDU (rnti %x is_srb %d rb_id %d) size %d", ue->rnti, is_srb, rb_id, size); /* unused fields? */ ctx.instance = ue->module_id; @@ -419,9 +416,7 @@ rb_found: } memcpy(memblock, buf, size); if (!pdcp_data_ind(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) { - LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %d)\n", - __FILE__, __LINE__, __FUNCTION__, - is_srb, rb_id, ue->rnti); + LOG_E(RLC, "ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %x)\n", is_srb, rb_id, ue->rnti); /* what to do in case of failure? for the moment: nothing */ } } @@ -623,7 +618,7 @@ static void add_srb(int rnti, int module_id, struct LTE_SRB_ToAddMod *s) poll_pdu, poll_byte, max_retx_threshold); rlc_ue_add_srb_rlc_entity(ue, srb_id, rlc_am); - LOG_D(RLC, "%s:%d:%s: added SRB %d to UE RNTI %x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_D(RLC, "added SRB %d to UE RNTI %x\n", srb_id, rnti); } rlc_manager_unlock(rlc_ue_manager); } @@ -944,7 +939,7 @@ rlc_op_status_t rrc_rlc_config_req ( exit(1); } rlc_manager_lock(rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %d (is_srb %d) for UE %ld\n", __FILE__, __LINE__, __FUNCTION__, (int)rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); + LOG_D(RLC, "remove rb %d (is_srb %d) for UE %lx\n", (int)rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); ue = rlc_manager_get_ue(rlc_ue_manager, ctxt_pP->rntiMaybeUEid); if (srb_flagP) { if (ue->srb[rb_idP-1] != NULL) { @@ -976,7 +971,7 @@ rlc_op_status_t rrc_rlc_config_req ( rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) { - LOG_D(RLC, "%s:%d:%s: remove UE %ld\n", __FILE__, __LINE__, __FUNCTION__, x->rntiMaybeUEid); + LOG_D(RLC, "remove UE %lx\n", x->rntiMaybeUEid); rlc_manager_lock(rlc_ue_manager); rlc_manager_remove_ue(rlc_ue_manager, x->rntiMaybeUEid); rlc_manager_unlock(rlc_ue_manager); diff --git a/openair2/LAYER2/rlc_v2/rlc_ue_manager.c b/openair2/LAYER2/rlc_v2/rlc_ue_manager.c index 1fd366fda1523a73c35aa91d9127ea66e51c9ffd..76556295bbdd8c76dc3366490e057d1cb16bedc3 100644 --- a/openair2/LAYER2/rlc_v2/rlc_ue_manager.c +++ b/openair2/LAYER2/rlc_v2/rlc_ue_manager.c @@ -85,7 +85,7 @@ rlc_ue_t *rlc_manager_get_ue(rlc_ue_manager_t *_m, int rnti) if (m->ue_list[i]->rnti == rnti) return m->ue_list[i]; - LOG_D(RLC, "%s:%d:%s: new UE %d\n", __FILE__, __LINE__, __FUNCTION__, rnti); + LOG_D(RLC, "new UE %x\n", rnti); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(rlc_ue_t *) * m->ue_count); diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 2e4687a35245eca9b9d5f6e0fab8ade13b688af0..455deb1eacd34a35e4a5bab38a530959f100692b 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -369,8 +369,7 @@ static void match_crc_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, nfapi_nr_crc rx_ind_unmatched->pdu_list = calloc(rx_ind_unmatched->number_of_pdus, sizeof(nfapi_nr_pdu_t)); for (int i = 0; i < rx_ind->number_of_pdus; i++) { if (!crc_ind_has_rnti(crc_ind, rx_ind->pdu_list[i].rnti)) { - LOG_I(NR_MAC, "rx_ind->pdu_list[%d].rnti %d does not match any crc_ind pdu rnti\n", - i, rx_ind->pdu_list[i].rnti); + LOG_I(NR_MAC, "rx_ind->pdu_list[%d].rnti %x does not match any crc_ind pdu rnti\n", i, rx_ind->pdu_list[i].rnti); rx_ind_unmatched->pdu_list[num_unmatched_rxs] = rx_ind->pdu_list[i]; num_unmatched_rxs++; remove_rx_pdu(rx_ind, i); @@ -497,13 +496,13 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES); - LOG_I(PHY,"Installing callbacks for IF_Module - UL_indication\n"); + LOG_D(PHY, "Installing callbacks for IF_Module - UL_indication\n"); if (nr_if_inst[Mod_id]==NULL) { nr_if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); memset((void*)nr_if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); - LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,nr_if_inst[Mod_id]); + LOG_D(MAC, "Allocating shared L1/L2 interface structure for instance %d @ %p\n", Mod_id, nr_if_inst[Mod_id]); nr_if_inst[Mod_id]->CC_mask=0; nr_if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 13787f23341bc7cc481c329f32aa8dc7d1bd21f5..2079b84438578df4512ac3228d397ffc9e4119ef 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -536,18 +536,18 @@ rrc_t310_expiration( } //----------------------------------------------------------------------------- -static void rrc_ue_generate_RRCConnectionSetupComplete( - const protocol_ctxt_t *const ctxt_pP, - const uint8_t eNB_index, - const uint8_t Transaction_id, - uint8_t sel_plmn_id) { +static void rrc_ue_generate_RRCConnectionSetupComplete(const protocol_ctxt_t *const ctxt_pP, + const uint8_t eNB_index, + const uint8_t Transaction_id, + uint8_t sel_plmn_id) +{ uint8_t buffer[100]; uint8_t size; const char *nas_msg; int nas_msg_length; if (EPC_MODE_ENABLED) { - nas_msg = (char *) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; + nas_msg = (char *)UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.nas_data; nas_msg_length = UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; } else { nas_msg = nas_attach_req_imsi; @@ -771,7 +771,7 @@ rrc_ue_establish_drb( "10.0.%d.%d", UE_NAS_USE_TUN ? 1 : (ip_addr_offset3 + ue_mod_idP + 1), ip_addr_offset4 + ue_mod_idP + 1); - oip_ifup = tun_config(ip_addr_offset3 + ue_mod_idP + 1, ip, NULL, "oaitun_oip"); + oip_ifup = tun_config(ip_addr_offset3 + ue_mod_idP + 1, ip, NULL, "oaitun_ue"); if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n", @@ -1904,14 +1904,13 @@ static bool is_nr_r15_config_present(LTE_RRCConnectionReconfiguration_r8_IEs_t * #undef NCE #undef chk } - -//----------------------------------------------------------------------------- -void -rrc_ue_process_rrcConnectionReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, - uint8_t eNB_index -) +/** \brief process the received rrcConnectionReconfiguration message at UE + \param ctxt_pP Running context + \param *rrcConnectionReconfiguration pointer to the sturcture + \param eNB_index Index of corresponding eNB/CH*/ +static void rrc_ue_process_rrcConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + uint8_t eNB_index) //----------------------------------------------------------------------------- { LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n", @@ -2035,7 +2034,7 @@ rrc_ue_process_rrcConnectionReconfiguration( msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_ESTABLI_CNF); NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; - NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; + NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data = pdu_buffer; itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } LOG_D(RRC, "Sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n"); @@ -2185,14 +2184,17 @@ rrc_detach_from_eNB( } //----------------------------------------------------------------------------- -void -rrc_ue_decode_dcch( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const uint8_t *const Buffer, - const uint32_t Buffer_size, - const uint8_t eNB_indexP -) +/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message + \param ctxt_pP Running context + \param Srb_id Index of Srb (1,2) + \param Buffer Pointer to received SDU + \param Buffer_size + \param eNB_indexP Index of corresponding eNB/CH*/ +static void rrc_ue_decode_dcch(const protocol_ctxt_t *const ctxt_pP, + const rb_id_t Srb_id, + const uint8_t *const Buffer, + const uint32_t Buffer_size, + const uint8_t eNB_indexP) //----------------------------------------------------------------------------- { //DL_DCCH_Message_t dldcchmsg; @@ -2247,15 +2249,14 @@ rrc_ue_decode_dcch( /* This message hold a dedicated info NAS payload, forward it to NAS */ struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = &dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType; - uint32_t pdu_length; - uint8_t *pdu_buffer; MessageDef *msg_p; - pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; - pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; + uint32_t pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; + uint8_t *pdu_buffer = malloc(pdu_length); + memcpy(pdu_buffer, dedicatedInfoType->choice.dedicatedInfoNAS.buf, pdu_length); msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_DOWNLINK_DATA_IND); NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data = pdu_buffer; itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } @@ -2918,7 +2919,7 @@ int decode_BCCH_DLSCH_Message( } if (rrc_get_sub_state(ctxt_pP->module_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { - if ( (UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data != NULL) || (!EPC_MODE_ENABLED)) { + if ((UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.nas_data != NULL) || (!EPC_MODE_ENABLED)) { rrc_ue_generate_RRCConnectionRequest(ctxt_pP, 0); rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING ); } @@ -5173,7 +5174,8 @@ void *rrc_ue_task( void *args_p ) { uint8_t *buffer; LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_UPLINK_DATA_REQ (msg_p).UEid); /* Create message for PDCP (ULInformationTransfer_t) */ - length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data); + length = + do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ(msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ(msg_p).nasMsg.nas_data); /* Transfer data to PDCP */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 92173508914cc61d7dda408a6d973b91a4de04d6..c26a57cd444437b8eaaef54dc546c3ee0e82740c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -98,6 +98,8 @@ #include "SIMULATION/TOOLS/sim.h" // for taus +#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h" + #define ASN_MAX_ENCODE_SIZE 4096 #define NUMBEROF_DRBS_TOBE_ADDED 1 static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size); @@ -878,7 +880,7 @@ rrc_eNB_free_UE( void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) { eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; pthread_mutex_lock(&lock_ue_freelist); - LOG_I(PHY,"add ue %d in free list, context flag: %d\n", rnti, removeFlag); + LOG_I(PHY, "adding ue %x in UE to free list, context flag: %d\n", rnti, removeFlag); int i; for (i=0; i < sizeofArray(eNB_MAC->UE_free_ctrl); i++) if (eNB_MAC->UE_free_ctrl[i].rnti == 0) @@ -891,16 +893,18 @@ void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) { eNB_MAC->UE_free_ctrl[i].rnti = rnti; eNB_MAC->UE_free_ctrl[i].removeContextFlg = removeFlag; eNB_MAC->UE_free_ctrl[i].raFlag = 0; - eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti; - eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++; + if (eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs < NFAPI_RELEASE_MAX_RNTI) { + eNB_MAC->UE_release_req.ue_release_request_body + .ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs] + .rnti = rnti; + eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++; + } else { + LOG_E(PHY, "fapi List of UE to release is full\n"); + } + pthread_mutex_unlock(&lock_ue_freelist); } -extern int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -extern int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -extern void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); -extern void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - void release_UE_in_freeList(module_id_t mod_id) { PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; @@ -918,13 +922,11 @@ void release_UE_in_freeList(module_id_t mod_id) { int id; // clean ULSCH entries for rnti id = find_ulsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); - if (id >= 0) clean_eNb_ulsch(eNB_PHY->ulsch[id]); // clean DLSCH entries for rnti id = find_dlsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); - if (id >= 0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]); @@ -3886,7 +3888,11 @@ check_handovers( ue_context_p->ue_context.handover_info->buf, PDCP_TRANSMISSION_MODE_CONTROL); ue_context_p->ue_context.handover_info->state = HO_COMPLETE; - LOG_I(RRC, "RRC Sends RRCConnectionReconfiguration to UE %d at frame %d and subframe %d \n", ue_context_p->ue_context.rnti, ctxt_pP->frame,ctxt_pP->subframe); + LOG_I(RRC, + "RRC Sends RRCConnectionReconfiguration to UE %x at frame %d and subframe %d \n", + ue_context_p->ue_context.rnti, + ctxt_pP->frame, + ctxt_pP->subframe); } /* in the target, UE in HO_ACK mode */ @@ -7568,16 +7574,16 @@ void rrc_eNB_process_ENDC_DC_prep_timeout(module_id_t module_id, x2ap_ENDC_dc_pr ue_context = rrc_eNB_get_ue_context(RC.rrc[module_id], m->rnti); if (ue_context == NULL) { - LOG_E(RRC, "receiving DC prep timeout for unknown UE rnti %d\n", m->rnti); + LOG_E(RRC, "receiving DC prep timeout for unknown UE rnti %x\n", m->rnti); return; } if (ue_context->ue_context.StatusRrc != RRC_NR_NSA) { - LOG_E(RRC, "receiving DC prep timeout for UE rnti %d not in state RRC_NR_NSA\n", m->rnti); + LOG_E(RRC, "receiving DC prep timeout for UE rnti %x not in state RRC_NR_NSA\n", m->rnti); return; } - LOG_I(RRC, "DC prep timeout for UE rnti %d, put back to RRC_RECONFIGURED mode\n", m->rnti); + LOG_I(RRC, "DC prep timeout for UE rnti %x, put back to RRC_RECONFIGURED mode\n", m->rnti); ue_context->ue_context.StatusRrc = RRC_RECONFIGURED; } @@ -7588,7 +7594,7 @@ void rrc_eNB_process_ENDC_sgNB_release_required(module_id_t module_id, x2ap_ENDC ue_context = rrc_eNB_find_ue_context_from_gnb_rnti(RC.rrc[module_id], m->gnb_rnti); if (ue_context == NULL) { - LOG_E(RRC, "receiving ENDC SgNB Release Required for unknown UE (with gNB's rnti %d)\n", m->gnb_rnti); + LOG_E(RRC, "receiving ENDC SgNB Release Required for unknown UE (with gNB's rnti %x)\n", m->gnb_rnti); return; } diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index a5f8463c47b66e48a91039c99eb8955814eb371f..1810fbaed227c2c0e639085aa1b67d8cc2890bde 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -93,21 +93,6 @@ rrc_rx_tx_ue( \param eNB_index Index of corresponding eNB/CH*/ int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *const Srb_info, const uint8_t eNB_index ); -/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message - \param ctxt_pP Running context - \param Srb_id Index of Srb (1,2) - \param Buffer Pointer to received SDU - \param Buffer_size - \param eNB_indexP Index of corresponding eNB/CH*/ -void -rrc_ue_decode_dcch( - const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const uint8_t *const Buffer, - const uint32_t Buffer_size, - const uint8_t eNB_indexP -); - int decode_SL_Discovery_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, @@ -123,17 +108,6 @@ rrc_ue_generate_RRCConnectionRequest( const uint8_t eNB_index ); -/** \brief process the received rrcConnectionReconfiguration message at UE - \param ctxt_pP Running context - \param *rrcConnectionReconfiguration pointer to the sturcture - \param eNB_index Index of corresponding eNB/CH*/ -void -rrc_ue_process_rrcConnectionReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, - uint8_t eNB_index -); - /** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly \param module_idP Instance ID of UE \param frameP Frame index diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index dab37f6f1a1cc3e385c5d1c8e1ed4762347d2363..cae49d3f534d074229923e034623afb86410bd7b 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1990,7 +1990,8 @@ NR_MeasurementTimingConfiguration_t *get_new_MeasurementTimingConfiguration(cons int encode_MeasurementTimingConfiguration(const struct NR_MeasurementTimingConfiguration *mtc, uint8_t *buf, int buf_len) { DevAssert(mtc != NULL); - xer_fprint(stdout, &asn_DEF_NR_MeasurementTimingConfiguration, mtc); + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_MeasurementTimingConfiguration, mtc); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_MeasurementTimingConfiguration, NULL, mtc, buf, buf_len); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); return (enc_rval.encoded + 7) / 8; @@ -2209,7 +2210,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, int mnc = plmn->mnc; if (plmn->mnc_digit_length == 3) { asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0); - *mnc0 = (0 / 100) % 10; + *mnc0 = (mnc / 100) % 10; } asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1); *mnc1 = (mnc / 10) % 10; diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 14d08e9c45376a800cbe71e9d9efffa4aa50b3f4..7650718e66ade7dd73b05bd6e21aeb90caf5d42f 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -69,12 +69,6 @@ #include "intertask_interface.h" -#define PROTOCOL_NR_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_NR_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) - -#define PROTOCOL_NR_RRC_CTXT_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) - // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs #define NR_RRC_SETUP_DELAY_MS 10 #define NR_RRC_RECONFIGURATION_DELAY_MS 10 @@ -243,6 +237,7 @@ typedef struct gNB_RRC_UE_s { uint64_t ng_5G_S_TMSI_Part1; NR_EstablishmentCause_t establishment_cause; + uint64_t nr_cellid; uint32_t rrc_ue_id; uint64_t amf_ue_ngap_id; nr_rrc_guami_t ue_guami; @@ -426,6 +421,13 @@ typedef struct gNB_RRC_INST_s { } gNB_RRC_INST; +#define UE_LOG_FMT "(cellID %lx, UE ID %d RNTI %04x)" +#define UE_LOG_ARGS(ue_context) (ue_context)->nr_cellid, (ue_context)->rrc_ue_id, (ue_context)->rnti + +#define LOG_UE_DL_EVENT(ue_context, fmt, ...) LOG_A(NR_RRC, "[DL] " UE_LOG_FMT " " fmt, UE_LOG_ARGS(ue_context) __VA_OPT__(,) __VA_ARGS__) +#define LOG_UE_EVENT(ue_context, fmt, ...) LOG_A(NR_RRC, "[--] " UE_LOG_FMT " " fmt, UE_LOG_ARGS(ue_context) __VA_OPT__(,) __VA_ARGS__) +#define LOG_UE_UL_EVENT(ue_context, fmt, ...) LOG_A(NR_RRC, "[UL] " UE_LOG_FMT " " fmt, UE_LOG_ARGS(ue_context) __VA_OPT__(,) __VA_ARGS__) + #include "nr_rrc_proto.h" //should be put here otherwise compilation error #endif diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1ff2747ec490bee6c64df1bb284c5559592c55a6..ce42a7be3fc515e00f4441a56cb72622f5f5f9f3 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -211,7 +211,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier); - LOG_I(NR_RRC,"do_SIB23_NR, size %d \n ", rrc->carrier.sizeof_SIB23); + LOG_I(NR_RRC, "do_SIB23_NR, size %d\n", rrc->carrier.sizeof_SIB23); AssertFatal(rrc->carrier.sizeof_SIB23 != 255,"FATAL, RC.nrrrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); } @@ -291,7 +291,7 @@ static void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod AssertFatal(cg_configinfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo, "ueCapabilityInformation not present\n"); parse_CG_ConfigInfo(rrc,cg_configinfo,m); - LOG_A(NR_RRC, "Successfully parsed CG_ConfigInfo of size %zu bits. (%zu bytes)\n", + LOG_I(NR_RRC, "Successfully parsed CG_ConfigInfo of size %zu bits. (%zu bytes)\n", dec_rval.consumed, (dec_rval.consumed +7/8)); } @@ -400,7 +400,7 @@ static void rrc_gNB_generate_RRCSetup(instance_t instance, int masterCellGroup_len) //----------------------------------------------------------------------------- { - LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04x\n", rnti); + LOG_UE_DL_EVENT(&ue_context_pP->ue_context, "Send RRC Setup\n"); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_INST *rrc = RC.nrrrc[instance]; @@ -430,9 +430,9 @@ static void rrc_gNB_generate_RRCSetup(instance_t instance, static void rrc_gNB_generate_RRCReject(module_id_t module_id, rrc_gNB_ue_context_t *const ue_context_pP) //----------------------------------------------------------------------------- { - LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); gNB_RRC_INST *rrc = RC.nrrrc[module_id]; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + LOG_A(NR_RRC, "Send RRCReject to RNTI %04x\n", ue_p->rnti); unsigned char buf[1024]; int size = do_RRCReject(buf); @@ -466,7 +466,6 @@ static void rrc_gNB_generate_RRCReject(module_id_t module_id, rrc_gNB_ue_context static void rrc_gNB_process_RRCSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRCSetupComplete_IEs_t *rrcSetupComplete) //----------------------------------------------------------------------------- { - LOG_A(NR_RRC, "UE %d Processing NR_RRCSetupComplete from UE\n", UE->rrc_ue_id); UE->Srb[1].Active = 1; UE->Srb[2].Active = 0; @@ -568,7 +567,7 @@ static void rrc_gNB_generate_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_ int size = rrc_gNB_encode_RRCReconfiguration(rrc, ue_p, xid, dedicatedNAS_MessageList, buffer, sizeof(buffer), false); DevAssert(size > 0 && size <= sizeof(buffer)); - LOG_I(NR_RRC, "UE %d: Generate RRCReconfiguration (bytes %d, xid %d)\n", ue_p->rrc_ue_id, size, xid); + LOG_UE_DL_EVENT(ue_p, "Generate RRCReconfiguration (bytes %d, xid %d)\n", size, xid); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); } @@ -825,7 +824,7 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context uint32_t ssb_arfcn = get_ssb_arfcn(du); int size = do_RRCReestablishment(ue_context_pP, buffer, NR_RRC_BUF_SIZE, xid, cell_info->nr_pci, ssb_arfcn); - LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size); + LOG_A(NR_RRC, "Send RRCReestablishment [%d bytes] to RNTI %04x\n", size, ue_p->rnti); /* Ciphering and Integrity according to TS 33.501 */ nr_pdcp_entity_security_keys_and_algos_t security_parameters; @@ -1053,6 +1052,7 @@ static void rrc_handle_RRCSetupRequest(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE = &ue_context_p->ue_context; UE->establishment_cause = rrcSetupRequest->establishmentCause; + UE->nr_cellid = msg->nr_cellid; UE->masterCellGroup = cellGroupConfig; activate_srb(UE, 1); rrc_gNB_generate_RRCSetup(0, msg->crnti, ue_context_p, msg->du2cu_rrc_container, msg->du2cu_rrc_container_length); @@ -1202,6 +1202,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, // update with new RNTI, and update secondary UE association UE->rnti = msg->crnti; + UE->nr_cellid = msg->nr_cellid; f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id); ue_data.secondary_ue = msg->gNB_DU_ue_id; cu_remove_f1_ue_data(UE->rrc_ue_id); @@ -1399,6 +1400,8 @@ void rrc_forward_ue_nas_message(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) if (UE->nas_pdu.buffer == NULL || UE->nas_pdu.length == 0) return; // no problem: the UE will re-request a NAS PDU + LOG_UE_DL_EVENT(UE, "Send DL Information Transfer [%d bytes]\n", UE->nas_pdu.length); + uint8_t buffer[4096]; unsigned int xid = rrc_gNB_get_next_transaction_identifier(rrc->module_id); uint32_t length = do_NR_DLInformationTransfer(buffer, sizeof(buffer), xid, UE->nas_pdu.length, UE->nas_pdu.buffer); @@ -1420,7 +1423,6 @@ static void handle_ueCapabilityInformation(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, return; } - LOG_I(NR_RRC, "UE %d: received UE capabilities (xid %d)\n", UE->rrc_ue_id, xid); int eutra_index = -1; if (ue_cap_info->criticalExtensions.present == NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation) { @@ -1437,6 +1439,7 @@ static void handle_ueCapabilityInformation(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, LOG_E(RRC, "could not encode UE-CapabilityRAT-ContainerList, abort handling capabilities\n"); return; } + LOG_UE_UL_EVENT(UE, "Received UE capabilities\n"); for (int i = 0; i < ue_CapabilityRAT_ContainerList->list.count; i++) { const NR_UE_CapabilityRAT_Container_t *ue_cap_container = ue_CapabilityRAT_ContainerList->list.array[i]; @@ -1591,7 +1594,6 @@ static void handle_rrcReconfigurationComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *U { uint8_t xid = reconfig_complete->rrc_TransactionIdentifier; UE->ue_reconfiguration_counter++; - LOG_I(NR_RRC, "UE %d: Receive RRC Reconfiguration Complete message (xid %d)\n", UE->rrc_ue_id, xid); switch (UE->xids[xid]) { case RRC_PDUSESSION_RELEASE: { @@ -1692,10 +1694,12 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m break; case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete: + LOG_UE_UL_EVENT(UE, "Received RRCReconfigurationComplete\n"); handle_rrcReconfigurationComplete(rrc, UE, ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete); break; case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete: + LOG_UE_UL_EVENT(UE, "Received RRCSetupComplete (RRC_CONNECTED reached)\n"); handle_rrcSetupComplete(rrc, UE, ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete); break; @@ -1704,10 +1708,12 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m break; case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + LOG_UE_UL_EVENT(UE, "Received RRC UL Information Transfer [%d bytes]\n", msg->rrc_container_length); rrc_gNB_send_NGAP_UPLINK_NAS(rrc, UE, ul_dcch_msg); break; case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete: + LOG_UE_UL_EVENT(UE, "Received Security Mode Complete\n"); /* configure ciphering */ nr_rrc_pdcp_config_security(UE, true); UE->as_security_active = true; @@ -1740,6 +1746,7 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m break; case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: + LOG_UE_UL_EVENT(UE, "Received RRCReestablishmentComplete\n"); handle_rrcReestablishmentComplete(rrc, UE, ul_dcch_msg->message.choice.c1->choice.rrcReestablishmentComplete); break; @@ -2107,6 +2114,7 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i nr_ho_source_cu_t *source_ctx = UE->ho_context->source; DevAssert(source_ctx->old_rnti == UE->rnti); UE->rnti = target_ctx->new_rnti; + UE->nr_cellid = target_ctx->du->setup_req->cell[0].info.nr_cellid; } } @@ -2668,8 +2676,7 @@ void rrc_gNB_generate_RRCRelease(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) uint8_t buffer[NR_RRC_BUF_SIZE] = {0}; int size = do_NR_RRCRelease(buffer, NR_RRC_BUF_SIZE, rrc_gNB_get_next_transaction_identifier(rrc->module_id)); - LOG_I(NR_RRC, "UE %d: Generate RRCRelease (bytes %d)\n", UE->rrc_ue_id, size); - + LOG_UE_DL_EVENT(UE, "Send RRC Release\n"); f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id); RETURN_IF_INVALID_ASSOC_ID(ue_data.du_assoc_id); f1ap_ue_context_release_cmd_t ue_context_release_cmd = { diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8c45728523fdc37ee999f3ee1e9bf726abefb7d4..6a35f61b3fa28af3738426647ce29e50ad1e62ff 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -615,11 +615,10 @@ static void set_UE_security_algos(const gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, con UE->ciphering_algorithm = cipheringAlgorithm; UE->integrity_algorithm = integrityProtAlgorithm; - LOG_I(NR_RRC, - "[UE %d] Selected security algorithms: ciphering %lx, integrity %x\n", - UE->rrc_ue_id, - cipheringAlgorithm, - integrityProtAlgorithm); + LOG_UE_EVENT(UE, + "Selected security algorithms: ciphering %lx, integrity %x\n", + cipheringAlgorithm, + integrityProtAlgorithm); } //------------------------------------------------------------------------------ @@ -1143,7 +1142,6 @@ void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).num_pdu_sessions = num_pdu; for (int i = 0; i < num_pdu; ++i) NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).pdu_session_id[i] = pdu_session_id[i]; - LOG_W(RRC, "trigger release with %d pdu\n", num_pdu); itti_send_msg_to_task(TASK_NGAP, instance, msg); } diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c index 82c5d2911641f90f27763100f9d522e7cc7f4698..15f644955dc8abe6bddc6f3029c40320b9d2de9b 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.c +++ b/openair2/RRC/NR/rrc_gNB_UE_context.c @@ -142,11 +142,11 @@ void rrc_gNB_remove_ue_context(gNB_RRC_INST *rrc_instance_pP, rrc_gNB_ue_context return; } + LOG_UE_EVENT(&ue_context_pP->ue_context, "Remove UE context\n"); RB_REMOVE(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP); uid_linear_allocator_free(&rrc_instance_pP->uid_allocator, ue_context_pP->ue_context.rrc_ue_id - 1); cu_remove_f1_ue_data(ue_context_pP->ue_context.rrc_ue_id); rrc_gNB_free_mem_ue_context(ue_context_pP); - LOG_I(NR_RRC, "Removed UE context\n"); } //----------------------------------------------------------------------------- @@ -204,11 +204,11 @@ rrc_gNB_ue_context_t *rrc_gNB_create_ue_context(sctp_assoc_t assoc_id, cu_add_f1_ue_data(ue->rrc_ue_id, &ue_data); RB_INSERT(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_p); - LOG_I(NR_RRC, - "Created new UE context: CU UE ID %u DU UE ID %u (rnti: %04x, random ue id %lx)\n", - ue->rrc_ue_id, - du_ue_id, - ue->rnti, - ue->random_ue_identity); + LOG_UE_EVENT(ue, + "Create UE context: CU UE ID %u DU UE ID %u (rnti: %04x, random ue id %lx)\n", + ue->rrc_ue_id, + du_ue_id, + ue->rnti, + ue->random_ue_identity); return ue_context_p; } diff --git a/openair2/RRC/NR/rrc_gNB_cuup.c b/openair2/RRC/NR/rrc_gNB_cuup.c index d37a1f430bb023f9218c4c5c91787fa813f6d9ea..729f5f28b46be1a27c2d7f92126c304fe54c8e4e 100644 --- a/openair2/RRC/NR/rrc_gNB_cuup.c +++ b/openair2/RRC/NR/rrc_gNB_cuup.c @@ -46,10 +46,10 @@ static const nr_rrc_cuup_container_t *select_cuup_slice(const struct rrc_cuup_tr for (int s = 0; s < sr->plmn[p].supported_slices; ++s) { e1ap_nssai_t *nssai = &sr->plmn[p].slice[s]; if (nssai->sst == sst && nssai->sd == sd) { - LOG_A(RRC, "selecting CU-UP ID %ld based on exact NSSAI match (%d:0x%06x)\n", sr->gNB_cu_up_id, sst, sd); + LOG_UE_EVENT(ue, "selecting CU-UP ID %ld based on exact NSSAI match (%d:0x%06x)\n", sr->gNB_cu_up_id, sst, sd); return cuup; /* exact match */ } else if (nssai->sst == sst && second_best_match == NULL) { - LOG_I(RRC, "second best match: CU-UP ID %ld matches SST %d\n", sr->gNB_cu_up_id, sst); + LOG_UE_EVENT(ue, "second best match: CU-UP ID %ld matches SST %d\n", sr->gNB_cu_up_id, sst); second_best_match = cuup; /* only the SST matches -> "good enough" */ } } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 64d9ec33541cefcaab4bf995161c3ed88f1034d0..ceae4703f6e1a5f212070f9d623965cc6dc19b53 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -391,12 +391,12 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { rrc_gNB_ue_context_t *ue_context; int e_rab; - LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti); + LOG_D(RRC, "calling rrc_remove_nsa_user rnti %x\n", rnti); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, rnti, 0, 0, rrc->module_id); ue_context = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti); if (ue_context == NULL) { - LOG_W(RRC, "rrc_remove_nsa_user: rnti %d not found\n", rnti); + LOG_W(RRC, "rrc_remove_nsa_user: rnti %x not found\n", rnti); return; } @@ -411,7 +411,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { gtpv1u_enb_delete_tunnel_req_t tmp={0}; tmp.rnti=rnti; tmp.from_gnb=1; - LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %d\n", ue_context->ue_context.nb_of_e_rabs, rnti); + LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %x\n", ue_context->ue_context.nb_of_e_rabs, rnti); for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) { tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.nsa_gtp_ebi[e_rab]; // erase data diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 89d73f1abc3df5aa0961ebd0bc82f8b520c8c396..61f839158609af3957db43599f194e32005cad53 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -189,10 +189,10 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *tmp = ext->dedicatedNAS_MessageList; for (int i = 0; i < tmp->list.count; i++) { MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_CONN_ESTABLI_CNF); - NasConnEstabCnf *msg = &NAS_CONN_ESTABLI_CNF(ittiMsg); + nas_establish_cnf_t *msg = &NAS_CONN_ESTABLI_CNF(ittiMsg); msg->errCode = AS_SUCCESS; msg->nasMsg.length = tmp->list.array[i]->size; - msg->nasMsg.data = tmp->list.array[i]->buf; + msg->nasMsg.nas_data = tmp->list.array[i]->buf; itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); } tmp->list.count = 0; // to prevent the automatic free by ASN1_FREE @@ -998,7 +998,7 @@ static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const as_nas_info_t initialNasMsg; nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id); generateRegistrationRequest(&initialNasMsg, nas); - nas_msg = (char*)initialNasMsg.data; + nas_msg = (char *)initialNasMsg.nas_data; nas_msg_length = initialNasMsg.length; } else { nas_msg = nr_nas_attach_req_imsi_dummy_NSA_case; @@ -1751,10 +1751,11 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_DOWNLINK_DATA_IND); - NasDlDataInd *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); + dl_info_transfer_ind_t *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); msg->UEid = rrc->ue_id; msg->nasMsg.length = dedicatedNAS_Message->size; - msg->nasMsg.data = dedicatedNAS_Message->buf; + msg->nasMsg.nas_data = malloc(msg->nasMsg.length); + memcpy(msg->nasMsg.nas_data, dedicatedNAS_Message->buf, msg->nasMsg.length); itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); dedicatedNAS_Message->buf = NULL; // to keep the buffer, up to NAS to free it } @@ -1907,15 +1908,15 @@ void *rrc_nrue(void *notUsed) case NAS_UPLINK_DATA_REQ: { uint32_t length; uint8_t *buffer = NULL; - NasUlDataReq *req = &NAS_UPLINK_DATA_REQ(msg_p); + ul_info_transfer_req_t *req = &NAS_UPLINK_DATA_REQ(msg_p); /* Create message for PDCP (ULInformationTransfer_t) */ - length = do_NR_ULInformationTransfer(&buffer, req->nasMsg.length, req->nasMsg.data); + length = do_NR_ULInformationTransfer(&buffer, req->nasMsg.length, req->nasMsg.nas_data); /* Transfer data to PDCP */ // check if SRB2 is created, if yes request data_req on SRB2 // error: the remote gNB is hardcoded here rb_id_t srb_id = rrc->Srb[2] == RB_ESTABLISHED ? 2 : 1; nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); - free(req->nasMsg.data); + free(req->nasMsg.nas_data); free(buffer); break; } diff --git a/openair3/NAS/COMMON/API/NETWORK/as_message.c b/openair3/NAS/COMMON/API/NETWORK/as_message.c index 1a986ced1fa4bba0efe15d140875dd6eab505b41..e1db277bccdac6e1e4643162e05d005b47bad2bc 100644 --- a/openair3/NAS/COMMON/API/NETWORK/as_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/as_message.c @@ -80,65 +80,55 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length) { LOG_FUNC_IN; - int bytes; /* pointers to msg fields possibly not aligned because msg points to a packed structure - * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and - * gcc, from v9, now warns about it. fix these warnings by removing the indirection on data - * (in fact i don't understand this code data seems to be useless...) - */ - Byte_t *data = NULL; + * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and + * gcc, from v9, now warns about it. fix these warnings by removing the indirection on data + * (in fact i don't understand this code data seems to be useless...) + */ /* Get the message type */ msg->msgID = *(uint16_t*)(buffer); - bytes = sizeof(uint16_t); + int bytes = 0; switch (msg->msgID) { case AS_NAS_ESTABLISH_REQ: /* NAS signalling connection establish request */ - bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_req.initialNasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_req_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_IND: /* NAS signalling connection establishment indication */ - bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_ind.initialNasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_ind_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_RSP: /* NAS signalling connection establishment response */ - bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_rsp.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_rsp_t) - sizeof(as_nas_info_t); break; case AS_NAS_ESTABLISH_CNF: /* NAS signalling connection establishment confirm */ - bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); - data = msg->msg.nas_establish_cnf.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(nas_establish_cnf_t) - sizeof(as_nas_info_t); break; case AS_UL_INFO_TRANSFER_REQ: /* Uplink L3 data transfer request */ - bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*); - data = msg->msg.ul_info_transfer_req.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_req_t) - sizeof(as_nas_info_t); break; case AS_UL_INFO_TRANSFER_IND: /* Uplink L3 data transfer indication */ - bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*); - data = msg->msg.ul_info_transfer_ind.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_ind_t) - sizeof(as_nas_info_t); break; case AS_DL_INFO_TRANSFER_REQ: /* Downlink L3 data transfer request */ - bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*); - data = msg->msg.dl_info_transfer_req.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_req_t) - sizeof(as_nas_info_t); break; case AS_DL_INFO_TRANSFER_IND: /* Downlink L3 data transfer indication */ - bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*); - data = msg->msg.dl_info_transfer_ind.nasMsg.data; + bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_ind_t) - sizeof(as_nas_info_t); break; case AS_BROADCAST_INFO_IND: @@ -169,14 +159,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length) } if (bytes > 0) { - if (data) { - /* Set the pointer to dedicated NAS information */ - /* wasn't data already computed above for specific cases here we override ?? */ - data = (Byte_t *)buffer + bytes; - } - /* Decode the message */ - memcpy(msg, (as_message_t*)buffer, bytes); + memcpy(msg, buffer, bytes); LOG_FUNC_RETURN (msg->msgID); } @@ -254,7 +238,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) /* NAS signalling connection establish indication */ bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); nas_msg = msg->msg.nas_establish_ind.initialNasMsg; - dataptr=(Byte_t *)&(msg->msg.nas_establish_ind.initialNasMsg.data); + dataptr = (Byte_t*)&(msg->msg.nas_establish_ind.initialNasMsg.nas_data); len=msg->msg.nas_establish_ind.initialNasMsg.length; break; @@ -269,7 +253,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) /* NAS signalling connection establish confirm */ bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); nas_msg = msg->msg.nas_establish_cnf.nasMsg; - dataptr=(Byte_t *)&(msg->msg.nas_establish_cnf.nasMsg.data); + dataptr = (Byte_t*)&(msg->msg.nas_establish_cnf.nasMsg.nas_data); len=msg->msg.nas_establish_ind.initialNasMsg.length; break; @@ -361,10 +345,10 @@ int as_message_encode(char* buffer, as_message_t* msg, int length) if ( (dataptr!=NULL) && (len > 0) ) { /* Copy the NAS message */ - memcpy(buffer + bytes, nas_msg.data, nas_msg.length); + memcpy(buffer + bytes, nas_msg.nas_data, nas_msg.length); bytes += len; /* Release NAS message memory */ - free(nas_msg.data); + free(nas_msg.nas_data); len=0; dataptr = NULL; } diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c index 32454a13e3c410ab54df1dbb143ffd96d5f1d7f1..80551c5b5c662b2146b3c3b94e5880867681a86a 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c @@ -535,7 +535,8 @@ int nas_message_encode( #endif emm_security_context); /* Set the message authentication code of the NAS message */ - *(uint32_t*)(buffer + sizeof(uint8_t)) = htonl(mac); + uint32_t mac_nl = htonl(mac); + memcpy(buffer + sizeof(uint8_t), &mac_nl, sizeof(mac_nl)); if (emm_security_context) { #ifdef NAS_MME diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.c b/openair3/NAS/COMMON/API/NETWORK/network_api.c index 9f8f2125a6f7234be15376a20a51bf22b1ff2fd2..a2ef101e92cc2762839089e8fab49e65cfe308b1 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.c +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.c @@ -91,19 +91,12 @@ static struct { /* * The buffer used to receive data from the network sublayer */ -#define NETWORK_API_RECV_BUFFER_SIZE 4096 -static char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE]; +#define NETWORK_API_RECV_BUFFER_SIZE 4096 /* * The buffer used to send data to the network sublayer */ -#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE -static char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; - -/* - * The decoded data received from the network sublayer - */ -static as_message_t _as_data = {}; /* Access Stratum message */ +#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -148,6 +141,7 @@ int network_api_initialize(const char* host, const char* port) ((errno < 0) ? gai_strerror(errno) : strerror(errno))); LOG_FUNC_RETURN (RETURNerror); } + char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; gethostname(_network_api_send_buffer, NETWORK_API_SEND_BUFFER_SIZE); LOG_TRACE(INFO, "NET-API - Network's UDP socket %d is BOUND to %s/%s", @@ -177,27 +171,6 @@ int network_api_get_fd(void) LOG_FUNC_RETURN (NETWORK_API_GETFD()); } -/**************************************************************************** - ** ** - ** Name: network_api_get_data() ** - ** ** - ** Description: Get a generic pointer to the network data structure. ** - ** Casting to the proper type is necessary before its usage. ** - ** ** - ** Inputs: None ** - ** Others: _as_data ** - ** ** - ** Outputs: Return: A generic pointer to the network data ** - ** structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -const void* network_api_get_data(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN ((void*)(&_as_data)); -} - /**************************************************************************** ** ** ** Name: network_api_read_data() ** @@ -213,7 +186,7 @@ const void* network_api_get_data(void) ** Others: _network_api_recv_buffer, _network_api_id ** ** ** ***************************************************************************/ -int network_api_read_data(int fd) +int network_api_read_data(int fd, char* _network_api_recv_buffer) { LOG_FUNC_IN; @@ -263,7 +236,7 @@ int network_api_read_data(int fd) ** Others: None ** ** ** ***************************************************************************/ -int network_api_send_data(int fd, int length) +static int network_api_send_data(int fd, int length, char* _network_api_send_buffer) { LOG_FUNC_IN; @@ -346,12 +319,12 @@ void network_api_close(int fd) ** Others: _as_data ** ** ** ***************************************************************************/ -int network_api_decode_data(int length) +int network_api_decode_data(char* _network_api_recv_buffer, int length, as_message_t* _as_data) { LOG_FUNC_IN; /* Decode the Access Stratum message received from the network */ - int as_id = as_message_decode(_network_api_recv_buffer, &_as_data, length); + int as_id = as_message_decode(_network_api_recv_buffer, _as_data, length); if (as_id != RETURNerror) { LOG_TRACE(INFO, "NET-API - AS message id=0x%x successfully decoded", @@ -376,7 +349,7 @@ int network_api_decode_data(int length) ** Others: _network_api_send_buffer ** ** ** ***************************************************************************/ -int network_api_encode_data(void* data) +static int network_api_encode_data(void* data, char* _network_api_send_buffer) { LOG_FUNC_IN; @@ -415,9 +388,10 @@ int as_message_send(as_message_t* as_msg) LOG_TRACE(INFO, "NET-API - Send message 0x%.4x to the Access Stratum " "layer", as_msg->msgID); + char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; /* Encode the AS message */ - bytes = network_api_encode_data(as_msg); + bytes = network_api_encode_data(as_msg, _network_api_send_buffer); if (bytes > 0) { /* Get the network file descriptor */ @@ -425,7 +399,7 @@ int as_message_send(as_message_t* as_msg) if (fd != RETURNerror) { /* Send the AS message to the network */ - bytes = network_api_send_data(fd, bytes); + bytes = network_api_send_data(fd, bytes, _network_api_send_buffer); } } diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.h b/openair3/NAS/COMMON/API/NETWORK/network_api.h index 57abb2c4f6e82d22f8ee1860c1455e06892939c0..14106cbcbfb24993f36a26417b387e70d1bc4bf6 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.h +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.h @@ -55,17 +55,14 @@ Description Implements the API used by the NAS layer to send/receive /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ - +#include "openair2/COMMON/as_message.h" int network_api_initialize(const char* host, const char* port); int network_api_get_fd(void); -const void* network_api_get_data(void); -int network_api_read_data(int fd); -int network_api_send_data(int fd, int length); +int network_api_read_data(int fd, char *_network_api_recv_buffer); void network_api_close(int fd); -int network_api_decode_data(int length); -int network_api_encode_data(void* data); +int network_api_decode_data(char *_network_api_recv_buffer, int length, as_message_t *_as_data); #endif /* __NETWORK_API_H__*/ diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.h b/openair3/NAS/COMMON/UTIL/TLVDecoder.h index 5e3210f6967f17ba9faaf43a057caeae8dcd6210..1f93d7a5540b3ce41a5c0c204bd19a9048dd2cef 100644 --- a/openair3/NAS/COMMON/UTIL/TLVDecoder.h +++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.h @@ -62,8 +62,12 @@ #define IES_DECODE_U8(bUFFER, dECODED, vALUE) \ DECODE_U8(bUFFER + dECODED, vALUE, dECODED) -#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ - DECODE_U16(bUFFER + dECODED, vALUE, dECODED) +#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ + do { \ + uint16_t val; \ + memcpy(&val, bUFFER + dECODED, sizeof(val)); \ + DECODE_U16(&val, vALUE, dECODED); \ + } while (0) #define IES_DECODE_U24(bUFFER, dECODED, vALUE) \ DECODE_U24(bUFFER + dECODED, vALUE, dECODED) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index 8d07ea84550f9b00607f2ed96f5e73f948e748c4..59d646e3df74931538fd38c10f5d3a0ebdb8a759 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -543,10 +543,10 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas) size += 10; // encode the message - initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t)); - nas->registration_request_buf = initialNasMsg->data; + initialNasMsg->nas_data = malloc16_clear(size * sizeof(Byte_t)); + nas->registration_request_buf = initialNasMsg->nas_data; - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); nas->registration_request_len = initialNasMsg->length; } @@ -575,9 +575,9 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype } // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); } static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg, uint8_t *buf) @@ -611,9 +611,9 @@ static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialN mm_msg->fgs_auth_response.authenticationresponseparameter.res = res; size += 18; // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data), size); + initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size); // Free res value after encode free(res.value); } @@ -663,13 +663,13 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia size += (nas->registration_request_len + 2); // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(size * sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &(nas_msg.header), size); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size); initialNasMsg->length = security_header_len - + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); /* ciphering */ uint8_t buf[initialNasMsg->length - 7]; @@ -678,7 +678,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -689,7 +689,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; @@ -697,7 +697,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -791,32 +791,32 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, } // encode the message - initialNasMsg->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + initialNasMsg->nas_data = malloc(length * sizeof(Byte_t)); initialNasMsg->length = length; /* Encode the first octet of the header (extended protocol discriminator) */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.protocol_discriminator, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.protocol_discriminator, size); /* Encode the security header type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.security_header_type, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.security_header_type, size); /* Encode the message authentication code */ - ENCODE_U32(initialNasMsg->data + size, sp_msg->header.message_authentication_code, size); + ENCODE_U32(initialNasMsg->nas_data + size, sp_msg->header.message_authentication_code, size); /* Encode the sequence number */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->header.sequence_number, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->header.sequence_number, size); /* Encode the extended protocol discriminator */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.protocoldiscriminator, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.protocoldiscriminator, size); /* Encode the security header type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.securityheadertype, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.securityheadertype, size); /* Encode the message type */ - ENCODE_U8(initialNasMsg->data + size, sp_msg->plain.mm_msg.registration_complete.messagetype, size); + ENCODE_U8(initialNasMsg->nas_data + size, sp_msg->plain.mm_msg.registration_complete.messagetype, size); if (sortransparentcontainer) { - encode_registration_complete(&sp_msg->plain.mm_msg.registration_complete, initialNasMsg->data + size, length - size); + encode_registration_complete(&sp_msg->plain.mm_msg.registration_complete, initialNasMsg->nas_data + size, length - size); } /* ciphering */ @@ -826,7 +826,7 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -837,14 +837,14 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas, stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -888,12 +888,12 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi size += fill_guti(&dereg_req->fgsmobileidentity, nas->guti); // encode the message - initialNasMsg->data = calloc(size, sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &nas_msg.header, size); + initialNasMsg->nas_data = calloc(size, sizeof(Byte_t)); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &nas_msg.header, size); initialNasMsg->length = security_header_len - + mm_msg_encode(&sp_msg->plain.mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(&sp_msg->plain.mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); nas_stream_cipher_t stream_cipher; @@ -904,7 +904,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -915,7 +915,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; uint8_t mac[4]; @@ -923,7 +923,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -996,12 +996,12 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * size += (1 + 1 + dnnSize + 1); // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); - int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->data), &(nas_msg.header), size); + initialNasMsg->nas_data = (Byte_t *)malloc(size * sizeof(Byte_t)); + int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size); initialNasMsg->length = security_header_len - + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->data + security_header_len), size - security_header_len); + + mm_msg_encode(mm_msg, (uint8_t *)(initialNasMsg->nas_data + security_header_len), size - security_header_len); // Free allocated memory after encode free(req_buffer); @@ -1015,7 +1015,7 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * stream_cipher.count = nas->security.nas_count_ul; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); @@ -1026,14 +1026,14 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t * stream_cipher.count = nas->security.nas_count_ul++; stream_cipher.bearer = 1; stream_cipher.direction = 0; - stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); + stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6); /* length in bits */ stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]); for (int i = 0; i < 4; i++) { - initialNasMsg->data[2 + i] = mac[i]; + initialNasMsg->nas_data[2 + i] = mac[i]; } } @@ -1079,7 +1079,7 @@ static void send_nas_uplink_data_req(nr_ue_nas_t *nas, const as_nas_info_t *init MessageDef *msg = itti_alloc_new_message(TASK_NAS_NRUE, nas->UE_id, NAS_UPLINK_DATA_REQ); ul_info_transfer_req_t *req = &NAS_UPLINK_DATA_REQ(msg); req->UEid = nas->UE_id; - req->nasMsg.data = (uint8_t *)initial_nas_msg->data; + req->nasMsg.nas_data = (uint8_t *)initial_nas_msg->nas_data; req->nasMsg.length = initial_nas_msg->length; itti_send_msg_to_task(TASK_RRC_NRUE, nas->UE_id, msg); } @@ -1312,7 +1312,7 @@ void *nas_nrue(void *args_p) NAS_CONN_ESTABLI_CNF(msg_p).errCode, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length); - uint8_t *pdu_buffer = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data; + uint8_t *pdu_buffer = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data; int pdu_length = NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length; security_state_t security_state = nas_security_rx_process(nas, pdu_buffer, pdu_length); @@ -1381,10 +1381,10 @@ void *nas_nrue(void *args_p) nas->UE_id, ITTI_MSG_NAME(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length, - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data); as_nas_info_t initialNasMsg = {0}; - uint8_t *pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data; + uint8_t *pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data; int pdu_length = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length; security_state_t security_state = nas_security_rx_process(nas, pdu_buffer, pdu_length); diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c index de6dee4a5e18e741a24a2a15e1b07b517a679649..1c7ba03f706184b6d41d0b4d80b51de778fc487b 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.c +++ b/openair3/NAS/UE/EMM/SAP/emm_as.c @@ -147,13 +147,11 @@ static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *); * On X86 this is not fatal, as at run time the problem can be fixed (but it's better for perf to avoid). On other * processor as Arm i think it can end in seg fault */ -static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *, - void *ul_info_transfer_req_unaligned); -static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *, - void *nas_establish_req_unaligned); -static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, void *ul_info_transfer_req_unaligned); -static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *, void *ul_info_transfer_req_unaligned); -static int _emm_as_release_req(const emm_as_release_t *, void *nas_release_req_unaligned); +static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *, ul_info_transfer_req_t *as_msg); +static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *, nas_establish_req_t *); +static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, ul_info_transfer_req_t *as_msg); +static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *, ul_info_transfer_req_t *as_msg); +static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *as_msg); /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ @@ -839,22 +837,18 @@ _emm_as_encode( } /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + info->nas_data = malloc(length * sizeof(Byte_t)); - if (info->data != NULL) { + if (info->nas_data != NULL) { /* Encode the NAS message */ - bytes = nas_message_encode( - (char *)(info->data), - msg, - length, - emm_security_context); + bytes = nas_message_encode((char *)(info->nas_data), msg, length, emm_security_context); if (bytes > 0) { info->length = bytes; } else { - free(info->data); + free(info->nas_data); info->length = 0; - info->data = NULL; + info->nas_data = NULL; } } @@ -895,23 +889,18 @@ _emm_as_encrypt( } /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); + info->nas_data = malloc(length * sizeof(Byte_t)); - if (info->data != NULL) { + if (info->nas_data != NULL) { /* Encrypt the NAS information message */ - bytes = nas_message_encrypt( - msg, - (char *)(info->data), - header, - length, - emm_security_context); + bytes = nas_message_encrypt(msg, (char *)(info->nas_data), header, length, emm_security_context); if (bytes > 0) { info->length = bytes; } else { - free(info->data); + free(info->nas_data); info->length = 0; - info->data = NULL; + info->nas_data = NULL; } } @@ -938,41 +927,38 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) { LOG_FUNC_IN; - as_message_t as_msg; - memset(&as_msg, 0 , sizeof(as_message_t)); + as_message_t as_msg = {0}; switch (msg->primitive) { - case _EMMAS_DATA_REQ: - as_msg.msgID = _emm_as_data_req(user->emm_data, - &msg->u.data, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; - - case _EMMAS_STATUS_IND: - as_msg.msgID = _emm_as_status_ind(user->emm_data, - &msg->u.status, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; - - case _EMMAS_RELEASE_REQ: - as_msg.msgID = _emm_as_release_req( - &msg->u.release, - (void *)(&as_msg.msg.nas_release_req)); - break; - - - case _EMMAS_SECURITY_RES: - as_msg.msgID = _emm_as_security_res(user->emm_data, - &msg->u.security, - (void *)(&as_msg.msg.ul_info_transfer_req)); - break; - - case _EMMAS_ESTABLISH_REQ: - as_msg.msgID = _emm_as_establish_req(user->emm_data, - &msg->u.establish, - (void *)(&as_msg.msg.nas_establish_req)); - break; - + case _EMMAS_DATA_REQ: { + ul_info_transfer_req_t ul = {0}; + as_msg.msgID = _emm_as_data_req(user->emm_data, &msg->u.data, &ul); + as_msg.msg.ul_info_transfer_req = ul; + } break; + + case _EMMAS_STATUS_IND: { + ul_info_transfer_req_t st = {0}; + as_msg.msgID = _emm_as_status_ind(user->emm_data, &msg->u.status, &st); + as_msg.msg.ul_info_transfer_req = st; + } break; + + case _EMMAS_RELEASE_REQ: { + nas_release_req_t rel = {0}; + as_msg.msgID = _emm_as_release_req(&msg->u.release, &rel); + as_msg.msg.nas_release_req = rel; + } break; + + case _EMMAS_SECURITY_RES: { + ul_info_transfer_req_t ul = {0}; + as_msg.msgID = _emm_as_security_res(user->emm_data, &msg->u.security, &ul); + as_msg.msg.ul_info_transfer_req = ul; + } break; + + case _EMMAS_ESTABLISH_REQ: { + nas_establish_req_t nas_establish_req = {0}; + as_msg.msgID = _emm_as_establish_req(user->emm_data, &msg->u.establish, &nas_establish_req); + as_msg.msg.nas_establish_req = nas_establish_req; + } break; case _EMMAS_CELL_INFO_REQ: as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info, @@ -1009,24 +995,22 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) break; case AS_NAS_ESTABLISH_REQ: { - nas_itti_nas_establish_req( - as_msg.msg.nas_establish_req.cause, - as_msg.msg.nas_establish_req.type, - as_msg.msg.nas_establish_req.s_tmsi, - as_msg.msg.nas_establish_req.plmnID, - as_msg.msg.nas_establish_req.initialNasMsg.data, - as_msg.msg.nas_establish_req.initialNasMsg.length, - user->ueid); + nas_itti_nas_establish_req(as_msg.msg.nas_establish_req.cause, + as_msg.msg.nas_establish_req.type, + as_msg.msg.nas_establish_req.s_tmsi, + as_msg.msg.nas_establish_req.plmnID, + as_msg.msg.nas_establish_req.initialNasMsg.nas_data, + as_msg.msg.nas_establish_req.initialNasMsg.length, + user->ueid); LOG_FUNC_RETURN (RETURNok); } break; case AS_UL_INFO_TRANSFER_REQ: { - nas_itti_ul_data_req( - as_msg.msg.ul_info_transfer_req.UEid, - as_msg.msg.ul_info_transfer_req.nasMsg.data, - as_msg.msg.ul_info_transfer_req.nasMsg.length, - user->ueid); + nas_itti_ul_data_req(as_msg.msg.ul_info_transfer_req.UEid, + as_msg.msg.ul_info_transfer_req.nasMsg.nas_data, + as_msg.msg.ul_info_transfer_req.nasMsg.length, + user->ueid); LOG_FUNC_RETURN (RETURNok); } break; @@ -1075,11 +1059,9 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg) ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; - ul_info_transfer_req_t *as_msg = (ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; int size = 0; bool is_encoded = false; @@ -1171,19 +1153,14 @@ static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; int size = 0; - ul_info_transfer_req_t *as_msg = (ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; LOG_TRACE(INFO, "EMMAS-SAP - Send AS status indication (cause=%d)", msg->emm_cause); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1193,6 +1170,7 @@ static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the NAS information message */ @@ -1245,13 +1223,11 @@ static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_release_req(const emm_as_release_t *msg, - void *nas_release_req_unaligned) +static int _emm_as_release_req(const emm_as_release_t *msg, nas_release_req_t *as_msg) { LOG_FUNC_IN; LOG_TRACE(INFO, "EMMAS-SAP - Send AS release request"); - nas_release_req_t *as_msg = (nas_release_req_t *)nas_release_req_unaligned; /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1285,18 +1261,13 @@ static int _emm_as_release_req(const emm_as_release_t *msg, ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg, - void *ul_info_transfer_req_unaligned) +static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg, ul_info_transfer_req_t *as_msg) { LOG_FUNC_IN; - ul_info_transfer_req_t *as_msg=(ul_info_transfer_req_t *)ul_info_transfer_req_unaligned; int size = 0; LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response"); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ if (msg->guti) { as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; @@ -1304,6 +1275,7 @@ static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_securit } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the NAS security message */ @@ -1379,18 +1351,13 @@ static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_securit ** Others: None ** ** ** ***************************************************************************/ -static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, - void *nas_establish_req_unaligned) +static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, nas_establish_req_t *as_msg) { LOG_FUNC_IN; int size = 0; - nas_establish_req_t *as_msg = (nas_establish_req_t *)nas_establish_req_unaligned; LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish request"); - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - /* Setup the AS message */ as_msg->cause = msg->RRCcause; as_msg->type = msg->RRCtype; @@ -1403,6 +1370,7 @@ static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establ } /* Setup the NAS security header */ + nas_message_t nas_msg = {0}; EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); /* Setup the initial NAS information message */ diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c index a3a1c9c79b6862600823b5c62fcda12bd30507ae..1de5db45abeb68e281a926ed22e4220a15fbab52 100644 --- a/openair3/NAS/UE/UEprocess.c +++ b/openair3/NAS/UE/UEprocess.c @@ -253,7 +253,8 @@ static void *_nas_network_mngr(void *args) /* Network receiving loop */ while (true) { /* Read the network data message */ - bytes = network_api_read_data (*fd); + char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE] = {0}; + bytes = network_api_read_data(*fd, _network_api_recv_buffer); if (bytes == RETURNerror) { /* Failed to read data from the network sublayer; @@ -269,7 +270,8 @@ static void *_nas_network_mngr(void *args) } /* Decode the network data message */ - network_message_id = network_api_decode_data (bytes); + as_message_t _as_data = {}; + network_message_id = network_api_decode_data(bytes, &_as_data); if (network_message_id == RETURNerror) { /* Failed to decode data read from the network sublayer */ @@ -277,8 +279,7 @@ static void *_nas_network_mngr(void *args) } /* Process the network data message */ - ret_code = nas_network_process_data (user, network_message_id, - network_api_get_data ()); + ret_code = nas_network_process_data(user, network_message_id, &_as_data); if (ret_code != RETURNok) { /* The network data message has not been successfully diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index 2f9c8114d866b6adf1a09188129add170c6dacf6..e7707a8ccd11f0abbb9ac7170cf8e114fad8ba5f 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -118,7 +118,7 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t NAS_CONN_ESTABLI_REQ(message_p).type = type; NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi; NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID; - NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data; + NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.nas_data = data; NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length; return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } @@ -127,7 +127,7 @@ int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_UPLINK_DATA_REQ); NAS_UPLINK_DATA_REQ(message_p).UEid = ue_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = data; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.nas_data = data; NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = length; return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } diff --git a/openair3/NAS/UE/nas_network.c b/openair3/NAS/UE/nas_network.c index f6b291bb7bc0687981457303fea6a0d94cadecd8..5a244310c2795ef81b242ae7a797fa288623cf7e 100644 --- a/openair3/NAS/UE/nas_network.c +++ b/openair3/NAS/UE/nas_network.c @@ -161,8 +161,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data) if ( (confirm.errCode == AS_SUCCESS) || (confirm.errCode == AS_TERMINATED_NAS) ) { - rc = nas_proc_establish_cnf(user, confirm.nasMsg.data, - confirm.nasMsg.length); + rc = nas_proc_establish_cnf(user, confirm.nasMsg.nas_data, confirm.nasMsg.length); } else { LOG_TRACE(WARNING, "NET-MAIN - " "Initial NAS message not delivered"); @@ -193,8 +192,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data) case AS_DL_INFO_TRANSFER_IND: { const dl_info_transfer_ind_t info = msg->msg.dl_info_transfer_ind; /* Received downlink data transfer indication */ - rc = nas_proc_dl_transfer_ind(user, info.nasMsg.data, - info.nasMsg.length); + rc = nas_proc_dl_transfer_ind(user, info.nasMsg.nas_data, info.nasMsg.length); break; } diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index ac2cc4db1615567d1f4741ef5a1eee7fc50389e4..dfb4a98d4f9884ede6a7406ea92082f5657f6826 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -255,7 +255,7 @@ void *nas_ue_task(void *args_p) if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS) || (NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_TERMINATED_NAS)) { - nas_proc_establish_cnf(user, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); + nas_proc_establish_cnf(user, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.nas_data, NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length); /* TODO checks if NAS will free the nas message, better to do it there anyway! */ // result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data); @@ -287,13 +287,8 @@ void *nas_ue_task(void *args_p) LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), NAS_DOWNLINK_DATA_IND (msg_p).UEid, NAS_DOWNLINK_DATA_IND (msg_p).nasMsg.length); - nas_proc_dl_transfer_ind (user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); - - if (0) { - /* TODO checks if NAS will free the nas message, better to do it there anyway! */ - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } + nas_proc_dl_transfer_ind(user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); + free(NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.nas_data); break; diff --git a/openair3/NGAP/ngap_gNB.c b/openair3/NGAP/ngap_gNB.c index 45183407a343c5c22ad4d10c0a5bd34933d7bd82..70f6bd5e49dd6a6fb411a80acb6987865853ef40 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -254,6 +254,7 @@ void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ngap_amf_data_p->in_streams = sctp_new_association_resp->in_streams; ngap_amf_data_p->out_streams = sctp_new_association_resp->out_streams; /* Prepare new NG Setup Request */ + LOG_A(NGAP, "Send NGSetupRequest to AMF\n"); ngap_gNB_generate_ng_setup_request(instance_p, ngap_amf_data_p); } diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index de113b310039adda5a420afdfefb471cfd8d1769..59b2792602eee60246fb03e9054795911984c0ca 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -87,6 +87,7 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shut } } } else { + LOG_A(NGAP, "Received NGSetupResponse from AMF\n"); /* Check that at least one setup message is pending */ DevCheck(amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb > 0, amf_desc_p->ngap_gNB_instance->instance, amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb, 0); diff --git a/openair3/SECU/snow3g.c b/openair3/SECU/snow3g.c index 63519890ab207956513dc9d1018f2c09108273b6..2278a6fe942b38a74ac6f03a49bb2277fc60b44b 100644 --- a/openair3/SECU/snow3g.c +++ b/openair3/SECU/snow3g.c @@ -678,7 +678,7 @@ static uint64_t MUL64(uint64_t v, uint64_t p, uint64_t c) return result; } -static inline uint64_t mul_p(const uint64_t pm[7][256], uint64_t x) +static inline uint64_t mul_p(const uint64_t pm[8][256], uint64_t x) { uint64_t x0 = (x >> (32 + 24)) & 255; uint64_t x1 = (x >> (32 + 16)) & 255; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml index 54cefa608febb72a86f7fa7bdef34b8bf6a3a983..10ae7e92e0bf19e5f6fe91c316ce2b9203f340eb 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.yaml @@ -104,9 +104,6 @@ gNBs: 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