Merge remote-tracking branch 'origin/fix-regression-4G' into integration_2024_w44 (!3008)

Fix Regression 4G

- Fix various bugs and/or regressions in 4G code
- Also, the CI does not test RFsim 4G with --sanitize, enables this to
  detect problems.
This commit is contained in:
Robert Schmidt
2024-11-04 19:43:52 +01:00
58 changed files with 363 additions and 470 deletions
+6 -2
View File
@@ -52,7 +52,7 @@ import cls_oaicitest
# Helper functions used here and in other classes # Helper functions used here and in other classes
# (e.g., cls_cluster.py) # (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): def CreateWorkspace(host, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge):
if ranCommitID == '': if ranCommitID == '':
@@ -208,7 +208,9 @@ def WriteEnvFile(ssh, services, wd, tag):
ret = ssh.run(f'docker image inspect {checkimg}', reportNonZero=False) ret = ssh.run(f'docker image inspect {checkimg}', reportNonZero=False)
if ret.returncode == 0: if ret.returncode == 0:
logging.info(f"detected pulled image {checkimg}") 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-ue" in image: envs["NRUE_IMG"] = "oai-nr-ue-asan"
elif "oai-nr-cuup" in image: envs["NRCUUP_IMG"] = "oai-nr-cuup-asan" elif "oai-nr-cuup" in image: envs["NRCUUP_IMG"] = "oai-nr-cuup-asan"
else: logging.warning("undetected image format {image}, cannot use 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', '')) imageNames.append(('oai-gnb-aerial', 'gNB.aerial', 'oai-gnb-aerial', ''))
# Building again the 5G images with Address Sanitizer # Building again the 5G images with Address Sanitizer
imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "BUILD_OPTION=--sanitize"')) 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-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-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(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-asan', '--build-arg "BUILD_OPTION=--sanitize"'))
imageNames.append(('ran-build-fhi72', 'build.fhi72', 'ran-build-fhi72', '')) imageNames.append(('ran-build-fhi72', 'build.fhi72', 'ran-build-fhi72', ''))
@@ -228,7 +228,7 @@ RUs = (
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 0 att_tx = 0
att_rx = 0; att_rx = 6;
eNB_instances = [0]; eNB_instances = [0];
} }
); );
@@ -191,7 +191,7 @@ RUs = (
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 6 att_tx = 6
att_rx = 6; att_rx = 12;
bands = [38]; bands = [38];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 125; max_rxgain = 125;
@@ -191,7 +191,7 @@ RUs = (
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 6 att_tx = 6
att_rx = 6; att_rx = 12;
bands = [38]; bands = [38];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 125; max_rxgain = 125;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -224,7 +224,7 @@ RUs =
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 3 att_tx = 3
att_rx = 0; att_rx = 6;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 115;
@@ -53,7 +53,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="000011"> <testCase id="000011">
@@ -44,7 +44,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="800813"> <testCase id="800813">
<class>Create_Workspace</class> <class>Create_Workspace</class>
@@ -48,7 +48,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="800813"> <testCase id="800813">
<class>Create_Workspace</class> <class>Create_Workspace</class>
@@ -48,7 +48,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="800813"> <testCase id="800813">
<class>Create_Workspace</class> <class>Create_Workspace</class>
@@ -41,7 +41,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="800813"> <testCase id="800813">
<class>Create_Workspace</class> <class>Create_Workspace</class>
@@ -41,7 +41,7 @@
<class>Pull_Local_Registry</class> <class>Pull_Local_Registry</class>
<desc>Pull Images from Local Registry</desc> <desc>Pull Images from Local Registry</desc>
<test_svr_id>0</test_svr_id> <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>
<testCase id="800813"> <testCase id="800813">
<class>Create_Workspace</class> <class>Create_Workspace</class>
@@ -178,7 +178,7 @@ services:
retries: 5 retries: 5
oai_enb: oai_enb:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: l2sim4g-oai-enb container_name: l2sim4g-oai-enb
network_mode: "host" network_mode: "host"
@@ -210,7 +210,7 @@ services:
retries: 5 retries: 5
oai_ue1: oai_ue1:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: l2sim4g-oai-lte-ue1 container_name: l2sim4g-oai-lte-ue1
network_mode: "host" network_mode: "host"
@@ -229,7 +229,7 @@ services:
retries: 5 retries: 5
oai_ue2: oai_ue2:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: l2sim4g-oai-lte-ue2 container_name: l2sim4g-oai-lte-ue2
network_mode: "host" network_mode: "host"
@@ -178,7 +178,7 @@ services:
retries: 5 retries: 5
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -186,6 +186,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band7.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf
@@ -196,7 +197,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -206,6 +207,7 @@ services:
- "10000" - "10000"
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -1,6 +1,6 @@
services: services:
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -8,6 +8,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1
volumes: volumes:
- ../../conf_files/enb.band7.25prb.rfsim.nos1.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.25prb.rfsim.nos1.conf:/opt/oai-enb/etc/enb.conf
@@ -18,7 +19,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -28,6 +29,7 @@ services:
- "10000" - "10000"
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -178,7 +178,7 @@ services:
retries: 5 retries: 5
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -186,6 +186,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band7.50prb.rfsim.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.50prb.rfsim.conf:/opt/oai-enb/etc/enb.conf
@@ -196,7 +197,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -206,6 +207,7 @@ services:
- "10000" - "10000"
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -178,7 +178,7 @@ services:
retries: 5 retries: 5
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -186,6 +186,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band7.100prb.rfsim.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.100prb.rfsim.conf:/opt/oai-enb/etc/enb.conf
@@ -196,7 +197,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -206,6 +207,7 @@ services:
- "10000" - "10000"
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -1,6 +1,6 @@
services: services:
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -8,6 +8,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris 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 USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --eNBs.[0].component_carriers.[0].mbms_dedicated_serving_cell ENABLE --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf
@@ -18,7 +19,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -26,6 +27,7 @@ services:
ipv4_address: 192.168.61.30 ipv4_address: 192.168.61.30
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -1,6 +1,6 @@
services: services:
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -8,6 +8,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --log_config.global_log_options level,nocolor,time USE_ADDITIONAL_OPTIONS: --rfsim --noS1 --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band7.tm1.25prb.rfsim.mbms.conf:/opt/oai-enb/etc/enb.conf
@@ -18,7 +19,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -31,6 +32,7 @@ services:
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
HOSTNAME: oai_ue0 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 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: volumes:
- ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-mbs.conf:/opt/oai-lte-ue/etc/ue_usim.conf
@@ -178,7 +178,7 @@ services:
retries: 5 retries: 5
oai_enb0: oai_enb0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-enb:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${ENB_IMG:-oai-enb}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-enb container_name: rfsim4g-oai-enb
networks: networks:
@@ -186,6 +186,7 @@ services:
ipv4_address: 192.168.61.20 ipv4_address: 192.168.61.20
environment: environment:
TZ: Europe/Paris TZ: Europe/Paris
ASAN_OPTIONS: detect_leaks=0
USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time
volumes: volumes:
- ../../conf_files/enb.band38.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf - ../../conf_files/enb.band38.25prb.rfsim.conf:/opt/oai-enb/etc/enb.conf
@@ -196,7 +197,7 @@ services:
retries: 5 retries: 5
oai_ue0: oai_ue0:
image: ${REGISTRY:-oaisoftwarealliance}/oai-lte-ue:${TAG:-develop} image: ${REGISTRY:-oaisoftwarealliance}/${LTEUE_IMG:-oai-lte-ue}:${TAG:-develop}
privileged: true privileged: true
container_name: rfsim4g-oai-lte-ue0 container_name: rfsim4g-oai-lte-ue0
networks: networks:
@@ -206,6 +207,7 @@ services:
- "10000" - "10000"
environment: environment:
TZ: Europe/Paris 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 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: volumes:
- ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf - ../../conf_files/lteue.usim-ci.conf:/opt/oai-lte-ue/etc/ue_usim.conf
+1 -1
View File
@@ -1095,7 +1095,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
exit(-1); exit(-1);
} else { } else {
eNB->dlsch[i][j]->rnti=0; 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);
} }
} }
} }
+7 -6
View File
@@ -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++) for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++)
samplesVoid[i]=(void *)&v; samplesVoid[i]=(void *)&v;
AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, int written = UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+2*UE->frame_parms.samples_per_tti, timestamp + 2 * UE->frame_parms.samples_per_tti,
samplesVoid, samplesVoid,
1, 1,
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
1),""); TX_BURST_START_AND_END);
AssertFatal(1 == written, "write to SDR failed\n");
} }
void *UE_thread(void *arg) { void *UE_thread(void *arg) {
+9 -6
View File
@@ -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"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (int i=0; i<NUMBER_OF_ULSCH_MAX; i++) { 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 (type == SEARCH_EXIST_RA) {
if (eNB->ulsch[i]->rnti == rnti) return i; if (eNB->ulsch[i]->rnti == rnti)
return i;
} else { } else {
if ((eNB->ulsch[i]->harq_mask >0) && if (eNB->ulsch[i]->harq_mask > 0 && eNB->ulsch[i]->rnti == rnti)
(eNB->ulsch[i]->rnti==rnti)) return i; return i;
else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=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) { if(frame_parms->frame_type == TDD) {
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE); 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; eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
} }
} }
+6 -2
View File
@@ -160,8 +160,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); 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", LOG_D(PHY,
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]); "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]) { if (dlsch->harq_processes[i]) {
bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
+1 -3
View File
@@ -1121,8 +1121,6 @@ void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
} }
void clear_ulsch_stats(PHY_VARS_eNB *eNB) { void clear_ulsch_stats(PHY_VARS_eNB *eNB) {
memset(eNB->ulsch_stats, 0, sizeof(eNB->ulsch_stats));
for (int i=0;i<NUMBER_OF_ULSCH_MAX;i++)
memset((void*)&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i]));
} }
+14 -3
View File
@@ -1339,9 +1339,20 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
ulsch_harq = ulsch->harq_processes[harq_pid]; 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", if (ulsch->rnti > 0)
i, harq_pid, frame,subframe,i,ulsch->rnti, LOG_D(PHY,
ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled); "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) && if ((ulsch->rnti>0) &&
(ulsch_harq->status == ACTIVE) && (ulsch_harq->status == ACTIVE) &&
+1 -1
View File
@@ -2980,7 +2980,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue,
ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; ue->dlsch_mch_received_sf[subframe_rx%5][0]=0;
} else { } else {
ue->dlsch_mch_received[0]+=1; 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 } // decoding sucessful
} // pmch_mcs>=0 } // pmch_mcs>=0
+1 -1
View File
@@ -167,7 +167,7 @@ typedef struct as_stmsi_s {
/* Dedicated NAS information */ /* Dedicated NAS information */
typedef struct as_nas_info_s { typedef struct as_nas_info_s {
uint32_t length; /* Length of the NAS information data */ 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; } as_nas_info_t;
/* Radio Access Bearer identity */ /* Radio Access Bearer identity */
+15 -15
View File
@@ -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) MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req)
// UE: NAS -> RRC messages // UE: NAS -> RRC messages
MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_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, NasCellSelectionReq, nas_cell_selection_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, NasConnEstabliReq, nas_conn_establi_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, NasUlDataReq, nas_ul_data_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, NasDetachReq, nas_detach_req) MESSAGE_DEF(NAS_DETACH_REQ, MESSAGE_PRIORITY_MED, nas_detach_req_t, nas_detach_req)
MESSAGE_DEF(NAS_DEREGISTRATION_REQ, MESSAGE_PRIORITY_MED, NasDeregistrationReq, nas_deregistration_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 // UE: RRC -> NAS messages
MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf) 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, NasCellSelectionInd, nas_cell_selection_ind) 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, NasPagingInd, nas_paging_ind) MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, paging_ind_t, nas_paging_ind)
MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, NasConnEstabCnf, nas_conn_establi_cnf) 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, NasConnReleaseInd, nas_conn_release_ind) 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(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_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, ul_info_transfer_cnf_t, nas_ul_data_cnf)
MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd, nas_dl_data_ind) MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, dl_info_transfer_ind_t, nas_dl_data_ind)
// xNB: realtime -> RRC messages // xNB: realtime -> RRC messages
MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process) MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeProcess, rrc_subframe_process)
+1 -22
View File
@@ -422,28 +422,7 @@ typedef struct NRDuDlReq_s {
rnti_t rnti; rnti_t rnti;
uint8_t *buf; uint8_t *buf;
uint64_t srb_id; uint64_t srb_id;
} NRDuDlReq_t; } 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;
// eNB: realtime -> RRC messages // eNB: realtime -> RRC messages
typedef struct rrc_subframe_process_s { typedef struct rrc_subframe_process_s {
+1 -24
View File
@@ -888,30 +888,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
pdcp_remove_UE(&ctxt); pdcp_remove_UE(&ctxt);
} }
/* Note: This should not be done in the MAC! */ int id;
/*
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;
// clean ULSCH entries for rnti // clean ULSCH entries for rnti
id = find_ulsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST); id = find_ulsch(rnti,RC.eNB[module_idP][CC_id],SEARCH_EXIST);
+8 -7
View File
@@ -449,7 +449,7 @@ void generate_Msg2(module_id_t module_idP,
add_msg3 (module_idP, CC_idP, ra, frameP, subframeP); add_msg3 (module_idP, CC_idP, ra, frameP, subframeP);
ra->eRA_state = WAITMSG3; ra->eRA_state = WAITMSG3;
/* DL request */ /* 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, module_idP,
frameP, frameP,
subframeP); subframeP);
@@ -465,12 +465,13 @@ void generate_Msg2(module_id_t module_idP,
} }
} else { } else {
if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
LOG_D(MAC, LOG_I(MAC,
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %s\n", "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI for rnti %x, state %s\n",
module_idP, module_idP,
CC_idP, CC_idP,
frameP, frameP,
subframeP, subframeP,
ra->RA_rnti,
era_text[ra->eRA_state]); era_text[ra->eRA_state]);
// Allocate 4 PRBS starting in RB 0 // Allocate 4 PRBS starting in RB 0
first_rb = 0; first_rb = 0;
@@ -1227,7 +1228,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
} // Msg4 frame/subframe } // Msg4 frame/subframe
} // regular LTE case } // regular LTE case
} else { } else {
LOG_D(MAC, LOG_I(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n", "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n",
module_idP, CC_idP, frameP, subframeP); module_idP, CC_idP, frameP, subframeP);
ra->eRA_state = IDLE; ra->eRA_state = IDLE;
@@ -1284,7 +1285,7 @@ initiate_ra_proc(module_id_t module_idP,
) { ) {
uint8_t i; uint8_t i;
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; 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; struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = 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) { rnti_t rnti) {
unsigned char i; unsigned char i;
RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; 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", "[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n",
module_idP, CC_id, frameP, rnti); 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]; RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0];
for (i = 0; i < NB_RA_PROC_MAX; i++) { 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].eRA_state = IDLE;
ra[i].timing_offset = 0; ra[i].timing_offset = 0;
ra[i].RRC_timer = 20; ra[i].RRC_timer = 20;
@@ -3471,7 +3471,7 @@ CCE_allocation_infeasible(int module_idP,
if (format_flag != 2) { // DL DCI if (format_flag != 2) { // DL DCI
if (DL_req->number_pdu == MAX_NUM_DL_PDU) { 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 { } 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->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; 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 } else { // ue-specific UL DCI
if (HI_DCI0_req->number_of_dci + HI_DCI0_req->number_of_hi == MAX_NUM_HI_DCI0_PDU) { 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 { } else {
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; 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; 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; 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) { 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; 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; 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) { 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; return -1;
} }
+1 -1
View File
@@ -506,7 +506,7 @@ typedef struct {
/*!\brief RA process state*/ /*!\brief RA process state*/
typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } eRA_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*/ /*!\brief UE DLSCH scheduling states*/
typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS; typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS;
+14 -12
View File
@@ -557,6 +557,9 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
break; 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); 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[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]++; 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; break;
} }
} }
if( pdcp_uid < MAX_MOBILES_PER_ENB ) {
Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; 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_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[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_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_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[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_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; 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); free(sdu_buffer_pP);
if (ctxt_pP->enb_flag) { 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) { 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; 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); 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_init_mbms("oaitun_uem", id + 1);
tun_config(1, "10.0.2.2", NULL, "oaitun_uem"); tun_config(1, "10.0.2.2", NULL, "oaitun_uem");
LOG_I(PDCP, "UE pdcp will use tun interface\n"); LOG_I(PDCP, "UE pdcp will use tun interface\n");
+6 -11
View File
@@ -97,8 +97,7 @@ void mac_rlc_data_ind (
rb->set_time(rb, rlc_current_time); rb->set_time(rb, rlc_current_time);
rb->recv_pdu(rb, buffer_pP, tb_sizeP); rb->recv_pdu(rb, buffer_pP, tb_sizeP);
} else { } else {
LOG_E(RLC, "%s:%d:%s: fatal: no RB found (rnti %d channel ID %d)\n", LOG_E(RLC, "fatal: no RB found (rnti %x channel ID %d)\n", rnti, channel_id);
__FILE__, __LINE__, __FUNCTION__, rnti, channel_id);
exit(1); exit(1);
} }
@@ -388,9 +387,7 @@ static void deliver_sdu(void *_ue, rlc_entity_t *entity, char *buf, int size)
exit(1); exit(1);
rb_found: rb_found:
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", LOG_D(RLC, "delivering SDU (rnti %x is_srb %d rb_id %d) size %d", ue->rnti, is_srb, rb_id, size);
__FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size);
/* unused fields? */ /* unused fields? */
ctx.instance = ue->module_id; ctx.instance = ue->module_id;
@@ -419,9 +416,7 @@ rb_found:
} }
memcpy(memblock, buf, size); memcpy(memblock, buf, size);
if (!pdcp_data_ind(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) { 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", LOG_E(RLC, "ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %x)\n", is_srb, rb_id, ue->rnti);
__FILE__, __LINE__, __FUNCTION__,
is_srb, rb_id, ue->rnti);
/* what to do in case of failure? for the moment: nothing */ /* 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); poll_pdu, poll_byte, max_retx_threshold);
rlc_ue_add_srb_rlc_entity(ue, srb_id, rlc_am); 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); rlc_manager_unlock(rlc_ue_manager);
} }
@@ -944,7 +939,7 @@ rlc_op_status_t rrc_rlc_config_req (
exit(1); exit(1);
} }
rlc_manager_lock(rlc_ue_manager); 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); ue = rlc_manager_get_ue(rlc_ue_manager, ctxt_pP->rntiMaybeUEid);
if (srb_flagP) { if (srb_flagP) {
if (ue->srb[rb_idP-1] != NULL) { 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) 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_lock(rlc_ue_manager);
rlc_manager_remove_ue(rlc_ue_manager, x->rntiMaybeUEid); rlc_manager_remove_ue(rlc_ue_manager, x->rntiMaybeUEid);
rlc_manager_unlock(rlc_ue_manager); rlc_manager_unlock(rlc_ue_manager);
+1 -1
View File
@@ -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) if (m->ue_list[i]->rnti == rnti)
return m->ue_list[i]; 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_count++;
m->ue_list = realloc(m->ue_list, sizeof(rlc_ue_t *) * m->ue_count); m->ue_list = realloc(m->ue_list, sizeof(rlc_ue_t *) * m->ue_count);
+1 -2
View File
@@ -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)); 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++) { for (int i = 0; i < rx_ind->number_of_pdus; i++) {
if (!crc_ind_has_rnti(crc_ind, rx_ind->pdu_list[i].rnti)) { 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", 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);
i, rx_ind->pdu_list[i].rnti);
rx_ind_unmatched->pdu_list[num_unmatched_rxs] = rx_ind->pdu_list[i]; rx_ind_unmatched->pdu_list[num_unmatched_rxs] = rx_ind->pdu_list[i];
num_unmatched_rxs++; num_unmatched_rxs++;
remove_rx_pdu(rx_ind, i); remove_rx_pdu(rx_ind, i);
+33 -31
View File
@@ -536,18 +536,18 @@ rrc_t310_expiration(
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void rrc_ue_generate_RRCConnectionSetupComplete( static void rrc_ue_generate_RRCConnectionSetupComplete(const protocol_ctxt_t *const ctxt_pP,
const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
const uint8_t eNB_index, const uint8_t Transaction_id,
const uint8_t Transaction_id, uint8_t sel_plmn_id)
uint8_t sel_plmn_id) { {
uint8_t buffer[100]; uint8_t buffer[100];
uint8_t size; uint8_t size;
const char *nas_msg; const char *nas_msg;
int nas_msg_length; int nas_msg_length;
if (EPC_MODE_ENABLED) { 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; nas_msg_length = UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
} else { } else {
nas_msg = nas_attach_req_imsi; nas_msg = nas_attach_req_imsi;
@@ -771,7 +771,7 @@ rrc_ue_establish_drb(
"10.0.%d.%d", "10.0.%d.%d",
UE_NAS_USE_TUN ? 1 : (ip_addr_offset3 + ue_mod_idP + 1), UE_NAS_USE_TUN ? 1 : (ip_addr_offset3 + ue_mod_idP + 1),
ip_addr_offset4 + 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 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", 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 NCE
#undef chk #undef chk
} }
/** \brief process the received rrcConnectionReconfiguration message at UE
//----------------------------------------------------------------------------- \param ctxt_pP Running context
void \param *rrcConnectionReconfiguration pointer to the sturcture
rrc_ue_process_rrcConnectionReconfiguration( \param eNB_index Index of corresponding eNB/CH*/
const protocol_ctxt_t *const ctxt_pP, static void rrc_ue_process_rrcConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
uint8_t eNB_index uint8_t eNB_index)
)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n", 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); 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).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; 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); 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"); LOG_D(RRC, "Sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n");
@@ -2185,14 +2184,17 @@ rrc_detach_from_eNB(
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void /** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
rrc_ue_decode_dcch( \param ctxt_pP Running context
const protocol_ctxt_t *const ctxt_pP, \param Srb_id Index of Srb (1,2)
const rb_id_t Srb_id, \param Buffer Pointer to received SDU
const uint8_t *const Buffer, \param Buffer_size
const uint32_t Buffer_size, \param eNB_indexP Index of corresponding eNB/CH*/
const uint8_t eNB_indexP 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; //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 */ /* This message hold a dedicated info NAS payload, forward it to NAS */
struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType =
&dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType; &dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType;
uint32_t pdu_length;
uint8_t *pdu_buffer;
MessageDef *msg_p; MessageDef *msg_p;
pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; uint32_t pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size;
pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; 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); 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).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.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); 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 (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_ue_generate_RRCConnectionRequest(ctxt_pP, 0);
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_CONNECTING ); 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; 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); 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) */ /* 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 */ /* 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); 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);
+21 -15
View File
@@ -98,6 +98,8 @@
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h"
#define ASN_MAX_ENCODE_SIZE 4096 #define ASN_MAX_ENCODE_SIZE 4096
#define NUMBEROF_DRBS_TOBE_ADDED 1 #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); 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) { void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) {
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
pthread_mutex_lock(&lock_ue_freelist); 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; int i;
for (i=0; i < sizeofArray(eNB_MAC->UE_free_ctrl); i++) for (i=0; i < sizeofArray(eNB_MAC->UE_free_ctrl); i++)
if (eNB_MAC->UE_free_ctrl[i].rnti == 0) 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].rnti = rnti;
eNB_MAC->UE_free_ctrl[i].removeContextFlg = removeFlag; eNB_MAC->UE_free_ctrl[i].removeContextFlg = removeFlag;
eNB_MAC->UE_free_ctrl[i].raFlag = 0; 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; 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.number_of_TLVs++; 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); 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) { void release_UE_in_freeList(module_id_t mod_id) {
PHY_VARS_eNB *eNB_PHY = NULL; PHY_VARS_eNB *eNB_PHY = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id]; 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; int id;
// clean ULSCH entries for rnti // clean ULSCH entries for rnti
id = find_ulsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); id = find_ulsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id >= 0) if (id >= 0)
clean_eNb_ulsch(eNB_PHY->ulsch[id]); clean_eNb_ulsch(eNB_PHY->ulsch[id]);
// clean DLSCH entries for rnti // clean DLSCH entries for rnti
id = find_dlsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST); id = find_dlsch(rnti, eNB_PHY, eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id >= 0) if (id >= 0)
clean_eNb_dlsch(eNB_PHY->dlsch[id][0]); clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
@@ -3886,7 +3888,11 @@ check_handovers(
ue_context_p->ue_context.handover_info->buf, ue_context_p->ue_context.handover_info->buf,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
ue_context_p->ue_context.handover_info->state = HO_COMPLETE; 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 */ /* 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); ue_context = rrc_eNB_get_ue_context(RC.rrc[module_id], m->rnti);
if (ue_context == NULL) { 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; return;
} }
if (ue_context->ue_context.StatusRrc != RRC_NR_NSA) { 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; 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; 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); ue_context = rrc_eNB_find_ue_context_from_gnb_rnti(RC.rrc[module_id], m->gnb_rnti);
if (ue_context == NULL) { 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; return;
} }
-26
View File
@@ -93,21 +93,6 @@ rrc_rx_tx_ue(
\param eNB_index Index of corresponding eNB/CH*/ \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 ); 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( int decode_SL_Discovery_Message(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index, const uint8_t eNB_index,
@@ -123,17 +108,6 @@ rrc_ue_generate_RRCConnectionRequest(
const uint8_t eNB_index 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 /** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
\param module_idP Instance ID of UE \param module_idP Instance ID of UE
\param frameP Frame index \param frameP Frame index
+3 -3
View File
@@ -391,12 +391,12 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
rrc_gNB_ue_context_t *ue_context; rrc_gNB_ue_context_t *ue_context;
int e_rab; 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); 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); ue_context = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context == NULL) { 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; return;
} }
@@ -411,7 +411,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
gtpv1u_enb_delete_tunnel_req_t tmp={0}; gtpv1u_enb_delete_tunnel_req_t tmp={0};
tmp.rnti=rnti; tmp.rnti=rnti;
tmp.from_gnb=1; 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++) { 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]; tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.nsa_gtp_ebi[e_rab];
// erase data // erase data
+9 -8
View File
@@ -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; struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *tmp = ext->dedicatedNAS_MessageList;
for (int i = 0; i < tmp->list.count; i++) { 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); 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->errCode = AS_SUCCESS;
msg->nasMsg.length = tmp->list.array[i]->size; 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); itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg);
} }
tmp->list.count = 0; // to prevent the automatic free by ASN1_FREE 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; as_nas_info_t initialNasMsg;
nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id); nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id);
generateRegistrationRequest(&initialNasMsg, nas); generateRegistrationRequest(&initialNasMsg, nas);
nas_msg = (char*)initialNasMsg.data; nas_msg = (char *)initialNasMsg.nas_data;
nas_msg_length = initialNasMsg.length; nas_msg_length = initialNasMsg.length;
} else { } else {
nas_msg = nr_nas_attach_req_imsi_dummy_NSA_case; 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; dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message;
MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, rrc->ue_id, NAS_DOWNLINK_DATA_IND); 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->UEid = rrc->ue_id;
msg->nasMsg.length = dedicatedNAS_Message->size; 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); 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 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: { case NAS_UPLINK_DATA_REQ: {
uint32_t length; uint32_t length;
uint8_t *buffer = NULL; 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) */ /* 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 */ /* Transfer data to PDCP */
// check if SRB2 is created, if yes request data_req on SRB2 // check if SRB2 is created, if yes request data_req on SRB2
// error: the remote gNB is hardcoded here // error: the remote gNB is hardcoded here
rb_id_t srb_id = rrc->Srb[2] == RB_ESTABLISHED ? 2 : 1; 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); 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); free(buffer);
break; break;
} }
+18 -34
View File
@@ -80,65 +80,55 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int bytes;
/* pointers to msg fields possibly not aligned because msg points to a packed structure /* 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 * 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 * 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...) * (in fact i don't understand this code data seems to be useless...)
*/ */
Byte_t *data = NULL;
/* Get the message type */ /* Get the message type */
msg->msgID = *(uint16_t*)(buffer); msg->msgID = *(uint16_t*)(buffer);
bytes = sizeof(uint16_t); int bytes = 0;
switch (msg->msgID) { switch (msg->msgID) {
case AS_NAS_ESTABLISH_REQ: case AS_NAS_ESTABLISH_REQ:
/* NAS signalling connection establish request */ /* NAS signalling connection establish request */
bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(nas_establish_req_t) - sizeof(as_nas_info_t);
data = msg->msg.nas_establish_req.initialNasMsg.data;
break; break;
case AS_NAS_ESTABLISH_IND: case AS_NAS_ESTABLISH_IND:
/* NAS signalling connection establishment indication */ /* NAS signalling connection establishment indication */
bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(nas_establish_ind_t) - sizeof(as_nas_info_t);
data = msg->msg.nas_establish_ind.initialNasMsg.data;
break; break;
case AS_NAS_ESTABLISH_RSP: case AS_NAS_ESTABLISH_RSP:
/* NAS signalling connection establishment response */ /* NAS signalling connection establishment response */
bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(nas_establish_rsp_t) - sizeof(as_nas_info_t);
data = msg->msg.nas_establish_rsp.nasMsg.data;
break; break;
case AS_NAS_ESTABLISH_CNF: case AS_NAS_ESTABLISH_CNF:
/* NAS signalling connection establishment confirm */ /* NAS signalling connection establishment confirm */
bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(nas_establish_cnf_t) - sizeof(as_nas_info_t);
data = msg->msg.nas_establish_cnf.nasMsg.data;
break; break;
case AS_UL_INFO_TRANSFER_REQ: case AS_UL_INFO_TRANSFER_REQ:
/* Uplink L3 data transfer request */ /* Uplink L3 data transfer request */
bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_req_t) - sizeof(as_nas_info_t);
data = msg->msg.ul_info_transfer_req.nasMsg.data;
break; break;
case AS_UL_INFO_TRANSFER_IND: case AS_UL_INFO_TRANSFER_IND:
/* Uplink L3 data transfer indication */ /* Uplink L3 data transfer indication */
bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(ul_info_transfer_ind_t) - sizeof(as_nas_info_t);
data = msg->msg.ul_info_transfer_ind.nasMsg.data;
break; break;
case AS_DL_INFO_TRANSFER_REQ: case AS_DL_INFO_TRANSFER_REQ:
/* Downlink L3 data transfer request */ /* Downlink L3 data transfer request */
bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_req_t) - sizeof(as_nas_info_t);
data = msg->msg.dl_info_transfer_req.nasMsg.data;
break; break;
case AS_DL_INFO_TRANSFER_IND: case AS_DL_INFO_TRANSFER_IND:
/* Downlink L3 data transfer indication */ /* Downlink L3 data transfer indication */
bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*); bytes = sizeof(uint16_t) + sizeof(dl_info_transfer_ind_t) - sizeof(as_nas_info_t);
data = msg->msg.dl_info_transfer_ind.nasMsg.data;
break; break;
case AS_BROADCAST_INFO_IND: 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 (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 */ /* Decode the message */
memcpy(msg, (as_message_t*)buffer, bytes); memcpy(msg, buffer, bytes);
LOG_FUNC_RETURN (msg->msgID); 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 */ /* NAS signalling connection establish indication */
bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*);
nas_msg = msg->msg.nas_establish_ind.initialNasMsg; 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; len=msg->msg.nas_establish_ind.initialNasMsg.length;
break; break;
@@ -269,7 +253,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
/* NAS signalling connection establish confirm */ /* NAS signalling connection establish confirm */
bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*);
nas_msg = msg->msg.nas_establish_cnf.nasMsg; 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; len=msg->msg.nas_establish_ind.initialNasMsg.length;
break; break;
@@ -361,10 +345,10 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
if ( (dataptr!=NULL) && (len > 0) ) { if ( (dataptr!=NULL) && (len > 0) ) {
/* Copy the NAS message */ /* 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; bytes += len;
/* Release NAS message memory */ /* Release NAS message memory */
free(nas_msg.data); free(nas_msg.nas_data);
len=0; len=0;
dataptr = NULL; dataptr = NULL;
} }
@@ -535,7 +535,8 @@ int nas_message_encode(
#endif #endif
emm_security_context); emm_security_context);
/* Set the message authentication code of the NAS message */ /* 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) { if (emm_security_context) {
#ifdef NAS_MME #ifdef NAS_MME
+11 -37
View File
@@ -91,19 +91,12 @@ static struct {
/* /*
* The buffer used to receive data from the network sublayer * The buffer used to receive data from the network sublayer
*/ */
#define NETWORK_API_RECV_BUFFER_SIZE 4096 #define NETWORK_API_RECV_BUFFER_SIZE 4096
static char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE];
/* /*
* The buffer used to send data to the network sublayer * The buffer used to send data to the network sublayer
*/ */
#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE #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 */
/****************************************************************************/ /****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** 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))); ((errno < 0) ? gai_strerror(errno) : strerror(errno)));
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE];
gethostname(_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", 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()); 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() ** ** Name: network_api_read_data() **
@@ -213,7 +186,7 @@ const void* network_api_get_data(void)
** Others: _network_api_recv_buffer, _network_api_id ** ** 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; LOG_FUNC_IN;
@@ -263,7 +236,7 @@ int network_api_read_data(int fd)
** Others: None ** ** 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; LOG_FUNC_IN;
@@ -346,12 +319,12 @@ void network_api_close(int fd)
** Others: _as_data ** ** 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; LOG_FUNC_IN;
/* Decode the Access Stratum message received from the network */ /* 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) { if (as_id != RETURNerror) {
LOG_TRACE(INFO, "NET-API - AS message id=0x%x successfully decoded", 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 ** ** 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; 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 " LOG_TRACE(INFO, "NET-API - Send message 0x%.4x to the Access Stratum "
"layer", as_msg->msgID); "layer", as_msg->msgID);
char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE];
/* Encode the AS message */ /* 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) { if (bytes > 0) {
/* Get the network file descriptor */ /* Get the network file descriptor */
@@ -425,7 +399,7 @@ int as_message_send(as_message_t* as_msg)
if (fd != RETURNerror) { if (fd != RETURNerror) {
/* Send the AS message to the network */ /* 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);
} }
} }
@@ -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 ******************/ /****************** 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_initialize(const char* host, const char* port);
int network_api_get_fd(void); int network_api_get_fd(void);
const void* network_api_get_data(void);
int network_api_read_data(int fd); int network_api_read_data(int fd, char *_network_api_recv_buffer);
int network_api_send_data(int fd, int length);
void network_api_close(int fd); void network_api_close(int fd);
int network_api_decode_data(int length); int network_api_decode_data(char *_network_api_recv_buffer, int length, as_message_t *_as_data);
int network_api_encode_data(void* data);
#endif /* __NETWORK_API_H__*/ #endif /* __NETWORK_API_H__*/
+6 -2
View File
@@ -62,8 +62,12 @@
#define IES_DECODE_U8(bUFFER, dECODED, vALUE) \ #define IES_DECODE_U8(bUFFER, dECODED, vALUE) \
DECODE_U8(bUFFER + dECODED, vALUE, dECODED) DECODE_U8(bUFFER + dECODED, vALUE, dECODED)
#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ #define IES_DECODE_U16(bUFFER, dECODED, vALUE) \
DECODE_U16(bUFFER + dECODED, vALUE, dECODED) do { \
uint16_t val; \
memcpy(&val, bUFFER + dECODED, sizeof(val)); \
DECODE_U16(&val, vALUE, dECODED); \
} while (0)
#define IES_DECODE_U24(bUFFER, dECODED, vALUE) \ #define IES_DECODE_U24(bUFFER, dECODED, vALUE) \
DECODE_U24(bUFFER + dECODED, vALUE, dECODED) DECODE_U24(bUFFER + dECODED, vALUE, dECODED)
+41 -41
View File
@@ -543,10 +543,10 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas)
size += 10; size += 10;
// encode the message // encode the message
initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t)); initialNasMsg->nas_data = malloc16_clear(size * sizeof(Byte_t));
nas->registration_request_buf = initialNasMsg->data; 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; nas->registration_request_len = initialNasMsg->length;
} }
@@ -575,9 +575,9 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype
} }
// encode the message // 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) 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; mm_msg->fgs_auth_response.authenticationresponseparameter.res = res;
size += 18; size += 18;
// encode the message // 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 after encode
free(res.value); 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); size += (nas->registration_request_len + 2);
// encode the message // 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 = initialNasMsg->length =
security_header_len 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 */ /* ciphering */
uint8_t buf[initialNasMsg->length - 7]; 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.count = nas->security.nas_count_ul;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_cipher.blength = (initialNasMsg->length - 7) << 3;
stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); 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.count = nas->security.nas_count_ul++;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 6) << 3; 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]); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]);
for (int i = 0; i < 4; i++) { 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 // encode the message
initialNasMsg->data = (Byte_t *)malloc(length * sizeof(Byte_t)); initialNasMsg->nas_data = malloc(length * sizeof(Byte_t));
initialNasMsg->length = length; initialNasMsg->length = length;
/* Encode the first octet of the header (extended protocol discriminator) */ /* 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 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 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 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 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 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 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) { 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 */ /* ciphering */
@@ -826,7 +826,7 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas,
stream_cipher.count = nas->security.nas_count_ul; stream_cipher.count = nas->security.nas_count_ul;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_cipher.blength = (initialNasMsg->length - 7) << 3;
stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); 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.count = nas->security.nas_count_ul++;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_cipher.blength = (initialNasMsg->length - 6) << 3;
stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); 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]); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]);
for (int i = 0; i < 4; i++) { 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); size += fill_guti(&dereg_req->fgsmobileidentity, nas->guti);
// encode the message // encode the message
initialNasMsg->data = calloc(size, sizeof(Byte_t)); initialNasMsg->nas_data = calloc(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 = initialNasMsg->length =
security_header_len 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; 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.count = nas->security.nas_count_ul;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_cipher.blength = (initialNasMsg->length - 7) << 3;
stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); 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.count = nas->security.nas_count_ul++;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_cipher.blength = (initialNasMsg->length - 6) << 3;
uint8_t mac[4]; 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]); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]);
for (int i = 0; i < 4; i++) { 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); size += (1 + 1 + dnnSize + 1);
// encode the message // encode the message
initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); initialNasMsg->nas_data = (Byte_t *)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 = initialNasMsg->length =
security_header_len 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 allocated memory after encode
free(req_buffer); 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.count = nas->security.nas_count_ul;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 7); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 7);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 7) << 3; stream_cipher.blength = (initialNasMsg->length - 7) << 3;
stream_compute_encrypt(nas->security_container->ciphering_algorithm, &stream_cipher, buf); 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.count = nas->security.nas_count_ul++;
stream_cipher.bearer = 1; stream_cipher.bearer = 1;
stream_cipher.direction = 0; stream_cipher.direction = 0;
stream_cipher.message = (unsigned char *)(initialNasMsg->data + 6); stream_cipher.message = (unsigned char *)(initialNasMsg->nas_data + 6);
/* length in bits */ /* length in bits */
stream_cipher.blength = (initialNasMsg->length - 6) << 3; stream_cipher.blength = (initialNasMsg->length - 6) << 3;
stream_compute_integrity(nas->security_container->integrity_algorithm, &stream_cipher, mac); 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]); printf("mac %x %x %x %x \n", mac[0], mac[1], mac[2], mac[3]);
for (int i = 0; i < 4; i++) { 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); 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); ul_info_transfer_req_t *req = &NAS_UPLINK_DATA_REQ(msg);
req->UEid = nas->UE_id; 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; req->nasMsg.length = initial_nas_msg->length;
itti_send_msg_to_task(TASK_RRC_NRUE, nas->UE_id, msg); 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).errCode,
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length); 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; 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); 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, nas->UE_id,
ITTI_MSG_NAME(msg_p), ITTI_MSG_NAME(msg_p),
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length, 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}; 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; 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); security_state_t security_state = nas_security_rx_process(nas, pdu_buffer, pdu_length);
+60 -92
View File
@@ -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 * 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 * 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 *, static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *, ul_info_transfer_req_t *as_msg);
void *ul_info_transfer_req_unaligned); 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_establish_req(const emm_data_t *emm_data, const emm_as_establish_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);
void *nas_establish_req_unaligned); 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_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, void *ul_info_transfer_req_unaligned); static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *as_msg);
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);
/****************************************************************************/ /****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** 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 */ /* 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 */ /* Encode the NAS message */
bytes = nas_message_encode( bytes = nas_message_encode((char *)(info->nas_data), msg, length, emm_security_context);
(char *)(info->data),
msg,
length,
emm_security_context);
if (bytes > 0) { if (bytes > 0) {
info->length = bytes; info->length = bytes;
} else { } else {
free(info->data); free(info->nas_data);
info->length = 0; info->length = 0;
info->data = NULL; info->nas_data = NULL;
} }
} }
@@ -895,23 +889,18 @@ _emm_as_encrypt(
} }
/* Allocate memory to the NAS information container */ /* 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 */ /* Encrypt the NAS information message */
bytes = nas_message_encrypt( bytes = nas_message_encrypt(msg, (char *)(info->nas_data), header, length, emm_security_context);
msg,
(char *)(info->data),
header,
length,
emm_security_context);
if (bytes > 0) { if (bytes > 0) {
info->length = bytes; info->length = bytes;
} else { } else {
free(info->data); free(info->nas_data);
info->length = 0; 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; LOG_FUNC_IN;
as_message_t as_msg; as_message_t as_msg = {0};
memset(&as_msg, 0 , sizeof(as_message_t));
switch (msg->primitive) { switch (msg->primitive) {
case _EMMAS_DATA_REQ: case _EMMAS_DATA_REQ: {
as_msg.msgID = _emm_as_data_req(user->emm_data, ul_info_transfer_req_t ul = {0};
&msg->u.data, as_msg.msgID = _emm_as_data_req(user->emm_data, &msg->u.data, &ul);
(void *)(&as_msg.msg.ul_info_transfer_req)); as_msg.msg.ul_info_transfer_req = ul;
break; } break;
case _EMMAS_STATUS_IND: case _EMMAS_STATUS_IND: {
as_msg.msgID = _emm_as_status_ind(user->emm_data, ul_info_transfer_req_t st = {0};
&msg->u.status, as_msg.msgID = _emm_as_status_ind(user->emm_data, &msg->u.status, &st);
(void *)(&as_msg.msg.ul_info_transfer_req)); as_msg.msg.ul_info_transfer_req = st;
break; } break;
case _EMMAS_RELEASE_REQ: case _EMMAS_RELEASE_REQ: {
as_msg.msgID = _emm_as_release_req( nas_release_req_t rel = {0};
&msg->u.release, as_msg.msgID = _emm_as_release_req(&msg->u.release, &rel);
(void *)(&as_msg.msg.nas_release_req)); as_msg.msg.nas_release_req = rel;
break; } 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_SECURITY_RES: case _EMMAS_ESTABLISH_REQ: {
as_msg.msgID = _emm_as_security_res(user->emm_data, nas_establish_req_t nas_establish_req = {0};
&msg->u.security, as_msg.msgID = _emm_as_establish_req(user->emm_data, &msg->u.establish, &nas_establish_req);
(void *)(&as_msg.msg.ul_info_transfer_req)); as_msg.msg.nas_establish_req = nas_establish_req;
break; } 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_CELL_INFO_REQ: case _EMMAS_CELL_INFO_REQ:
as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info, 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; break;
case AS_NAS_ESTABLISH_REQ: { case AS_NAS_ESTABLISH_REQ: {
nas_itti_nas_establish_req( nas_itti_nas_establish_req(as_msg.msg.nas_establish_req.cause,
as_msg.msg.nas_establish_req.cause, as_msg.msg.nas_establish_req.type,
as_msg.msg.nas_establish_req.type, as_msg.msg.nas_establish_req.s_tmsi,
as_msg.msg.nas_establish_req.s_tmsi, as_msg.msg.nas_establish_req.plmnID,
as_msg.msg.nas_establish_req.plmnID, as_msg.msg.nas_establish_req.initialNasMsg.nas_data,
as_msg.msg.nas_establish_req.initialNasMsg.data, as_msg.msg.nas_establish_req.initialNasMsg.length,
as_msg.msg.nas_establish_req.initialNasMsg.length, user->ueid);
user->ueid);
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
break; break;
case AS_UL_INFO_TRANSFER_REQ: { case AS_UL_INFO_TRANSFER_REQ: {
nas_itti_ul_data_req( nas_itti_ul_data_req(as_msg.msg.ul_info_transfer_req.UEid,
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.data, as_msg.msg.ul_info_transfer_req.nasMsg.length,
as_msg.msg.ul_info_transfer_req.nasMsg.length, user->ueid);
user->ueid);
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
break; break;
@@ -1075,11 +1059,9 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg, 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)
void *ul_info_transfer_req_unaligned)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
ul_info_transfer_req_t *as_msg = (ul_info_transfer_req_t *)ul_info_transfer_req_unaligned;
int size = 0; int size = 0;
bool is_encoded = false; 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 ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t *msg, 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)
void *ul_info_transfer_req_unaligned)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int size = 0; 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)", LOG_TRACE(INFO, "EMMAS-SAP - Send AS status indication (cause=%d)",
msg->emm_cause); msg->emm_cause);
nas_message_t nas_msg;
memset(&nas_msg, 0 , sizeof(nas_message_t));
/* Setup the AS message */ /* Setup the AS message */
if (msg->guti) { if (msg->guti) {
as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; 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 */ /* Setup the NAS security header */
nas_message_t nas_msg = {0};
EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
/* Setup the NAS information message */ /* 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 ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_release_req(const emm_as_release_t *msg, static int _emm_as_release_req(const emm_as_release_t *msg, nas_release_req_t *as_msg)
void *nas_release_req_unaligned)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_TRACE(INFO, "EMMAS-SAP - Send AS release request"); 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 */ /* Setup the AS message */
if (msg->guti) { if (msg->guti) {
as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; 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 ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_security_t *msg, 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)
void *ul_info_transfer_req_unaligned)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
ul_info_transfer_req_t *as_msg=(ul_info_transfer_req_t *)ul_info_transfer_req_unaligned;
int size = 0; int size = 0;
LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response"); 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 */ /* Setup the AS message */
if (msg->guti) { if (msg->guti) {
as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; 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 */ /* Setup the NAS security header */
nas_message_t nas_msg = {0};
EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
/* Setup the NAS security message */ /* 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 ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, static int _emm_as_establish_req(const emm_data_t *emm_data, const emm_as_establish_t *msg, nas_establish_req_t *as_msg)
void *nas_establish_req_unaligned)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int size = 0; 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"); 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 */ /* Setup the AS message */
as_msg->cause = msg->RRCcause; as_msg->cause = msg->RRCcause;
as_msg->type = msg->RRCtype; 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 */ /* Setup the NAS security header */
nas_message_t nas_msg = {0};
EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
/* Setup the initial NAS information message */ /* Setup the initial NAS information message */
+5 -4
View File
@@ -253,7 +253,8 @@ static void *_nas_network_mngr(void *args)
/* Network receiving loop */ /* Network receiving loop */
while (true) { while (true) {
/* Read the network data message */ /* 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) { if (bytes == RETURNerror) {
/* Failed to read data from the network sublayer; /* Failed to read data from the network sublayer;
@@ -269,7 +270,8 @@ static void *_nas_network_mngr(void *args)
} }
/* Decode the network data message */ /* 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) { if (network_message_id == RETURNerror) {
/* Failed to decode data read from the network sublayer */ /* 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 */ /* Process the network data message */
ret_code = nas_network_process_data (user, network_message_id, ret_code = nas_network_process_data(user, network_message_id, &_as_data);
network_api_get_data ());
if (ret_code != RETURNok) { if (ret_code != RETURNok) {
/* The network data message has not been successfully /* The network data message has not been successfully
+2 -2
View File
@@ -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).type = type;
NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi; NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi;
NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID; 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; 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); 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; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_UPLINK_DATA_REQ); 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).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; 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); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
} }
+2 -4
View File
@@ -161,8 +161,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
if ( (confirm.errCode == AS_SUCCESS) || if ( (confirm.errCode == AS_SUCCESS) ||
(confirm.errCode == AS_TERMINATED_NAS) ) { (confirm.errCode == AS_TERMINATED_NAS) ) {
rc = nas_proc_establish_cnf(user, confirm.nasMsg.data, rc = nas_proc_establish_cnf(user, confirm.nasMsg.nas_data, confirm.nasMsg.length);
confirm.nasMsg.length);
} else { } else {
LOG_TRACE(WARNING, "NET-MAIN - " LOG_TRACE(WARNING, "NET-MAIN - "
"Initial NAS message not delivered"); "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: { case AS_DL_INFO_TRANSFER_IND: {
const dl_info_transfer_ind_t info = msg->msg.dl_info_transfer_ind; const dl_info_transfer_ind_t info = msg->msg.dl_info_transfer_ind;
/* Received downlink data transfer indication */ /* Received downlink data transfer indication */
rc = nas_proc_dl_transfer_ind(user, info.nasMsg.data, rc = nas_proc_dl_transfer_ind(user, info.nasMsg.nas_data, info.nasMsg.length);
info.nasMsg.length);
break; break;
} }
+3 -8
View File
@@ -255,7 +255,7 @@ void *nas_ue_task(void *args_p)
if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS) if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS)
|| (NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_TERMINATED_NAS)) { || (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! */ /* 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); // 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), 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_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); 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);
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);
}
break; break;